Search in sources :

Example 11 with ContextMenuAdapter

use of net.osmand.plus.ContextMenuAdapter in project Osmand by osmandapp.

the class MapActivityActions method createMainOptionsMenu.

public ContextMenuAdapter createMainOptionsMenu() {
    final OsmandMapTileView mapView = mapActivity.getMapView();
    final OsmandApplication app = mapActivity.getMyApplication();
    ContextMenuAdapter optionsMenuHelper = new ContextMenuAdapter();
    optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.home, mapActivity).setIcon(R.drawable.map_dashboard).setListener(new ContextMenuAdapter.ItemClickListener() {

        @Override
        public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
            app.logEvent(mapActivity, "drawer_dashboard_open");
            MapActivity.clearPrevActivityIntent();
            mapActivity.closeDrawer();
            mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.DASHBOARD, viewCoordinates);
            return true;
        }
    }).createItem());
    optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.map_markers, mapActivity).setIcon(R.drawable.ic_action_flag_dark).setListener(new ContextMenuAdapter.ItemClickListener() {

        @Override
        public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
            app.logEvent(mapActivity, "drawer_markers_open");
            MapActivity.clearPrevActivityIntent();
            MapMarkersDialogFragment.showInstance(mapActivity);
            return true;
        }
    }).createItem());
    optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.shared_string_my_places, mapActivity).setIcon(R.drawable.ic_action_fav_dark).setListener(new ContextMenuAdapter.ItemClickListener() {

        @Override
        public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
            app.logEvent(mapActivity, "drawer_myplaces_open");
            Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization().getFavoritesActivity());
            newIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
            mapActivity.startActivity(newIntent);
            return true;
        }
    }).createItem());
    optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.search_button, mapActivity).setIcon(R.drawable.ic_action_search_dark).setListener(new ContextMenuAdapter.ItemClickListener() {

        @Override
        public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
            app.logEvent(mapActivity, "drawer_search_open");
            mapActivity.showQuickSearch(MapActivity.ShowQuickSearchMode.NEW_IF_EXPIRED, false);
            return true;
        }
    }).createItem());
    if (settings.SHOW_LEGACY_SEARCH.get()) {
        optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.legacy_search, mapActivity).setIcon(R.drawable.ic_action_search_dark).setListener(new ContextMenuAdapter.ItemClickListener() {

            @Override
            public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
                app.logEvent(mapActivity, "drawer_legacy_search_open");
                Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization().getSearchActivity());
                LatLon loc = mapActivity.getMapLocation();
                newIntent.putExtra(SearchActivity.SEARCH_LAT, loc.getLatitude());
                newIntent.putExtra(SearchActivity.SEARCH_LON, loc.getLongitude());
                if (mapActivity.getMapViewTrackingUtilities().isMapLinkedToLocation()) {
                    newIntent.putExtra(SearchActivity.SEARCH_NEARBY, true);
                }
                newIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
                mapActivity.startActivity(newIntent);
                return true;
            }
        }).createItem());
    }
    optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.get_directions, mapActivity).setIcon(R.drawable.ic_action_gdirections_dark).setListener(new ContextMenuAdapter.ItemClickListener() {

        @Override
        public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
            app.logEvent(mapActivity, "drawer_directions_open");
            MapControlsLayer mapControlsLayer = mapActivity.getMapLayers().getMapControlsLayer();
            if (mapControlsLayer != null) {
                mapControlsLayer.doRoute(false);
            }
            return true;
        }
    }).createItem());
    /*
		optionsMenuHelper.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.show_point_options, mapActivity)
				.setIcon(R.drawable.ic_action_marker_dark)
				.setListener(new ContextMenuAdapter.ItemClickListener() {
					@Override
					public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked) {
						MapActivity.clearPrevActivityIntent();
						mapActivity.getMapLayers().getContextMenuLayer().showContextMenu(mapView.getLatitude(), mapView.getLongitude(), true);
						return true;
					}
				}).createItem());
		*/
    optionsMenuHelper.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.configure_map, mapActivity).setIcon(R.drawable.ic_action_layers_dark).setListener(new ContextMenuAdapter.ItemClickListener() {

        @Override
        public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
            app.logEvent(mapActivity, "drawer_config_map_open");
            MapActivity.clearPrevActivityIntent();
            mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.CONFIGURE_MAP, viewCoordinates);
            return false;
        }
    }).createItem());
    String d = getString(R.string.welmode_download_maps);
    if (app.getDownloadThread().getIndexes().isDownloadedFromInternet) {
        List<IndexItem> updt = app.getDownloadThread().getIndexes().getItemsToUpdate();
        if (updt != null && updt.size() > 0) {
            d += " (" + updt.size() + ")";
        }
    }
    optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.welmode_download_maps, null).setTitle(d).setIcon(R.drawable.ic_type_archive).setListener(new ContextMenuAdapter.ItemClickListener() {

        @Override
        public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
            app.logEvent(mapActivity, "drawer_download_maps_open");
            Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization().getDownloadActivity());
            newIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
            mapActivity.startActivity(newIntent);
            return true;
        }
    }).createItem());
    if (Version.isGooglePlayEnabled(app) || Version.isDeveloperVersion(app)) {
        optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.osm_live, mapActivity).setIcon(R.drawable.ic_action_osm_live).setListener(new ContextMenuAdapter.ItemClickListener() {

            @Override
            public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
                app.logEvent(mapActivity, "drawer_osm_live_open");
                Intent intent = new Intent(mapActivity, OsmLiveActivity.class);
                intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
                mapActivity.startActivity(intent);
                return false;
            }
        }).createItem());
    }
    if (WikivoyageDbHelper.isDbFileExists(app)) {
        optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.shared_string_travel, mapActivity).setIcon(R.drawable.ic_action_travel).setListener(new ItemClickListener() {

            @Override
            public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
                MapActivity.clearPrevActivityIntent();
                WikivoyageExploreDialogFragment.showInstance(mapActivity.getSupportFragmentManager());
                return true;
            }
        }).createItem());
    }
    optionsMenuHelper.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.measurement_tool, mapActivity).setIcon(R.drawable.ic_action_ruler).setListener(new ContextMenuAdapter.ItemClickListener() {

        @Override
        public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int position, boolean isChecked, int[] viewCoordinates) {
            MeasurementToolFragment.showInstance(mapActivity.getSupportFragmentManager());
            return true;
        }
    }).createItem());
    optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.layer_map_appearance, mapActivity).setIcon(R.drawable.ic_configure_screen_dark).setListener(new ContextMenuAdapter.ItemClickListener() {

        @Override
        public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
            app.logEvent(mapActivity, "drawer_config_screen_open");
            MapActivity.clearPrevActivityIntent();
            mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.CONFIGURE_SCREEN, viewCoordinates);
            return false;
        }
    }).createItem());
    optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.prefs_plugins, mapActivity).setIcon(R.drawable.ic_extension_dark).setListener(new ItemClickListener() {

        @Override
        public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
            app.logEvent(mapActivity, "drawer_plugins_open");
            Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization().getPluginsActivity());
            newIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
            mapActivity.startActivity(newIntent);
            return true;
        }
    }).createItem());
    optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.shared_string_settings, mapActivity).setIcon(R.drawable.ic_action_settings).setListener(new ContextMenuAdapter.ItemClickListener() {

        @Override
        public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
            app.logEvent(mapActivity, "drawer_settings_open");
            final Intent settings = new Intent(mapActivity, getMyApplication().getAppCustomization().getSettingsActivity());
            settings.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
            mapActivity.startActivity(settings);
            return true;
        }
    }).createItem());
    /*
		optionsMenuHelper.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.configure_map, mapActivity)
				.setIcon(R.drawable.ic_action_layers_dark)
				.setListener(new ContextMenuAdapter.ItemClickListener() {
					@Override
					public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked) {
						MapActivity.clearPrevActivityIntent();
						mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.CONFIGURE_MAP);
						return false;
					}
				}).createItem());
		*/
    optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.shared_string_help, mapActivity).setIcon(R.drawable.ic_action_help).setListener(new ContextMenuAdapter.ItemClickListener() {

        @Override
        public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
            app.logEvent(mapActivity, "drawer_help_open");
            Intent intent = new Intent(mapActivity, HelpActivity.class);
            intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
            mapActivity.startActivity(intent);
            return true;
        }
    }).createItem());
    // ////////// Others
    OsmandPlugin.registerOptionsMenu(mapActivity, optionsMenuHelper);
    // Place divider between functionality and configuration related menu items
    int dividerItemIndex = -1;
    for (int i = 0; i < optionsMenuHelper.length(); i++) {
        if (optionsMenuHelper.getItem(i).getTitleId() == R.string.layer_map_appearance) {
            dividerItemIndex = i;
            break;
        }
    }
    ItemBuilder divider = new ItemBuilder().setLayout(R.layout.drawer_divider);
    divider.setPosition(dividerItemIndex >= 0 ? dividerItemIndex : 8);
    optionsMenuHelper.addItem(divider.createItem());
    getMyApplication().getAppCustomization().prepareOptionsMenu(mapActivity, optionsMenuHelper);
    return optionsMenuHelper;
}
Also used : MapControlsLayer(net.osmand.plus.views.MapControlsLayer) ItemClickListener(net.osmand.plus.ContextMenuAdapter.ItemClickListener) OsmandApplication(net.osmand.plus.OsmandApplication) ContextMenuItem(net.osmand.plus.ContextMenuItem) Intent(android.content.Intent) ItemClickListener(net.osmand.plus.ContextMenuAdapter.ItemClickListener) IndexItem(net.osmand.plus.download.IndexItem) OsmLiveActivity(net.osmand.plus.liveupdates.OsmLiveActivity) LatLon(net.osmand.data.LatLon) ContextMenuAdapter(net.osmand.plus.ContextMenuAdapter) ItemBuilder(net.osmand.plus.ContextMenuItem.ItemBuilder) OsmandMapTileView(net.osmand.plus.views.OsmandMapTileView) ItemBuilder(net.osmand.plus.ContextMenuItem.ItemBuilder)

Example 12 with ContextMenuAdapter

use of net.osmand.plus.ContextMenuAdapter in project Osmand by osmandapp.

the class HelpActivity method onCreate.

// public static final String OSMAND_MAP_LEGEND = "https://osmand.net/help/map-legend_default.png";
@Override
protected void onCreate(Bundle savedInstanceState) {
    ((OsmandApplication) getApplication()).applyTheme(this);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.fragment_help_screen);
    ContextMenuAdapter contextMenuAdapter = new ContextMenuAdapter();
    contextMenuAdapter.setDefaultLayoutId(R.layout.two_line_with_images_list_item);
    createBeginWithOsmandItems(contextMenuAdapter);
    createFeaturesItems(contextMenuAdapter);
    createPluginsItems(contextMenuAdapter);
    createHelpUsToImproveItems(contextMenuAdapter);
    createOtherItems(contextMenuAdapter);
    createSocialNetworksItems(contextMenuAdapter);
    boolean lightContent = getMyApplication().getSettings().isLightContent();
    mAdapter = contextMenuAdapter.createListAdapter(this, lightContent);
    ListView listView = (ListView) findViewById(android.R.id.list);
    listView.setAdapter(mAdapter);
    listView.setOnItemClickListener(this);
    int dividerColor = lightContent ? R.color.icon_color_light : R.color.dialog_inactive_text_color_dark;
    Drawable dividerDrawable = new ColorDrawable(ContextCompat.getColor(this, dividerColor));
    listView.setDivider(dividerDrawable);
    listView.setDividerHeight(AndroidUtils.dpToPx(this, 1f));
    setTitle(R.string.shared_string_help);
    setupHomeButton();
}
Also used : ContextMenuAdapter(net.osmand.plus.ContextMenuAdapter) ListView(android.widget.ListView) OsmandApplication(net.osmand.plus.OsmandApplication) ColorDrawable(android.graphics.drawable.ColorDrawable) ColorDrawable(android.graphics.drawable.ColorDrawable) Drawable(android.graphics.drawable.Drawable)

Example 13 with ContextMenuAdapter

use of net.osmand.plus.ContextMenuAdapter in project Osmand by osmandapp.

the class MapActivityLayers method showMultichoicePoiFilterDialog.

public void showMultichoicePoiFilterDialog(final OsmandMapTileView mapView, final DismissListener listener) {
    final OsmandApplication app = getApplication();
    final PoiFiltersHelper poiFilters = app.getPoiFilters();
    final ContextMenuAdapter adapter = new ContextMenuAdapter();
    final List<PoiUIFilter> list = new ArrayList<>();
    for (PoiUIFilter f : poiFilters.getTopDefinedPoiFilters()) {
        addFilterToList(adapter, list, f, true);
    }
    for (PoiUIFilter f : poiFilters.getSearchPoiFilters()) {
        addFilterToList(adapter, list, f, true);
    }
    list.add(poiFilters.getCustomPOIFilter());
    final ArrayAdapter<ContextMenuItem> listAdapter = adapter.createListAdapter(activity, app.getSettings().isLightContent());
    AlertDialog.Builder builder = new AlertDialog.Builder(activity);
    final ListView listView = new ListView(activity);
    listView.setDivider(null);
    listView.setClickable(true);
    listView.setAdapter(listAdapter);
    listView.setOnItemClickListener(new ListView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            ContextMenuItem item = listAdapter.getItem(position);
            item.setSelected(!item.getSelected());
            item.getItemClickListener().onContextMenuClick(listAdapter, position, position, item.getSelected(), null);
            listAdapter.notifyDataSetChanged();
        }
    });
    builder.setView(listView).setTitle(R.string.show_poi_over_map).setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            for (int i = 0; i < listAdapter.getCount(); i++) {
                ContextMenuItem item = listAdapter.getItem(i);
                PoiUIFilter filter = list.get(i);
                if (item.getSelected()) {
                    getApplication().getPoiFilters().addSelectedPoiFilter(filter);
                } else {
                    getApplication().getPoiFilters().removeSelectedPoiFilter(filter);
                }
            }
            mapView.refreshMap();
        }
    }).setNegativeButton(R.string.shared_string_cancel, null).setNeutralButton(" ", new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            showSingleChoicePoiFilterDialog(mapView, listener);
        }
    });
    final AlertDialog alertDialog = builder.create();
    alertDialog.setOnShowListener(new DialogInterface.OnShowListener() {

        @Override
        public void onShow(DialogInterface dialog) {
            Button neutralButton = alertDialog.getButton(DialogInterface.BUTTON_NEUTRAL);
            Drawable drawable = app.getIconsCache().getThemedIcon(R.drawable.ic_action_singleselect);
            neutralButton.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null);
            neutralButton.setContentDescription(app.getString(R.string.shared_string_filters));
        }
    });
    alertDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {

        @Override
        public void onDismiss(DialogInterface dialog) {
            listener.dismiss();
        }
    });
    alertDialog.show();
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) OsmandApplication(net.osmand.plus.OsmandApplication) ContextMenuItem(net.osmand.plus.ContextMenuItem) DialogInterface(android.content.DialogInterface) ArrayList(java.util.ArrayList) Drawable(android.graphics.drawable.Drawable) PoiFiltersHelper(net.osmand.plus.poi.PoiFiltersHelper) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) OsmandMapTileView(net.osmand.plus.views.OsmandMapTileView) PoiUIFilter(net.osmand.plus.poi.PoiUIFilter) ContextMenuAdapter(net.osmand.plus.ContextMenuAdapter) ListView(android.widget.ListView) Button(android.widget.Button)

Example 14 with ContextMenuAdapter

use of net.osmand.plus.ContextMenuAdapter in project Osmand by osmandapp.

the class MapActivityLayers method showSingleChoicePoiFilterDialog.

public void showSingleChoicePoiFilterDialog(final OsmandMapTileView mapView, final DismissListener listener) {
    final OsmandApplication app = getApplication();
    final PoiFiltersHelper poiFilters = app.getPoiFilters();
    final ContextMenuAdapter adapter = new ContextMenuAdapter();
    adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.shared_string_search, app).setIcon(R.drawable.ic_action_search_dark).createItem());
    final List<PoiUIFilter> list = new ArrayList<>();
    list.add(poiFilters.getCustomPOIFilter());
    for (PoiUIFilter f : poiFilters.getTopDefinedPoiFilters()) {
        addFilterToList(adapter, list, f, false);
    }
    for (PoiUIFilter f : poiFilters.getSearchPoiFilters()) {
        addFilterToList(adapter, list, f, false);
    }
    final ArrayAdapter<ContextMenuItem> listAdapter = adapter.createListAdapter(activity, app.getSettings().isLightContent());
    AlertDialog.Builder builder = new AlertDialog.Builder(activity);
    builder.setAdapter(listAdapter, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            PoiUIFilter pf = list.get(which);
            String filterId = pf.getFilterId();
            if (filterId.equals(PoiUIFilter.CUSTOM_FILTER_ID)) {
                if (activity.getDashboard().isVisible()) {
                    activity.getDashboard().hideDashboard();
                }
                activity.showQuickSearch(ShowQuickSearchMode.NEW, true);
            } else {
                getApplication().getPoiFilters().clearSelectedPoiFilters();
                getApplication().getPoiFilters().addSelectedPoiFilter(pf);
                mapView.refreshMap();
            }
        }
    });
    builder.setTitle(R.string.show_poi_over_map);
    builder.setNegativeButton(R.string.shared_string_dismiss, null);
    builder.setNeutralButton(" ", new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            showMultichoicePoiFilterDialog(mapView, listener);
        }
    });
    final AlertDialog alertDialog = builder.create();
    alertDialog.setOnShowListener(new DialogInterface.OnShowListener() {

        @Override
        public void onShow(DialogInterface dialog) {
            Button neutralButton = alertDialog.getButton(DialogInterface.BUTTON_NEUTRAL);
            Drawable drawable = app.getIconsCache().getThemedIcon(R.drawable.ic_action_multiselect);
            neutralButton.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null);
            neutralButton.setContentDescription(app.getString(R.string.apply_filters));
        }
    });
    alertDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {

        @Override
        public void onDismiss(DialogInterface dialog) {
            listener.dismiss();
        }
    });
    alertDialog.show();
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) OsmandApplication(net.osmand.plus.OsmandApplication) ContextMenuItem(net.osmand.plus.ContextMenuItem) DialogInterface(android.content.DialogInterface) ArrayList(java.util.ArrayList) Drawable(android.graphics.drawable.Drawable) PoiFiltersHelper(net.osmand.plus.poi.PoiFiltersHelper) PoiUIFilter(net.osmand.plus.poi.PoiUIFilter) ContextMenuAdapter(net.osmand.plus.ContextMenuAdapter) Button(android.widget.Button)

Example 15 with ContextMenuAdapter

use of net.osmand.plus.ContextMenuAdapter in project Osmand by osmandapp.

the class MapContextMenu method buttonMorePressed.

public void buttonMorePressed() {
    final ContextMenuAdapter menuAdapter = new ContextMenuAdapter();
    for (OsmandMapLayer layer : mapActivity.getMapView().getLayers()) {
        layer.populateObjectContextMenu(latLon, object, menuAdapter, mapActivity);
    }
    mapActivity.getMapActions().contextMenuPoint(latLon.getLatitude(), latLon.getLongitude(), menuAdapter, object);
}
Also used : ContextMenuAdapter(net.osmand.plus.ContextMenuAdapter) OsmandMapLayer(net.osmand.plus.views.OsmandMapLayer)

Aggregations

ContextMenuAdapter (net.osmand.plus.ContextMenuAdapter)41 ContextMenuItem (net.osmand.plus.ContextMenuItem)28 ArrayAdapter (android.widget.ArrayAdapter)17 View (android.view.View)15 DialogInterface (android.content.DialogInterface)13 OsmandApplication (net.osmand.plus.OsmandApplication)12 AlertDialog (android.support.v7.app.AlertDialog)11 ItemClickListener (net.osmand.plus.ContextMenuAdapter.ItemClickListener)10 OsmandMapTileView (net.osmand.plus.views.OsmandMapTileView)10 OsmandSettings (net.osmand.plus.OsmandSettings)9 ArrayList (java.util.ArrayList)8 AdapterView (android.widget.AdapterView)7 TextView (android.widget.TextView)7 ListView (android.widget.ListView)6 ImageView (android.widget.ImageView)5 Intent (android.content.Intent)4 Drawable (android.graphics.drawable.Drawable)4 ViewGroup (android.view.ViewGroup)4 CompoundButton (android.widget.CompoundButton)4 SelectedGpxFile (net.osmand.plus.GpxSelectionHelper.SelectedGpxFile)4