problem with drawable
This commit is contained in:
parent
b118e9f5a3
commit
2a856156cc
3 changed files with 20 additions and 10 deletions
|
@ -23,8 +23,12 @@ import android.widget.ImageView;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
public class ContextMenuAdapter {
|
public class ContextMenuAdapter {
|
||||||
|
|
||||||
|
// Log log =
|
||||||
|
|
||||||
public interface OnContextMenuClick {
|
public interface OnContextMenuClick {
|
||||||
//boolean return type needed to desribe if drawer needed to be close or not
|
//boolean return type needed to desribe if drawer needed to be close or not
|
||||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked);
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked);
|
||||||
|
@ -345,7 +349,12 @@ public class ContextMenuAdapter {
|
||||||
Drawable imageId = getImage(app, position, holoLight);
|
Drawable imageId = getImage(app, position, holoLight);
|
||||||
if (imageId != null) {
|
if (imageId != null) {
|
||||||
if (layoutId == R.layout.simple_list_menu_item) {
|
if (layoutId == R.layout.simple_list_menu_item) {
|
||||||
tv.setCompoundDrawablesWithIntrinsicBounds(imageId, null, null, null);
|
float density = activity.getResources().getDisplayMetrics().density;
|
||||||
|
int paddingInPixels = (int) (24 * density);
|
||||||
|
int drawableSizeInPixels = (int) (50 * density); // 32
|
||||||
|
imageId.setBounds(0, 0, drawableSizeInPixels, drawableSizeInPixels);
|
||||||
|
tv.setCompoundDrawables(imageId, null, null, null);
|
||||||
|
tv.setCompoundDrawablePadding(paddingInPixels);
|
||||||
} else {
|
} else {
|
||||||
((ImageView) convertView.findViewById(R.id.icon)).setImageDrawable(imageId);
|
((ImageView) convertView.findViewById(R.id.icon)).setImageDrawable(imageId);
|
||||||
convertView.findViewById(R.id.icon).setVisibility(View.VISIBLE);
|
convertView.findViewById(R.id.icon).setVisibility(View.VISIBLE);
|
||||||
|
|
|
@ -221,6 +221,7 @@ public class MapActivity extends AccessibleActivity {
|
||||||
FirstUsageFragment.TAG).commit();
|
FirstUsageFragment.TAG).commit();
|
||||||
}
|
}
|
||||||
ListView menuItemsListView = (ListView) findViewById(R.id.menuItems);
|
ListView menuItemsListView = (ListView) findViewById(R.id.menuItems);
|
||||||
|
menuItemsListView.setDivider(null);
|
||||||
menuItemsListView.setAdapter(mapActions.createMainOptionsMenu().createSimpleListAdapter(this, true));
|
menuItemsListView.setAdapter(mapActions.createMainOptionsMenu().createSimpleListAdapter(this, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -544,6 +544,14 @@ public class MapActivityActions implements DialogProvider {
|
||||||
final OsmandApplication app = mapActivity.getMyApplication();
|
final OsmandApplication app = mapActivity.getMyApplication();
|
||||||
ContextMenuAdapter optionsMenuHelper = new ContextMenuAdapter(app);
|
ContextMenuAdapter optionsMenuHelper = new ContextMenuAdapter(app);
|
||||||
|
|
||||||
|
optionsMenuHelper.item(R.string.target_points).iconColor(R.drawable.ic_action_flage_dark)
|
||||||
|
.listen(new OnContextMenuClick() {
|
||||||
|
@Override
|
||||||
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
|
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.WAYPOINTS);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}).reg();
|
||||||
optionsMenuHelper.item(R.string.get_directions).iconColor(R.drawable.ic_action_gdirections_dark)
|
optionsMenuHelper.item(R.string.get_directions).iconColor(R.drawable.ic_action_gdirections_dark)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -557,15 +565,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
optionsMenuHelper.item(R.string.target_points).iconColor(R.drawable.ic_action_flage_dark)
|
// Default actions (Layers, Configure Map screen, Settings, Search, Favorites)
|
||||||
.listen(new OnContextMenuClick() {
|
|
||||||
@Override
|
|
||||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
|
||||||
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.WAYPOINTS);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}).reg();
|
|
||||||
// Default actions (Layers, Configure Map screen, Settings, Search, Favorites)
|
|
||||||
optionsMenuHelper.item(R.string.search_button)
|
optionsMenuHelper.item(R.string.search_button)
|
||||||
.iconColor(R.drawable.ic_action_search_dark)
|
.iconColor(R.drawable.ic_action_search_dark)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
|
|
Loading…
Reference in a new issue