diff --git a/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java b/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java index a7bb87db2a..bb2143c7eb 100644 --- a/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java +++ b/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java @@ -567,8 +567,8 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, IRouteInfo boolean appModeChanged = currentAppMode != previousAppMode; boolean refresh = this.visibleType == type && !appModeChanged; - this.previousAppMode = currentAppMode; - this.visibleType = type; + previousAppMode = currentAppMode; + visibleType = type; DashboardOnMap.staticVisible = visible; DashboardOnMap.staticVisibleType = type; mapActivity.enableDrawer(); @@ -705,7 +705,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, IRouteInfo if (visibleType == DashboardType.CONFIGURE_SCREEN) { cm = mapActivity.getMapLayers().getMapWidgetRegistry().getViewConfigureMenuAdapter(mapActivity); } else if (visibleType == DashboardType.CONFIGURE_MAP) { - cm = new ConfigureMapMenu(mapActivity).createListAdapter(); + cm = new ConfigureMapMenu().createListAdapter(mapActivity); } else if (visibleType == DashboardType.LIST_MENU) { cm = mapActivity.getMapActions().createMainOptionsMenu(); } else if (visibleType == DashboardType.ROUTE_PREFERENCES) { diff --git a/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java b/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java index ea1934c5e6..83c4e1942d 100644 --- a/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java +++ b/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java @@ -110,17 +110,11 @@ public class ConfigureMapMenu { private int selectedLanguageIndex; private boolean transliterateNames; - private MapActivity ma; - public interface OnClickListener { void onClick(); } - public ConfigureMapMenu(MapActivity mapActivity) { - this.ma = mapActivity; - } - - public ContextMenuAdapter createListAdapter() { + public ContextMenuAdapter createListAdapter(final MapActivity ma) { OsmandApplication app = ma.getMyApplication(); boolean nightMode = app.getDaynightHelper().isNightModeForMapControls(); int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme; @@ -133,7 +127,7 @@ public class ConfigureMapMenu { adapter.setChangeAppModeListener(new OnClickListener() { @Override public void onClick() { - ma.getDashboard().updateListAdapter(createListAdapter()); + ma.getDashboard().updateListAdapter(createListAdapter(ma)); } }); List customRules = getCustomRules(app, @@ -1124,10 +1118,6 @@ public class ConfigureMapMenu { } } - private OsmandApplication getMyApplication() { - return ma.getMyApplication(); - } - private static class StringSpinnerArrayAdapter extends ArrayAdapter { private boolean nightMode; diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/ConfigureMenuItemsFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/ConfigureMenuItemsFragment.java index 926264aceb..44fb4bf7f6 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/ConfigureMenuItemsFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/ConfigureMenuItemsFragment.java @@ -197,8 +197,8 @@ public class ConfigureMenuItemsFragment extends BaseOsmAndFragment contextMenuAdapter = ((MapActivity) activity).getMapActions().createMainOptionsMenu(); break; case CONFIGURE_MAP: - ConfigureMapMenu configureMapMenu = new ConfigureMapMenu((MapActivity) activity); - contextMenuAdapter = configureMapMenu.createListAdapter(); + ConfigureMapMenu configureMapMenu = new ConfigureMapMenu(); + contextMenuAdapter = configureMapMenu.createListAdapter((MapActivity) activity); break; case CONTEXT_MENU_ACTIONS: MapContextMenu menu = ((MapActivity) activity).getContextMenu(); diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/ConfigureMenuRootFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/ConfigureMenuRootFragment.java index f7b2dda412..330f1c0a18 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/ConfigureMenuRootFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/ConfigureMenuRootFragment.java @@ -285,8 +285,8 @@ public class ConfigureMenuRootFragment extends BaseOsmAndFragment { contextMenuAdapter = mapActivityActions.createMainOptionsMenu(); break; case CONFIGURE_MAP: - ConfigureMapMenu configureMapMenu = new ConfigureMapMenu((MapActivity) activity); - contextMenuAdapter = configureMapMenu.createListAdapter(); + ConfigureMapMenu configureMapMenu = new ConfigureMapMenu(); + contextMenuAdapter = configureMapMenu.createListAdapter((MapActivity) activity); break; case CONTEXT_MENU_ACTIONS: MapContextMenu menu = ((MapActivity) activity).getContextMenu();