Search in sources :

Example 1 with ConfigureMapMenu

use of net.osmand.plus.dialogs.ConfigureMapMenu in project Osmand by osmandapp.

the class DashboardOnMap method updateListAdapter.

private void updateListAdapter() {
    listEmptyTextView.setVisibility(View.GONE);
    listView.setEmptyView(null);
    ContextMenuAdapter cm = null;
    if (DashboardType.WAYPOINTS == visibleType || DashboardType.WAYPOINTS_FLAT == visibleType) {
        StableArrayAdapter listAdapter = waypointDialogHelper.getWaypointsDrawerAdapter(true, deletedPoints, mapActivity, running, DashboardType.WAYPOINTS_FLAT == visibleType, nightMode);
        OnItemClickListener listener = waypointDialogHelper.getDrawerItemClickListener(mapActivity, running, listAdapter);
        setDynamicListItems(listView, listAdapter);
        updateListAdapter(listAdapter, listener);
        if (listAdapter.getObjects().size() == 0) {
            listEmptyTextView.setText(mapActivity.getString(R.string.no_waypoints_found));
            if (landscape) {
                listView.setEmptyView(listEmptyTextView);
            } else {
                listEmptyTextView.setVisibility(View.VISIBLE);
            }
        }
    } else {
        if (visibleType == DashboardType.CONFIGURE_SCREEN) {
            cm = mapActivity.getMapLayers().getMapWidgetRegistry().getViewConfigureMenuAdapter(mapActivity);
        } else if (visibleType == DashboardType.CONFIGURE_MAP) {
            cm = new ConfigureMapMenu().createListAdapter(mapActivity);
        } else if (visibleType == DashboardType.LIST_MENU) {
            cm = mapActivity.getMapActions().createMainOptionsMenu();
        } else if (visibleType == DashboardType.ROUTE_PREFERENCES) {
            RoutePreferencesMenu routePreferencesMenu = new RoutePreferencesMenu(mapActivity);
            ArrayAdapter<LocalRoutingParameter> listAdapter = routePreferencesMenu.getRoutePreferencesDrawerAdapter(nightMode);
            OnItemClickListener listener = routePreferencesMenu.getItemClickListener(listAdapter);
            updateListAdapter(listAdapter, listener);
        } else if (visibleType == DashboardType.UNDERLAY_MAP) {
            cm = RasterMapMenu.createListAdapter(mapActivity, OsmandRasterMapsPlugin.RasterMapType.UNDERLAY);
        } else if (visibleType == DashboardType.OVERLAY_MAP) {
            cm = RasterMapMenu.createListAdapter(mapActivity, OsmandRasterMapsPlugin.RasterMapType.OVERLAY);
        } else if (visibleType == DashboardType.CONTOUR_LINES) {
            cm = ContourLinesMenu.createListAdapter(mapActivity);
        } else if (visibleType == DashboardType.HILLSHADE) {
            cm = HillshadeMenu.createListAdapter(mapActivity);
        } else if (visibleType == DashboardType.OSM_NOTES) {
            cm = OsmNotesMenu.createListAdapter(mapActivity);
        }
        if (cm != null) {
            updateListAdapter(cm);
        }
    }
}
Also used : ContextMenuAdapter(net.osmand.plus.ContextMenuAdapter) StableArrayAdapter(net.osmand.plus.views.controls.StableArrayAdapter) ConfigureMapMenu(net.osmand.plus.dialogs.ConfigureMapMenu) OnItemClickListener(android.widget.AdapterView.OnItemClickListener) RoutePreferencesMenu(net.osmand.plus.mapcontextmenu.other.RoutePreferencesMenu) ArrayAdapter(android.widget.ArrayAdapter) StableArrayAdapter(net.osmand.plus.views.controls.StableArrayAdapter)

Aggregations

OnItemClickListener (android.widget.AdapterView.OnItemClickListener)1 ArrayAdapter (android.widget.ArrayAdapter)1 ContextMenuAdapter (net.osmand.plus.ContextMenuAdapter)1 ConfigureMapMenu (net.osmand.plus.dialogs.ConfigureMapMenu)1 RoutePreferencesMenu (net.osmand.plus.mapcontextmenu.other.RoutePreferencesMenu)1 StableArrayAdapter (net.osmand.plus.views.controls.StableArrayAdapter)1