Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
62fac13d26
13 changed files with 75 additions and 130 deletions
|
@ -1,11 +1,11 @@
|
|||
package net.osmand.plus;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.DrawableRes;
|
||||
import android.support.annotation.IdRes;
|
||||
import android.support.annotation.LayoutRes;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.graphics.drawable.DrawableCompat;
|
||||
|
@ -35,60 +35,38 @@ import java.util.Set;
|
|||
public class ContextMenuAdapter {
|
||||
private static final Log LOG = PlatformUtil.getLog(ContextMenuAdapter.class);
|
||||
|
||||
private final Context ctx;
|
||||
@LayoutRes
|
||||
private int defaultLayoutId = Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB ?
|
||||
private int DEFAULT_LAYOUT_ID = Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB ?
|
||||
R.layout.list_menu_item : R.layout.list_menu_item_native;
|
||||
List<ContextMenuItem> items = new ArrayList<>();
|
||||
private ConfigureMapMenu.OnClickListener changeAppModeListener = null;
|
||||
//neded to detect whether user opened all modes or not
|
||||
private BooleanResult allModes = new BooleanResult();
|
||||
|
||||
public ContextMenuAdapter(Context ctx, boolean allModes) {
|
||||
this.ctx = ctx;
|
||||
this.allModes.setResult(allModes);
|
||||
}
|
||||
|
||||
public ContextMenuAdapter(Context ctx) {
|
||||
this.ctx = ctx;
|
||||
}
|
||||
|
||||
public int length() {
|
||||
return items.size();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public int getElementId(int position) {
|
||||
return items.get(position).getTitleId();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public OnContextMenuClick getClickAdapter(int position) {
|
||||
return items.get(position).getCheckBoxListener();
|
||||
}
|
||||
|
||||
public OnIntegerValueChangedListener getIntegerLister(int position) {
|
||||
return items.get(position).getIntegerListener();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public String getItemName(int position) {
|
||||
return items.get(position).getTitle();
|
||||
}
|
||||
|
||||
public String getItemDescr(int position) {
|
||||
return items.get(position).getDescription();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public Boolean getSelection(int position) {
|
||||
return items.get(position).getSelected();
|
||||
}
|
||||
|
||||
public int getProgress(int position) {
|
||||
return items.get(position).getProgress();
|
||||
}
|
||||
|
||||
public int getLoading(int position) {
|
||||
return items.get(position).isLoading() ? 1 : 0;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public Drawable getImage(OsmandApplication ctx, int position, boolean light) {
|
||||
@DrawableRes
|
||||
int lst = items.get(position).getIcon();
|
||||
|
@ -103,39 +81,12 @@ public class ContextMenuAdapter {
|
|||
return null;
|
||||
}
|
||||
|
||||
public Drawable getSecondaryImage(OsmandApplication ctx, int position, boolean light) {
|
||||
@DrawableRes
|
||||
int secondaryDrawableId = items.get(position).getSecondaryLightIcon();
|
||||
if (secondaryDrawableId != -1) {
|
||||
return ctx.getIconsCache().getIcon(secondaryDrawableId, light);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getBackgroundColor(Context ctx, boolean holoLight) {
|
||||
if (holoLight) {
|
||||
return ctx.getResources().getColor(R.color.bg_color_light);
|
||||
} else {
|
||||
return ctx.getResources().getColor(R.color.bg_color_dark);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isCategory(int pos) {
|
||||
return items.get(pos).isCategory();
|
||||
}
|
||||
|
||||
public int getLayoutId(int position) {
|
||||
int l = items.get(position).getLayout();
|
||||
if (l != -1) {
|
||||
return l;
|
||||
}
|
||||
return defaultLayoutId;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setItemName(int position, String str) {
|
||||
items.get(position).setTitle(str);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setItemDescription(int position, String str) {
|
||||
items.get(position).setDescription(str);
|
||||
}
|
||||
|
@ -144,6 +95,7 @@ public class ContextMenuAdapter {
|
|||
items.get(position).setSelected(s);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setProgress(int position, int progress) {
|
||||
items.get(position).setProgress(progress);
|
||||
}
|
||||
|
@ -166,7 +118,7 @@ public class ContextMenuAdapter {
|
|||
}
|
||||
|
||||
public void setDefaultLayoutId(int defaultLayoutId) {
|
||||
this.defaultLayoutId = defaultLayoutId;
|
||||
this.DEFAULT_LAYOUT_ID = defaultLayoutId;
|
||||
}
|
||||
|
||||
|
||||
|
@ -176,34 +128,45 @@ public class ContextMenuAdapter {
|
|||
|
||||
|
||||
public ArrayAdapter<?> createListAdapter(final Activity activity, final boolean holoLight) {
|
||||
final int layoutId = defaultLayoutId;
|
||||
final int layoutId = DEFAULT_LAYOUT_ID;
|
||||
final OsmandApplication app = ((OsmandApplication) activity.getApplication());
|
||||
return new ContextMenuArrayAdapter(activity, layoutId, R.id.title,
|
||||
items.toArray(new ContextMenuItem[items.size()]), app, holoLight);
|
||||
items.toArray(new ContextMenuItem[items.size()]), app, holoLight, changeAppModeListener);
|
||||
}
|
||||
|
||||
public class ContextMenuArrayAdapter extends ArrayAdapter<ContextMenuItem> {
|
||||
private OsmandApplication app;
|
||||
private boolean holoLight;
|
||||
@LayoutRes
|
||||
private int layoutId;
|
||||
private final ConfigureMapMenu.OnClickListener changeAppModeListener;
|
||||
|
||||
public ContextMenuArrayAdapter(Activity context, int resource, int textViewResourceId,
|
||||
ContextMenuItem[] objects, OsmandApplication app, boolean holoLight) {
|
||||
super(context, resource, textViewResourceId, objects);
|
||||
public ContextMenuArrayAdapter(Activity context,
|
||||
@LayoutRes
|
||||
int layoutRes,
|
||||
@IdRes
|
||||
int textViewResourceId,
|
||||
ContextMenuItem[] objects,
|
||||
OsmandApplication app,
|
||||
boolean holoLight,
|
||||
ConfigureMapMenu.OnClickListener changeAppModeListener) {
|
||||
super(context, layoutRes, textViewResourceId, objects);
|
||||
this.app = app;
|
||||
this.holoLight = holoLight;
|
||||
layoutId = resource;
|
||||
layoutId = layoutRes;
|
||||
this.changeAppModeListener = changeAppModeListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
||||
// User super class to create the View
|
||||
final ContextMenuItem item = getItem(position);
|
||||
Integer lid = getLayoutId(position);
|
||||
if (lid == R.layout.mode_toggles) {
|
||||
final Set<ApplicationMode> selected = new LinkedHashSet<ApplicationMode>();
|
||||
int layoutId = item.getLayout();
|
||||
layoutId = layoutId != -1 ? layoutId : DEFAULT_LAYOUT_ID;
|
||||
if (layoutId == R.layout.mode_toggles) {
|
||||
final Set<ApplicationMode> selected = new LinkedHashSet<>();
|
||||
return AppModeDialog.prepareAppModeDrawerView((Activity) getContext(),
|
||||
selected, allModes, true, new View.OnClickListener() {
|
||||
selected, true, new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (selected.size() > 0) {
|
||||
|
@ -211,23 +174,22 @@ public class ContextMenuAdapter {
|
|||
notifyDataSetChanged();
|
||||
}
|
||||
if (changeAppModeListener != null) {
|
||||
changeAppModeListener.onClick(allModes.getResult());
|
||||
changeAppModeListener.onClick();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
if (convertView == null || (!lid.equals(convertView.getTag()))) {
|
||||
convertView = LayoutInflater.from(getContext()).inflate(lid, parent, false);
|
||||
// AndroidUtils.setListItemBackground(ctx, convertView, !holoLight);
|
||||
convertView.setTag(lid);
|
||||
if (convertView == null || (layoutId != convertView.getTag())) {
|
||||
convertView = LayoutInflater.from(getContext()).inflate(layoutId, parent, false);
|
||||
convertView.setTag(layoutId);
|
||||
}
|
||||
TextView tv = (TextView) convertView.findViewById(R.id.title);
|
||||
if (!isCategory(position)) {
|
||||
if (!item.isCategory()) {
|
||||
AndroidUtils.setTextPrimaryColor(getContext(), tv, !holoLight);
|
||||
}
|
||||
tv.setText(isCategory(position) ? getItemName(position).toUpperCase() : getItemName(position));
|
||||
tv.setText(item.isCategory() ? item.getTitle().toUpperCase() : item.getTitle());
|
||||
|
||||
if (layoutId == R.layout.simple_list_menu_item) {
|
||||
if (this.layoutId == R.layout.simple_list_menu_item) {
|
||||
int color = ContextCompat.getColor(getContext(),
|
||||
holoLight ? R.color.icon_color : R.color.dashboard_subheader_text_dark);
|
||||
Drawable imageId = ContextCompat.getDrawable(getContext(), item.getLightIcon());
|
||||
|
@ -241,7 +203,6 @@ public class ContextMenuAdapter {
|
|||
} else {
|
||||
Drawable drawable = getImage(app, position, holoLight);
|
||||
if (drawable != null) {
|
||||
|
||||
((ImageView) convertView.findViewById(R.id.icon)).setImageDrawable(drawable);
|
||||
convertView.findViewById(R.id.icon).setVisibility(View.VISIBLE);
|
||||
} else if (convertView.findViewById(R.id.icon) != null) {
|
||||
|
@ -249,11 +210,11 @@ public class ContextMenuAdapter {
|
|||
}
|
||||
}
|
||||
@DrawableRes
|
||||
int secondaryLightDrawable = item.getSecondaryLightIcon();
|
||||
if (secondaryLightDrawable != -1) {
|
||||
int secondaryDrawable = item.getSecondaryIcon();
|
||||
if (secondaryDrawable != -1) {
|
||||
int color = ContextCompat.getColor(getContext(),
|
||||
holoLight ? R.color.icon_color : R.color.dashboard_subheader_text_dark);
|
||||
Drawable drawable = getSecondaryImage(app, position, holoLight);
|
||||
Drawable drawable = ContextCompat.getDrawable(getContext(), item.getSecondaryIcon());
|
||||
DrawableCompat.setTint(drawable, color);
|
||||
ImageView imageView = (ImageView) convertView.findViewById(R.id.secondary_icon);
|
||||
imageView.setImageDrawable(drawable);
|
||||
|
@ -265,13 +226,13 @@ public class ContextMenuAdapter {
|
|||
}
|
||||
}
|
||||
|
||||
if (isCategory(position)) {
|
||||
if (item.isCategory()) {
|
||||
tv.setTypeface(Typeface.DEFAULT_BOLD);
|
||||
} else {
|
||||
tv.setTypeface(null);
|
||||
}
|
||||
|
||||
if (convertView.findViewById(R.id.toggle_item) != null) {
|
||||
if (convertView.findViewById(R.id.toggle_item) != null && !item.isCategory()) {
|
||||
final CompoundButton ch = (CompoundButton) convertView.findViewById(R.id.toggle_item);
|
||||
if (item.getSelected() != null) {
|
||||
ch.setOnCheckedChangeListener(null);
|
||||
|
@ -282,10 +243,10 @@ public class ContextMenuAdapter {
|
|||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
OnContextMenuClick ca = getClickAdapter(position);
|
||||
OnContextMenuClick ca = item.getCheckBoxListener();
|
||||
item.setSelected(isChecked);
|
||||
if (ca != null) {
|
||||
ca.onContextMenuClick(la, getElementId(position), position, isChecked);
|
||||
ca.onContextMenuClick(la, item.getTitleId(), position, isChecked);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -299,11 +260,11 @@ public class ContextMenuAdapter {
|
|||
if (convertView.findViewById(R.id.seekbar) != null) {
|
||||
SeekBar seekBar = (SeekBar) convertView.findViewById(R.id.seekbar);
|
||||
if (item.getProgress() != -1) {
|
||||
seekBar.setProgress(getProgress(position));
|
||||
seekBar.setProgress(item.getProgress());
|
||||
seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||
@Override
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
OnIntegerValueChangedListener listener = getIntegerLister(position);
|
||||
OnIntegerValueChangedListener listener = item.getIntegerListener();
|
||||
item.setProgress(progress);
|
||||
if (listener != null && fromUser) {
|
||||
listener.onIntegerValueChangedListener(progress);
|
||||
|
@ -333,7 +294,7 @@ public class ContextMenuAdapter {
|
|||
}
|
||||
}
|
||||
|
||||
String itemDescr = getItemDescr(position);
|
||||
String itemDescr = item.getDescription();
|
||||
if (convertView.findViewById(R.id.description) != null) {
|
||||
((TextView) convertView.findViewById(R.id.description)).setText(itemDescr);
|
||||
}
|
||||
|
@ -366,17 +327,4 @@ public class ContextMenuAdapter {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class BooleanResult {
|
||||
private boolean result = false;
|
||||
|
||||
public void setResult(boolean value) {
|
||||
result = value;
|
||||
}
|
||||
|
||||
public boolean getResult() {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -18,7 +18,7 @@ public class ContextMenuItem {
|
|||
@DrawableRes
|
||||
private final int lightIcon;
|
||||
@DrawableRes
|
||||
private final int secondaryLightIcon;
|
||||
private final int secondaryIcon;
|
||||
private Boolean selected;
|
||||
private int progress;
|
||||
@LayoutRes
|
||||
|
@ -30,7 +30,7 @@ public class ContextMenuItem {
|
|||
private ContextMenuAdapter.OnContextMenuClick checkBoxListener;
|
||||
private ContextMenuAdapter.OnIntegerValueChangedListener integerListener;
|
||||
|
||||
private ContextMenuItem(int titleId, String title, int icon, int lightIcon, int secondaryLightIcon,
|
||||
private ContextMenuItem(int titleId, String title, int icon, int lightIcon, int secondaryIcon,
|
||||
Boolean selected, int progress, int layout, boolean loading, boolean category,
|
||||
int pos, String description, ContextMenuAdapter.OnContextMenuClick checkBoxListener,
|
||||
ContextMenuAdapter.OnIntegerValueChangedListener integerListener) {
|
||||
|
@ -38,7 +38,7 @@ public class ContextMenuItem {
|
|||
this.title = title;
|
||||
this.icon = icon;
|
||||
this.lightIcon = lightIcon;
|
||||
this.secondaryLightIcon = secondaryLightIcon;
|
||||
this.secondaryIcon = secondaryIcon;
|
||||
this.selected = selected;
|
||||
this.progress = progress;
|
||||
this.layout = layout;
|
||||
|
@ -66,8 +66,8 @@ public class ContextMenuItem {
|
|||
return lightIcon;
|
||||
}
|
||||
|
||||
public int getSecondaryLightIcon() {
|
||||
return secondaryLightIcon;
|
||||
public int getSecondaryIcon() {
|
||||
return secondaryIcon;
|
||||
}
|
||||
|
||||
public Boolean getSelected() {
|
||||
|
@ -143,7 +143,7 @@ public class ContextMenuItem {
|
|||
private String mTitle;
|
||||
private int mIcon = -1;
|
||||
private int mLightIcon = -1;
|
||||
private int mSecondaryLightIcon = -1;
|
||||
private int mSecondaryIcon = -1;
|
||||
private Boolean mSelected = null;
|
||||
private int mProgress = -1;
|
||||
private int mLayout = -1;
|
||||
|
@ -178,8 +178,8 @@ public class ContextMenuItem {
|
|||
return this;
|
||||
}
|
||||
|
||||
public ItemBuilder setSecondaryLightIcon(int secondaryLightIcon) {
|
||||
mSecondaryLightIcon = secondaryLightIcon;
|
||||
public ItemBuilder setSecondaryIcon(int secondaryIcon) {
|
||||
mSecondaryIcon = secondaryIcon;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -229,7 +229,7 @@ public class ContextMenuItem {
|
|||
}
|
||||
|
||||
public ContextMenuItem createItem() {
|
||||
return new ContextMenuItem(mTitleId, mTitle, mIcon, mLightIcon, mSecondaryLightIcon, mSelected, mProgress, mLayout, mLoading, mCat, mPos, mDescription, mCheckBoxListener, mIntegerListener);
|
||||
return new ContextMenuItem(mTitleId, mTitle, mIcon, mLightIcon, mSecondaryIcon, mSelected, mProgress, mLayout, mLoading, mCat, mPos, mDescription, mCheckBoxListener, mIntegerListener);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -279,7 +279,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
}
|
||||
|
||||
public void contextMenuPoint(final double latitude, final double longitude, final ContextMenuAdapter iadapter, Object selectedObj) {
|
||||
final ContextMenuAdapter adapter = iadapter == null ? new ContextMenuAdapter(mapActivity) : iadapter;
|
||||
final ContextMenuAdapter adapter = iadapter == null ? new ContextMenuAdapter() : iadapter;
|
||||
ContextMenuItem.ItemBuilder itemBuilder = new ContextMenuItem.ItemBuilder();
|
||||
adapter.addItem(itemBuilder.setTitleId(R.string.context_menu_item_search, mapActivity)
|
||||
.setColorIcon(R.drawable.ic_action_search_dark).createItem());
|
||||
|
@ -594,7 +594,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
public ContextMenuAdapter createMainOptionsMenu() {
|
||||
final OsmandMapTileView mapView = mapActivity.getMapView();
|
||||
final OsmandApplication app = mapActivity.getMyApplication();
|
||||
ContextMenuAdapter optionsMenuHelper = new ContextMenuAdapter(app);
|
||||
ContextMenuAdapter optionsMenuHelper = new ContextMenuAdapter();
|
||||
|
||||
optionsMenuHelper.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.home, mapActivity)
|
||||
.setColorIcon(R.drawable.map_dashboard)
|
||||
|
|
|
@ -261,7 +261,7 @@ public class MapActivityLayers {
|
|||
public AlertDialog selectPOIFilterLayer(final OsmandMapTileView mapView, final PoiUIFilter[] selected) {
|
||||
OsmandApplication app = (OsmandApplication) getApplication();
|
||||
final PoiFiltersHelper poiFilters = app.getPoiFilters();
|
||||
final ContextMenuAdapter adapter = new ContextMenuAdapter(activity);
|
||||
final ContextMenuAdapter adapter = new ContextMenuAdapter();
|
||||
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||
.setTitleId(R.string.shared_string_search, app)
|
||||
.setColorIcon(R.drawable.ic_action_search_dark).createItem());
|
||||
|
|
|
@ -10,7 +10,6 @@ import android.widget.LinearLayout.LayoutParams;
|
|||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
|
@ -36,7 +35,7 @@ public class AppModeDialog {
|
|||
|
||||
//special method for drawer menu
|
||||
//needed because if there's more than 4 items - the don't fit in drawer
|
||||
public static View prepareAppModeDrawerView(Activity a, final Set<ApplicationMode> selected, ContextMenuAdapter.BooleanResult allModes,
|
||||
public static View prepareAppModeDrawerView(Activity a, final Set<ApplicationMode> selected,
|
||||
boolean useMapTheme, final View.OnClickListener onClickListener) {
|
||||
OsmandSettings settings = ((OsmandApplication) a.getApplication()).getSettings();
|
||||
final List<ApplicationMode> values = new ArrayList<ApplicationMode>(ApplicationMode.values(settings));
|
||||
|
|
|
@ -56,22 +56,20 @@ public class ConfigureMapMenu {
|
|||
private static final Log LOG = PlatformUtil.getLog(ConfigureMapMenu.class);
|
||||
|
||||
public interface OnClickListener {
|
||||
public void onClick(boolean result);
|
||||
void onClick();
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
private boolean allModes = false;
|
||||
|
||||
public ContextMenuAdapter createListAdapter(final MapActivity ma) {
|
||||
ContextMenuAdapter adapter = new ContextMenuAdapter(ma, allModes);
|
||||
ContextMenuAdapter adapter = new ContextMenuAdapter();
|
||||
adapter.setDefaultLayoutId(R.layout.drawer_list_item);
|
||||
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||
.setTitleId(R.string.app_modes_choose, ma)
|
||||
.setLayout(R.layout.mode_toggles).createItem());
|
||||
adapter.setChangeAppModeListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(boolean result) {
|
||||
public void onClick() {
|
||||
allModes = true;
|
||||
ma.getDashboard().updateListAdapter(createListAdapter(ma));
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ public class RasterMapMenu {
|
|||
|
||||
public static ContextMenuAdapter createListAdapter(final MapActivity mapActivity,
|
||||
final OsmandRasterMapsPlugin.RasterMapType type) {
|
||||
ContextMenuAdapter adapter = new ContextMenuAdapter(mapActivity, false);
|
||||
ContextMenuAdapter adapter = new ContextMenuAdapter();
|
||||
adapter.setDefaultLayoutId(R.layout.list_item_icon_and_menu);
|
||||
createLayersItems(adapter, mapActivity, type);
|
||||
return adapter;
|
||||
|
|
|
@ -172,7 +172,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
|
|||
|
||||
private void showContextMenu(final LocalIndexInfo info) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
final ContextMenuAdapter adapter = new ContextMenuAdapter(getActivity());
|
||||
final ContextMenuAdapter adapter = new ContextMenuAdapter();
|
||||
basicFileOperation(info, adapter);
|
||||
OsmandPlugin.onContextMenuActivity(getActivity(), null, info, adapter);
|
||||
|
||||
|
@ -593,7 +593,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
|
|||
ActionBar actionBar = getDownloadActivity().getSupportActionBar();
|
||||
//hide action bar from downloadindexfragment
|
||||
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
|
||||
optionsMenuAdapter = new ContextMenuAdapter(getDownloadActivity());
|
||||
optionsMenuAdapter = new ContextMenuAdapter();
|
||||
OnContextMenuClick listener = new OnContextMenuClick() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
|
|
|
@ -198,7 +198,7 @@ public class GpxUiHelper {
|
|||
private static ContextMenuAdapter createGpxContextMenuAdapter(Activity activity, List<String> allGpxList,
|
||||
List<String> selectedGpxList, boolean multipleChoice,
|
||||
boolean showCurrentTrack) {
|
||||
final ContextMenuAdapter adapter = new ContextMenuAdapter(activity);
|
||||
final ContextMenuAdapter adapter = new ContextMenuAdapter();
|
||||
//element position in adapter
|
||||
int i = 0;
|
||||
for (String s : allGpxList) {
|
||||
|
|
|
@ -553,7 +553,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
|||
}
|
||||
|
||||
public void buttonMorePressed() {
|
||||
final ContextMenuAdapter menuAdapter = new ContextMenuAdapter(mapActivity);
|
||||
final ContextMenuAdapter menuAdapter = new ContextMenuAdapter();
|
||||
for (OsmandMapLayer layer : mapActivity.getMapView().getLayers()) {
|
||||
layer.populateObjectContextMenu(latLon, object, menuAdapter, mapActivity);
|
||||
}
|
||||
|
|
|
@ -204,7 +204,7 @@ public class RoutePreferencesMenu {
|
|||
}
|
||||
|
||||
public static void selectVoiceGuidance(final MapActivity mapActivity, final CallbackWithObject<String> callback) {
|
||||
final ContextMenuAdapter adapter = new ContextMenuAdapter(mapActivity);
|
||||
final ContextMenuAdapter adapter = new ContextMenuAdapter();
|
||||
|
||||
String[] entries;
|
||||
final String[] entrieValues;
|
||||
|
|
|
@ -327,7 +327,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
((FavoritesActivity) getActivity()).getClearToolbar(false);
|
||||
}
|
||||
|
||||
optionsMenuAdapter = new ContextMenuAdapter(getActivity());
|
||||
optionsMenuAdapter = new ContextMenuAdapter();
|
||||
OnContextMenuClick listener = new OnContextMenuClick() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, final int itemId, int pos, boolean isChecked) {
|
||||
|
|
|
@ -403,7 +403,7 @@ public class MapWidgetRegistry {
|
|||
adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(r.messageId, map)
|
||||
.setSelected(r.visibleCollapsed(mode) || r.visible(mode))
|
||||
.setColorIcon(r.drawableMenu)
|
||||
.setSecondaryLightIcon(R.drawable.ic_action_additional_option)
|
||||
.setSecondaryIcon(R.drawable.ic_action_additional_option)
|
||||
.setListener(new OnContextMenuClick() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> a, int itemId, int pos, boolean isChecked) {
|
||||
|
@ -496,14 +496,14 @@ public class MapWidgetRegistry {
|
|||
}
|
||||
|
||||
public ContextMenuAdapter getViewConfigureMenuAdapter(final MapActivity map) {
|
||||
final ContextMenuAdapter cm = new ContextMenuAdapter(map);
|
||||
final ContextMenuAdapter cm = new ContextMenuAdapter();
|
||||
cm.setDefaultLayoutId(R.layout.list_item_icon_and_menu);
|
||||
cm.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.app_modes_choose, map)
|
||||
.setLayout(R.layout.mode_toggles).createItem());
|
||||
cm.setChangeAppModeListener(new ConfigureMapMenu.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(boolean allModes) {
|
||||
public void onClick() {
|
||||
map.getDashboard().updateListAdapter(getViewConfigureMenuAdapter(map));
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue