Refactoring
This commit is contained in:
parent
4e88cae12b
commit
5fdcc6b341
21 changed files with 124 additions and 114 deletions
15
OsmAnd/res/menu/vidget_visibility_menu.xml
Normal file
15
OsmAnd/res/menu/vidget_visibility_menu.xml
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:id="@+id/action_show"
|
||||
android:icon="@drawable/ic_action_view"
|
||||
android:title="@string/shared_string_show"/>
|
||||
<item
|
||||
android:id="@+id/action_hide"
|
||||
android:icon="@drawable/ic_action_hide"
|
||||
android:title="@string/shared_string_hide"/>
|
||||
<item
|
||||
android:id="@+id/action_collapse"
|
||||
android:icon="@drawable/ic_action_widget_collapse"
|
||||
android:title="@string/shared_string_collapse"/>
|
||||
</menu>
|
|
@ -52,8 +52,8 @@ public class ContextMenuAdapter {
|
|||
}
|
||||
|
||||
@Deprecated
|
||||
public OnContextMenuClick getClickAdapter(int position) {
|
||||
return items.get(position).getCheckBoxListener();
|
||||
public ItemClickListener getClickAdapter(int position) {
|
||||
return items.get(position).getItemClickListener();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
|
@ -91,6 +91,7 @@ public class ContextMenuAdapter {
|
|||
items.get(position).setDescription(str);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setSelection(int position, boolean s) {
|
||||
items.get(position).setSelected(s);
|
||||
}
|
||||
|
@ -241,7 +242,7 @@ public class ContextMenuAdapter {
|
|||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
OnContextMenuClick ca = item.getCheckBoxListener();
|
||||
ItemClickListener ca = item.getItemClickListener();
|
||||
item.setSelected(isChecked);
|
||||
if (ca != null) {
|
||||
ca.onContextMenuClick(la, item.getTitleId(), position, isChecked);
|
||||
|
@ -305,7 +306,7 @@ public class ContextMenuAdapter {
|
|||
}
|
||||
}
|
||||
|
||||
public interface OnContextMenuClick {
|
||||
public interface ItemClickListener {
|
||||
//boolean return type needed to desribe if drawer needed to be close or not
|
||||
boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked);
|
||||
}
|
||||
|
@ -314,12 +315,9 @@ public class ContextMenuAdapter {
|
|||
boolean onIntegerValueChangedListener(int newValue);
|
||||
}
|
||||
|
||||
public static abstract class OnRowItemClick implements OnContextMenuClick {
|
||||
public static abstract class OnRowItemClick implements ItemClickListener {
|
||||
|
||||
public OnRowItemClick() {
|
||||
}
|
||||
|
||||
//boolean return type needed to desribe if drawer needed to be close or not
|
||||
//boolean return type needed to describe if drawer needed to be close or not
|
||||
public boolean onRowItemClick(ArrayAdapter<?> adapter, View view, int itemId, int pos) {
|
||||
CompoundButton btn = (CompoundButton) view.findViewById(R.id.toggle_item);
|
||||
if (btn != null && btn.getVisibility() == View.VISIBLE) {
|
||||
|
|
|
@ -5,10 +5,8 @@ import android.support.annotation.DrawableRes;
|
|||
import android.support.annotation.LayoutRes;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.StringRes;
|
||||
import android.widget.CompoundButton;
|
||||
|
||||
/**
|
||||
* Created by GaidamakUA on 3/25/16.
|
||||
*/
|
||||
public class ContextMenuItem {
|
||||
@StringRes
|
||||
private final int titleId;
|
||||
|
@ -27,12 +25,16 @@ public class ContextMenuItem {
|
|||
private final boolean category;
|
||||
private final int pos;
|
||||
private String description;
|
||||
private ContextMenuAdapter.OnContextMenuClick checkBoxListener;
|
||||
private ContextMenuAdapter.OnIntegerValueChangedListener integerListener;
|
||||
private final ContextMenuAdapter.ItemClickListener itemClickListener;
|
||||
private final CompoundButton.OnCheckedChangeListener checkboxListener;
|
||||
private final ContextMenuAdapter.OnIntegerValueChangedListener integerListener;
|
||||
|
||||
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,
|
||||
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.ItemClickListener itemClickListener,
|
||||
CompoundButton.OnCheckedChangeListener checkboxListener,
|
||||
ContextMenuAdapter.OnIntegerValueChangedListener integerListener) {
|
||||
this.titleId = titleId;
|
||||
this.title = title;
|
||||
|
@ -46,7 +48,8 @@ public class ContextMenuItem {
|
|||
this.category = category;
|
||||
this.pos = pos;
|
||||
this.description = description;
|
||||
this.checkBoxListener = checkBoxListener;
|
||||
this.itemClickListener = itemClickListener;
|
||||
this.checkboxListener = checkboxListener;
|
||||
this.integerListener = integerListener;
|
||||
}
|
||||
|
||||
|
@ -98,8 +101,8 @@ public class ContextMenuItem {
|
|||
return description;
|
||||
}
|
||||
|
||||
public ContextMenuAdapter.OnContextMenuClick getCheckBoxListener() {
|
||||
return checkBoxListener;
|
||||
public ContextMenuAdapter.ItemClickListener getItemClickListener() {
|
||||
return itemClickListener;
|
||||
}
|
||||
|
||||
public ContextMenuAdapter.OnIntegerValueChangedListener getIntegerListener() {
|
||||
|
@ -126,14 +129,6 @@ public class ContextMenuItem {
|
|||
this.description = description;
|
||||
}
|
||||
|
||||
public void setCheckBoxListener(ContextMenuAdapter.OnContextMenuClick checkBoxListener) {
|
||||
this.checkBoxListener = checkBoxListener;
|
||||
}
|
||||
|
||||
public void setIntegerListener(ContextMenuAdapter.OnIntegerValueChangedListener integerListener) {
|
||||
this.integerListener = integerListener;
|
||||
}
|
||||
|
||||
public static ItemBuilder createBuilder(String title) {
|
||||
return new ItemBuilder().setTitle(title);
|
||||
}
|
||||
|
@ -151,7 +146,8 @@ public class ContextMenuItem {
|
|||
private boolean mCat = false;
|
||||
private int mPos = -1;
|
||||
private String mDescription = null;
|
||||
private ContextMenuAdapter.OnContextMenuClick mCheckBoxListener = null;
|
||||
private ContextMenuAdapter.ItemClickListener mItemClickListener = null;
|
||||
private CompoundButton.OnCheckedChangeListener mCheckboxListener;
|
||||
private ContextMenuAdapter.OnIntegerValueChangedListener mIntegerListener = null;
|
||||
|
||||
public ItemBuilder setTitleId(int titleId, @Nullable Context context) {
|
||||
|
@ -218,18 +214,24 @@ public class ContextMenuItem {
|
|||
return this;
|
||||
}
|
||||
|
||||
public ItemBuilder setListener(ContextMenuAdapter.OnContextMenuClick checkBoxListener) {
|
||||
mCheckBoxListener = checkBoxListener;
|
||||
public ItemBuilder setListener(ContextMenuAdapter.ItemClickListener checkBoxListener) {
|
||||
mItemClickListener = checkBoxListener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setCheckboxListener(CompoundButton.OnCheckedChangeListener checkboxListener) {
|
||||
mCheckboxListener = checkboxListener;
|
||||
}
|
||||
|
||||
public ItemBuilder setIntegerListener(ContextMenuAdapter.OnIntegerValueChangedListener integerListener) {
|
||||
mIntegerListener = integerListener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ContextMenuItem createItem() {
|
||||
return new ContextMenuItem(mTitleId, mTitle, mIcon, mLightIcon, mSecondaryIcon, mSelected, mProgress, mLayout, mLoading, mCat, mPos, mDescription, mCheckBoxListener, mIntegerListener);
|
||||
return new ContextMenuItem(mTitleId, mTitle, mIcon, mLightIcon, mSecondaryIcon,
|
||||
mSelected, mProgress, mLayout, mLoading, mCat, mPos, mDescription,
|
||||
mItemClickListener, mCheckboxListener, mIntegerListener);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ import net.osmand.data.RotatedTileBox;
|
|||
import net.osmand.map.ITileSource;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||
import net.osmand.plus.ContextMenuAdapter.ItemClickListener;
|
||||
import net.osmand.plus.ContextMenuItem;
|
||||
import net.osmand.plus.GPXUtilities;
|
||||
import net.osmand.plus.GPXUtilities.GPXFile;
|
||||
|
@ -302,7 +302,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
int standardId = adapter.getElementId(which);
|
||||
OnContextMenuClick click = adapter.getClickAdapter(which);
|
||||
ItemClickListener click = adapter.getClickAdapter(which);
|
||||
if (click != null) {
|
||||
click.onContextMenuClick(listAdapter, standardId, which, false);
|
||||
} else if (standardId == R.string.context_menu_item_last_intermediate_point) {
|
||||
|
@ -598,7 +598,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
|
||||
optionsMenuHelper.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.home, mapActivity)
|
||||
.setColorIcon(R.drawable.map_dashboard)
|
||||
.setListener(new OnContextMenuClick() {
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
MapActivity.clearPrevActivityIntent();
|
||||
|
@ -610,7 +610,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
if (settings.USE_MAP_MARKERS.get()) {
|
||||
optionsMenuHelper.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.map_markers, mapActivity)
|
||||
.setColorIcon(R.drawable.ic_action_flag_dark)
|
||||
.setListener(new OnContextMenuClick() {
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
MapActivity.clearPrevActivityIntent();
|
||||
|
@ -621,7 +621,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
} else {
|
||||
optionsMenuHelper.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.waypoints, mapActivity)
|
||||
.setColorIcon(R.drawable.ic_action_intermediate)
|
||||
.setListener(new OnContextMenuClick() {
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
MapActivity.clearPrevActivityIntent();
|
||||
|
@ -632,7 +632,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
}
|
||||
optionsMenuHelper.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.get_directions, mapActivity)
|
||||
.setColorIcon(R.drawable.ic_action_gdirections_dark)
|
||||
.setListener(new OnContextMenuClick() {
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
MapActivity.clearPrevActivityIntent();
|
||||
|
@ -651,7 +651,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
// Default actions (Layers, Configure Map screen, Settings, Search, Favorites)
|
||||
optionsMenuHelper.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.search_button, mapActivity)
|
||||
.setColorIcon(R.drawable.ic_action_search_dark)
|
||||
.setListener(new OnContextMenuClick() {
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization()
|
||||
|
@ -670,7 +670,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
|
||||
optionsMenuHelper.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.shared_string_my_places, mapActivity)
|
||||
.setColorIcon(R.drawable.ic_action_fav_dark)
|
||||
.setListener(new OnContextMenuClick() {
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization()
|
||||
|
@ -684,7 +684,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
|
||||
optionsMenuHelper.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.show_point_options, mapActivity)
|
||||
.setColorIcon(R.drawable.ic_action_marker_dark)
|
||||
.setListener(new OnContextMenuClick() {
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
MapActivity.clearPrevActivityIntent();
|
||||
|
@ -695,7 +695,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
|
||||
optionsMenuHelper.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.configure_map, mapActivity)
|
||||
.setColorIcon(R.drawable.ic_action_layers_dark)
|
||||
.setListener(new OnContextMenuClick() {
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
MapActivity.clearPrevActivityIntent();
|
||||
|
@ -706,7 +706,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
|
||||
optionsMenuHelper.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.layer_map_appearance, mapActivity)
|
||||
.setColorIcon(R.drawable.ic_configure_screen_dark)
|
||||
.setListener(new OnContextMenuClick() {
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
MapActivity.clearPrevActivityIntent();
|
||||
|
@ -724,7 +724,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
}
|
||||
optionsMenuHelper.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.index_settings, null)
|
||||
.setTitle(d).setColorIcon(R.drawable.ic_type_archive)
|
||||
.setListener(new OnContextMenuClick() {
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization()
|
||||
|
@ -738,7 +738,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
if (Version.isGooglePlayEnabled(app)) {
|
||||
optionsMenuHelper.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.osm_live, mapActivity)
|
||||
.setColorIcon(R.drawable.ic_action_osm_live)
|
||||
.setListener(new OnContextMenuClick() {
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
Intent intent = new Intent(mapActivity, OsmLiveActivity.class);
|
||||
|
@ -751,7 +751,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
|
||||
optionsMenuHelper.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.prefs_plugins, mapActivity)
|
||||
.setColorIcon(R.drawable.ic_extension_dark)
|
||||
.setListener(new OnContextMenuClick() {
|
||||
.setListener(new ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization()
|
||||
|
@ -765,7 +765,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
|
||||
optionsMenuHelper.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.shared_string_settings, mapActivity)
|
||||
.setColorIcon(R.drawable.ic_action_settings)
|
||||
.setListener(new OnContextMenuClick() {
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
final Intent settings = new Intent(mapActivity, getMyApplication().getAppCustomization()
|
||||
|
@ -777,7 +777,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
}).createItem());
|
||||
optionsMenuHelper.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.shared_string_help, mapActivity)
|
||||
.setColorIcon(R.drawable.ic_action_help)
|
||||
.setListener(new OnContextMenuClick() {
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
Intent intent = new Intent(mapActivity, HelpActivity.class);
|
||||
|
@ -896,7 +896,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
menuItemsListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
ContextMenuAdapter.OnContextMenuClick click =
|
||||
ContextMenuAdapter.ItemClickListener click =
|
||||
contextMenuAdapter.getClickAdapter(position);
|
||||
if (click.onContextMenuClick(simpleListAdapter,
|
||||
contextMenuAdapter.getElementId(position), position, false)) {
|
||||
|
|
|
@ -47,7 +47,7 @@ import net.osmand.data.LatLon;
|
|||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||
import net.osmand.plus.ContextMenuAdapter.ItemClickListener;
|
||||
import net.osmand.plus.ContextMenuItem;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
|
@ -581,7 +581,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
|||
|
||||
@Override
|
||||
public void registerLayerContextMenuActions(final OsmandMapTileView mapView, ContextMenuAdapter adapter, final MapActivity mapActivity) {
|
||||
OnContextMenuClick listener = new OnContextMenuClick() {
|
||||
ItemClickListener listener = new ContextMenuAdapter.ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
if (itemId == R.string.layer_recordings) {
|
||||
|
@ -606,7 +606,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
|||
}
|
||||
adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.recording_context_menu_arecord, app)
|
||||
.setColorIcon(R.drawable.ic_action_micro_dark)
|
||||
.setListener(new OnContextMenuClick() {
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
|
@ -618,7 +618,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
|||
.createItem());
|
||||
adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.recording_context_menu_vrecord, app)
|
||||
.setColorIcon(R.drawable.ic_action_video_dark)
|
||||
.setListener(new OnContextMenuClick() {
|
||||
.setListener(new ItemClickListener() {
|
||||
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
|
@ -630,7 +630,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
|||
.createItem());
|
||||
adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.recording_context_menu_precord, app)
|
||||
.setColorIcon(R.drawable.ic_action_photo_dark)
|
||||
.setListener(new OnContextMenuClick() {
|
||||
.setListener(new ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
takePhoto(latitude, longitude, mapActivity, false);
|
||||
|
|
|
@ -29,6 +29,7 @@ import android.widget.CompoundButton;
|
|||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ImageView.ScaleType;
|
||||
import android.widget.ListView;
|
||||
import android.widget.ScrollView;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
@ -43,7 +44,6 @@ import net.osmand.data.LatLon;
|
|||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||
import net.osmand.plus.ContextMenuAdapter.OnRowItemClick;
|
||||
import net.osmand.plus.ContextMenuItem;
|
||||
import net.osmand.plus.IconsCache;
|
||||
|
@ -965,7 +965,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
|||
View v = listView.getChildAt(0);
|
||||
int top = (v == null) ? 0 : (v.getTop() - listView.getPaddingTop());
|
||||
updateListAdapter();
|
||||
listView.setSelectionFromTop(index, top);
|
||||
((ListView) listView).setSelectionFromTop(index, top);
|
||||
} else {
|
||||
listAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
@ -994,7 +994,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
|||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int which, long id) {
|
||||
ContextMenuItem item = cm.getItem(which);
|
||||
OnContextMenuClick click = item.getCheckBoxListener();
|
||||
ContextMenuAdapter.ItemClickListener click = item.getItemClickListener();
|
||||
if (click instanceof OnRowItemClick) {
|
||||
boolean cl = ((OnRowItemClick) click).onRowItemClick(listAdapter, view, item.getTitleId(), which);
|
||||
if (cl) {
|
||||
|
|
|
@ -5,7 +5,6 @@ import android.content.Intent;
|
|||
import android.widget.ArrayAdapter;
|
||||
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||
import net.osmand.plus.ContextMenuItem;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
|
@ -60,7 +59,7 @@ public class OsmandDevelopmentPlugin extends OsmandPlugin {
|
|||
helper.addItem(new ContextMenuItem.ItemBuilder()
|
||||
.setTitleId(R.string.version_settings, mapActivity)
|
||||
.setColorIcon(R.drawable.ic_action_gabout_dark)
|
||||
.setListener(new OnContextMenuClick() {
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
final Intent mapIntent = new Intent(mapActivity, ContributionVersionActivity.class);
|
||||
|
|
|
@ -13,7 +13,7 @@ import net.osmand.PlatformUtil;
|
|||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.core.android.MapRendererContext;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||
import net.osmand.plus.ContextMenuAdapter.ItemClickListener;
|
||||
import net.osmand.plus.ContextMenuAdapter.OnRowItemClick;
|
||||
import net.osmand.plus.ContextMenuItem;
|
||||
import net.osmand.plus.GpxSelectionHelper;
|
||||
|
@ -234,7 +234,7 @@ public class ConfigureMapMenu {
|
|||
String descr = getRenderDescr(activity);
|
||||
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||
.setTitleId(R.string.map_widget_renderer, activity)
|
||||
.setListener(new OnContextMenuClick() {
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(final ArrayAdapter<?> ad, int itemId, final int pos, boolean isChecked) {
|
||||
AlertDialog.Builder bld = new AlertDialog.Builder(activity);
|
||||
|
@ -279,7 +279,7 @@ public class ConfigureMapMenu {
|
|||
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||
.setTitleId(R.string.map_widget_day_night, activity)
|
||||
.setDescription(getDayNightDescr(activity))
|
||||
.setListener(new OnContextMenuClick() {
|
||||
.setListener(new ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(final ArrayAdapter<?> ad, int itemId, final int pos, boolean isChecked) {
|
||||
final OsmandMapTileView view = activity.getMapView();
|
||||
|
@ -307,7 +307,7 @@ public class ConfigureMapMenu {
|
|||
}).setLayout(R.layout.drawer_list_doubleitem).createItem());
|
||||
|
||||
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||
.setTitleId(R.string.map_magnifier, activity).setListener(new OnContextMenuClick() {
|
||||
.setTitleId(R.string.map_magnifier, activity).setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(final ArrayAdapter<?> ad, int itemId, final int pos, boolean isChecked) {
|
||||
final OsmandMapTileView view = activity.getMapView();
|
||||
|
@ -360,7 +360,7 @@ public class ConfigureMapMenu {
|
|||
.createItem());
|
||||
|
||||
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||
.setTitleId(R.string.text_size, activity).setListener(new OnContextMenuClick() {
|
||||
.setTitleId(R.string.text_size, activity).setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(final ArrayAdapter<?> ad, int itemId, final int pos, boolean isChecked) {
|
||||
final OsmandMapTileView view = activity.getMapView();
|
||||
|
@ -392,7 +392,7 @@ public class ConfigureMapMenu {
|
|||
}).setDescription(getScale(activity)).setLayout(R.layout.drawer_list_doubleitem).createItem());
|
||||
|
||||
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||
.setTitleId(R.string.map_locale, activity).setListener(new OnContextMenuClick() {
|
||||
.setTitleId(R.string.map_locale, activity).setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(final ArrayAdapter<?> ad, int itemId, final int pos, boolean isChecked) {
|
||||
final OsmandMapTileView view = activity.getMapView();
|
||||
|
@ -511,7 +511,7 @@ public class ConfigureMapMenu {
|
|||
.setTitleId(strId, activity)
|
||||
.setDescription(descr)
|
||||
.setLayout(R.layout.drawer_list_doubleitem)
|
||||
.setListener(new OnContextMenuClick() {
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> a, int itemId, int pos, boolean isChecked) {
|
||||
|
@ -619,7 +619,7 @@ public class ConfigureMapMenu {
|
|||
final OsmandSettings.CommonPreference<Boolean> pref = view.getApplication().getSettings()
|
||||
.getCustomRenderBooleanProperty(p.getAttrName());
|
||||
adapter.addItem(ContextMenuItem.createBuilder(propertyName)
|
||||
.setListener(new OnContextMenuClick() {
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
|
@ -640,7 +640,7 @@ public class ConfigureMapMenu {
|
|||
descr = SettingsActivity.getStringPropertyValue(view.getContext(),
|
||||
p.getDefaultValueDescription());
|
||||
}
|
||||
adapter.addItem(ContextMenuItem.createBuilder(propertyName).setListener(new OnContextMenuClick() {
|
||||
adapter.addItem(ContextMenuItem.createBuilder(propertyName).setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
|
||||
@Override
|
||||
public boolean onContextMenuClick(final ArrayAdapter<?> ad, int itemId, final int pos, boolean isChecked) {
|
||||
|
|
|
@ -33,7 +33,6 @@ import net.osmand.data.PointDescription;
|
|||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||
import net.osmand.plus.ContextMenuItem;
|
||||
import net.osmand.plus.GPXUtilities;
|
||||
import net.osmand.plus.GPXUtilities.GPXFile;
|
||||
|
@ -655,7 +654,7 @@ public class DistanceCalculatorPlugin extends OsmandPlugin {
|
|||
}
|
||||
}
|
||||
if (containsPoint) {
|
||||
OnContextMenuClick listener = new OnContextMenuClick() {
|
||||
ContextMenuAdapter.ItemClickListener listener = new ContextMenuAdapter.ItemClickListener() {
|
||||
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
|
|
|
@ -39,7 +39,7 @@ import android.widget.Toast;
|
|||
import net.osmand.IndexConstants;
|
||||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||
import net.osmand.plus.ContextMenuAdapter.ItemClickListener;
|
||||
import net.osmand.plus.ContextMenuItem;
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
|
@ -180,7 +180,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
|
|||
builder.setItems(values, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
OnContextMenuClick clk = adapter.getClickAdapter(which);
|
||||
ContextMenuAdapter.ItemClickListener clk = adapter.getClickAdapter(which);
|
||||
if (clk != null) {
|
||||
clk.onContextMenuClick(null, adapter.getElementId(which), which, false);
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
|
|||
|
||||
|
||||
private void basicFileOperation(final LocalIndexInfo info, ContextMenuAdapter adapter) {
|
||||
OnContextMenuClick listener = new OnContextMenuClick() {
|
||||
ItemClickListener listener = new ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int resId, int pos, boolean isChecked) {
|
||||
return performBasicOperation(resId, info);
|
||||
|
@ -594,7 +594,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
|
|||
//hide action bar from downloadindexfragment
|
||||
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
|
||||
optionsMenuAdapter = new ContextMenuAdapter();
|
||||
OnContextMenuClick listener = new OnContextMenuClick() {
|
||||
ItemClickListener listener = new ContextMenuAdapter.ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
localOptionsMenu(itemId);
|
||||
|
@ -602,21 +602,21 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
|
|||
}
|
||||
};
|
||||
optionsMenuAdapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||
.setTitleId(R.string.local_index_mi_reload,getContext())
|
||||
.setTitleId(R.string.local_index_mi_reload, getContext())
|
||||
.setIcon(R.drawable.ic_action_refresh_dark)
|
||||
.setListener(listener)
|
||||
.createItem());
|
||||
optionsMenuAdapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||
.setTitleId(R.string.shared_string_delete,getContext())
|
||||
.setTitleId(R.string.shared_string_delete, getContext())
|
||||
.setIcon(R.drawable.ic_action_delete_dark)
|
||||
.setListener(listener)
|
||||
.createItem());
|
||||
optionsMenuAdapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||
.setTitleId(R.string.local_index_mi_backup,getContext())
|
||||
.setTitleId(R.string.local_index_mi_backup, getContext())
|
||||
.setListener(listener)
|
||||
.createItem());
|
||||
optionsMenuAdapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||
.setTitleId(R.string.local_index_mi_restore,getContext())
|
||||
.setTitleId(R.string.local_index_mi_restore, getContext())
|
||||
.setListener(listener)
|
||||
.createItem());
|
||||
// doesn't work correctly
|
||||
|
|
|
@ -22,7 +22,6 @@ import net.osmand.Location;
|
|||
import net.osmand.ValueHolder;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||
import net.osmand.plus.ContextMenuItem;
|
||||
import net.osmand.plus.GPXUtilities.WptPt;
|
||||
import net.osmand.plus.NavigationService;
|
||||
|
@ -130,7 +129,7 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
|
|||
@Override
|
||||
public void registerMapContextMenuActions(final MapActivity mapActivity, final double latitude, final double longitude,
|
||||
ContextMenuAdapter adapter, Object selectedObj) {
|
||||
OnContextMenuClick listener = new OnContextMenuClick() {
|
||||
ContextMenuAdapter.ItemClickListener listener = new ContextMenuAdapter.ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int resId, int pos, boolean isChecked) {
|
||||
if (resId == R.string.context_menu_item_add_waypoint) {
|
||||
|
|
|
@ -35,7 +35,7 @@ import android.widget.Toast;
|
|||
import net.osmand.IndexConstants;
|
||||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||
import net.osmand.plus.ContextMenuAdapter.ItemClickListener;
|
||||
import net.osmand.plus.ContextMenuItem;
|
||||
import net.osmand.plus.GPXUtilities;
|
||||
import net.osmand.plus.GPXUtilities.GPXFile;
|
||||
|
@ -328,7 +328,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
}
|
||||
|
||||
optionsMenuAdapter = new ContextMenuAdapter();
|
||||
OnContextMenuClick listener = new OnContextMenuClick() {
|
||||
ItemClickListener listener = new ContextMenuAdapter.ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, final int itemId, int pos, boolean isChecked) {
|
||||
if (itemId == R.string.local_index_mi_reload) {
|
||||
|
|
|
@ -20,7 +20,7 @@ import net.osmand.data.Amenity;
|
|||
import net.osmand.osm.PoiType;
|
||||
import net.osmand.osm.edit.Node;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||
import net.osmand.plus.ContextMenuAdapter.ItemClickListener;
|
||||
import net.osmand.plus.ContextMenuItem;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
|
@ -182,7 +182,7 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
|||
final double longitude,
|
||||
ContextMenuAdapter adapter,
|
||||
final Object selectedObj) {
|
||||
OnContextMenuClick listener = new OnContextMenuClick() {
|
||||
ContextMenuAdapter.ItemClickListener listener = new ContextMenuAdapter.ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int resId, int pos, boolean isChecked) {
|
||||
if (resId == R.string.context_menu_item_create_poi) {
|
||||
|
@ -260,17 +260,17 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
|||
adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.layer_osm_bugs, mapActivity)
|
||||
.setSelected(settings.SHOW_OSM_BUGS.get())
|
||||
.setColorIcon(R.drawable.ic_action_bug_dark)
|
||||
.setListener(new OnContextMenuClick() {
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
if (itemId == R.string.layer_osm_bugs) {
|
||||
settings.SHOW_OSM_BUGS.set(isChecked);
|
||||
updateLayers(mapActivity.getMapView(), mapActivity);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
})
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
if (itemId == R.string.layer_osm_bugs) {
|
||||
settings.SHOW_OSM_BUGS.set(isChecked);
|
||||
updateLayers(mapActivity.getMapView(), mapActivity);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
})
|
||||
.setPosition(16)
|
||||
.createItem());
|
||||
|
||||
|
@ -286,7 +286,7 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
|||
if (fragment instanceof AvailableGPXFragment) {
|
||||
adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.local_index_mi_upload_gpx, la)
|
||||
.setColorIcon(R.drawable.ic_action_export)
|
||||
.setListener(new OnContextMenuClick() {
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
|
@ -303,7 +303,7 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
|||
final AvailableGPXFragment f = ((AvailableGPXFragment) fragment);
|
||||
optionsMenuAdapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.local_index_mi_upload_gpx, activity)
|
||||
.setIcon(R.drawable.ic_action_export)
|
||||
.setListener(new OnContextMenuClick() {
|
||||
.setListener(new ItemClickListener() {
|
||||
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
|
|
|
@ -12,7 +12,6 @@ import net.osmand.Location;
|
|||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||
import net.osmand.plus.ContextMenuItem;
|
||||
import net.osmand.plus.GPXUtilities;
|
||||
import net.osmand.plus.GPXUtilities.GPXFile;
|
||||
|
@ -277,7 +276,7 @@ public class OsMoPlugin extends OsmandPlugin implements OsMoReactor {
|
|||
public void registerOptionsMenuItems(final MapActivity mapActivity, ContextMenuAdapter helper) {
|
||||
helper.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.osmo_groups, mapActivity)
|
||||
.setColorIcon(R.drawable.ic_osmo_dark)
|
||||
.setListener(new OnContextMenuClick() {
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
Intent intent = new Intent(mapActivity, OsMoGroupsActivity.class);
|
||||
|
|
|
@ -18,7 +18,7 @@ import android.widget.TimePicker;
|
|||
import net.osmand.data.LatLon;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||
import net.osmand.plus.ContextMenuAdapter.ItemClickListener;
|
||||
import net.osmand.plus.ContextMenuItem;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
|
@ -217,7 +217,7 @@ public class ParkingPositionPlugin extends OsmandPlugin {
|
|||
final double latitude, final double longitude,
|
||||
ContextMenuAdapter adapter, Object selectedObj) {
|
||||
|
||||
OnContextMenuClick addListener = new OnContextMenuClick() {
|
||||
ItemClickListener addListener = new ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int resId,
|
||||
int pos, boolean isChecked) {
|
||||
|
|
|
@ -23,7 +23,7 @@ import net.osmand.map.ITileSource;
|
|||
import net.osmand.map.TileSourceManager;
|
||||
import net.osmand.map.TileSourceManager.TileSourceTemplate;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||
import net.osmand.plus.ContextMenuAdapter.ItemClickListener;
|
||||
import net.osmand.plus.ContextMenuItem;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
|
@ -236,7 +236,7 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
|
|||
ContextMenuAdapter adapter,
|
||||
final MapActivity mapActivity) {
|
||||
final MapActivityLayers layers = mapActivity.getMapLayers();
|
||||
OnContextMenuClick listener = new OnContextMenuClick() {
|
||||
ContextMenuAdapter.ItemClickListener listener = new ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
OsmandSettings settings = mapActivity.getMyApplication().getSettings();
|
||||
|
@ -279,7 +279,7 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
|
|||
Object selectedObj) {
|
||||
final OsmandMapTileView mapView = mapActivity.getMapView();
|
||||
if (mapView.getMainLayer() instanceof MapTileLayer) {
|
||||
OnContextMenuClick listener = new OnContextMenuClick() {
|
||||
ItemClickListener listener = new ContextMenuAdapter.ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int resId, int pos, boolean isChecked) {
|
||||
if (resId == R.string.context_menu_item_update_map) {
|
||||
|
|
|
@ -87,7 +87,7 @@ public class RoutePointsLayer extends OsmandMapLayer implements ContextMenuLaye
|
|||
public void populateObjectContextMenu(LatLon latLon, Object o, ContextMenuAdapter adapter, MapActivity mapActivity) {
|
||||
if (o != null && o instanceof GPXUtilities.WptPt && plugin.getCurrentRoute() != null){
|
||||
final GPXUtilities.WptPt point = (GPXUtilities.WptPt) o;
|
||||
ContextMenuAdapter.OnContextMenuClick listener = new ContextMenuAdapter.OnContextMenuClick() {
|
||||
ContextMenuAdapter.ItemClickListener listener = new ContextMenuAdapter.ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
if (itemId == R.string.mark_as_not_visited){
|
||||
|
|
|
@ -5,7 +5,7 @@ import android.widget.ArrayAdapter;
|
|||
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||
import net.osmand.plus.ContextMenuAdapter.ItemClickListener;
|
||||
import net.osmand.plus.ContextMenuItem;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
|
@ -105,7 +105,7 @@ public class SRTMPlugin extends OsmandPlugin {
|
|||
|
||||
@Override
|
||||
public void registerLayerContextMenuActions(final OsmandMapTileView mapView, ContextMenuAdapter adapter, final MapActivity mapActivity) {
|
||||
OnContextMenuClick listener = new OnContextMenuClick() {
|
||||
ItemClickListener listener = new ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
if (itemId == R.string.layer_hillshade) {
|
||||
|
|
|
@ -134,7 +134,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
|||
@Override
|
||||
public void populateObjectContextMenu(LatLon latLon, Object o, ContextMenuAdapter adapter, MapActivity mapActivity) {
|
||||
if (menu.hasHiddenBottomInfo()) {
|
||||
ContextMenuAdapter.OnContextMenuClick listener = new ContextMenuAdapter.OnContextMenuClick() {
|
||||
ContextMenuAdapter.ItemClickListener listener = new ContextMenuAdapter.ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
if (itemId == R.string.shared_string_show_description) {
|
||||
|
|
|
@ -165,7 +165,7 @@ public class ImpassableRoadsLayer extends OsmandMapLayer implements ContextMenuL
|
|||
if (latLon != null && o == null
|
||||
&& (routingHelper.isRoutePlanningMode() || routingHelper.isFollowingMode())) {
|
||||
|
||||
ContextMenuAdapter.OnContextMenuClick listener = new ContextMenuAdapter.OnContextMenuClick() {
|
||||
ContextMenuAdapter.ItemClickListener listener = new ContextMenuAdapter.ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
if (itemId == R.string.avoid_road) {
|
||||
|
|
|
@ -10,7 +10,6 @@ import android.widget.LinearLayout;
|
|||
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||
import net.osmand.plus.ContextMenuItem;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.OsmandSettings.MapMarkersMode;
|
||||
|
@ -288,7 +287,7 @@ public class MapWidgetRegistry {
|
|||
if (settings.USE_MAP_MARKERS.get()) {
|
||||
cm.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.map_markers, map)
|
||||
.setDescription(settings.MAP_MARKERS_MODE.get().toHumanString(map))
|
||||
.setListener(new OnContextMenuClick() {
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(final ArrayAdapter<?> ad, int itemId, final int pos, boolean isChecked) {
|
||||
final OsmandMapTileView view = map.getMapView();
|
||||
|
@ -329,15 +328,15 @@ public class MapWidgetRegistry {
|
|||
@StringRes int stringId, OsmandPreference<Boolean> pref) {
|
||||
cm.addItem(new ContextMenuItem.ItemBuilder().setTitleId(stringId, map)
|
||||
.setSelected(pref.get())
|
||||
.setListener(new ApearanceOnContextMenuClick(pref, map)).createItem());
|
||||
.setListener(new ApearanceItemClickListener(pref, map)).createItem());
|
||||
}
|
||||
|
||||
class ApearanceOnContextMenuClick implements OnContextMenuClick {
|
||||
class ApearanceItemClickListener implements ContextMenuAdapter.ItemClickListener {
|
||||
|
||||
private MapActivity map;
|
||||
private OsmandPreference<Boolean> pref;
|
||||
|
||||
public ApearanceOnContextMenuClick(OsmandPreference<Boolean> pref, MapActivity map) {
|
||||
public ApearanceItemClickListener(OsmandPreference<Boolean> pref, MapActivity map) {
|
||||
this.pref = pref;
|
||||
this.map = map;
|
||||
}
|
||||
|
@ -404,7 +403,7 @@ public class MapWidgetRegistry {
|
|||
.setSelected(r.visibleCollapsed(mode) || r.visible(mode))
|
||||
.setColorIcon(r.drawableMenu)
|
||||
.setSecondaryIcon(R.drawable.ic_action_additional_option)
|
||||
.setListener(new OnContextMenuClick() {
|
||||
.setListener(new ContextMenuAdapter.OnRowItemClick() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> a, int itemId, int pos, boolean isChecked) {
|
||||
changeVisibility(r);
|
||||
|
|
Loading…
Reference in a new issue