delete unnecessary code

This commit is contained in:
Nazar-Kutz 2020-10-01 17:51:03 +03:00
parent f24e491ebb
commit ac78952962
4 changed files with 9 additions and 19 deletions

View file

@ -567,8 +567,8 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, IRouteInfo
boolean appModeChanged = currentAppMode != previousAppMode; boolean appModeChanged = currentAppMode != previousAppMode;
boolean refresh = this.visibleType == type && !appModeChanged; boolean refresh = this.visibleType == type && !appModeChanged;
this.previousAppMode = currentAppMode; previousAppMode = currentAppMode;
this.visibleType = type; visibleType = type;
DashboardOnMap.staticVisible = visible; DashboardOnMap.staticVisible = visible;
DashboardOnMap.staticVisibleType = type; DashboardOnMap.staticVisibleType = type;
mapActivity.enableDrawer(); mapActivity.enableDrawer();
@ -705,7 +705,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, IRouteInfo
if (visibleType == DashboardType.CONFIGURE_SCREEN) { if (visibleType == DashboardType.CONFIGURE_SCREEN) {
cm = mapActivity.getMapLayers().getMapWidgetRegistry().getViewConfigureMenuAdapter(mapActivity); cm = mapActivity.getMapLayers().getMapWidgetRegistry().getViewConfigureMenuAdapter(mapActivity);
} else if (visibleType == DashboardType.CONFIGURE_MAP) { } else if (visibleType == DashboardType.CONFIGURE_MAP) {
cm = new ConfigureMapMenu(mapActivity).createListAdapter(); cm = new ConfigureMapMenu().createListAdapter(mapActivity);
} else if (visibleType == DashboardType.LIST_MENU) { } else if (visibleType == DashboardType.LIST_MENU) {
cm = mapActivity.getMapActions().createMainOptionsMenu(); cm = mapActivity.getMapActions().createMainOptionsMenu();
} else if (visibleType == DashboardType.ROUTE_PREFERENCES) { } else if (visibleType == DashboardType.ROUTE_PREFERENCES) {

View file

@ -110,17 +110,11 @@ public class ConfigureMapMenu {
private int selectedLanguageIndex; private int selectedLanguageIndex;
private boolean transliterateNames; private boolean transliterateNames;
private MapActivity ma;
public interface OnClickListener { public interface OnClickListener {
void onClick(); void onClick();
} }
public ConfigureMapMenu(MapActivity mapActivity) { public ContextMenuAdapter createListAdapter(final MapActivity ma) {
this.ma = mapActivity;
}
public ContextMenuAdapter createListAdapter() {
OsmandApplication app = ma.getMyApplication(); OsmandApplication app = ma.getMyApplication();
boolean nightMode = app.getDaynightHelper().isNightModeForMapControls(); boolean nightMode = app.getDaynightHelper().isNightModeForMapControls();
int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme; int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
@ -133,7 +127,7 @@ public class ConfigureMapMenu {
adapter.setChangeAppModeListener(new OnClickListener() { adapter.setChangeAppModeListener(new OnClickListener() {
@Override @Override
public void onClick() { public void onClick() {
ma.getDashboard().updateListAdapter(createListAdapter()); ma.getDashboard().updateListAdapter(createListAdapter(ma));
} }
}); });
List<RenderingRuleProperty> customRules = getCustomRules(app, List<RenderingRuleProperty> customRules = getCustomRules(app,
@ -1124,10 +1118,6 @@ public class ConfigureMapMenu {
} }
} }
private OsmandApplication getMyApplication() {
return ma.getMyApplication();
}
private static class StringSpinnerArrayAdapter extends ArrayAdapter<String> { private static class StringSpinnerArrayAdapter extends ArrayAdapter<String> {
private boolean nightMode; private boolean nightMode;

View file

@ -197,8 +197,8 @@ public class ConfigureMenuItemsFragment extends BaseOsmAndFragment
contextMenuAdapter = ((MapActivity) activity).getMapActions().createMainOptionsMenu(); contextMenuAdapter = ((MapActivity) activity).getMapActions().createMainOptionsMenu();
break; break;
case CONFIGURE_MAP: case CONFIGURE_MAP:
ConfigureMapMenu configureMapMenu = new ConfigureMapMenu((MapActivity) activity); ConfigureMapMenu configureMapMenu = new ConfigureMapMenu();
contextMenuAdapter = configureMapMenu.createListAdapter(); contextMenuAdapter = configureMapMenu.createListAdapter((MapActivity) activity);
break; break;
case CONTEXT_MENU_ACTIONS: case CONTEXT_MENU_ACTIONS:
MapContextMenu menu = ((MapActivity) activity).getContextMenu(); MapContextMenu menu = ((MapActivity) activity).getContextMenu();

View file

@ -285,8 +285,8 @@ public class ConfigureMenuRootFragment extends BaseOsmAndFragment {
contextMenuAdapter = mapActivityActions.createMainOptionsMenu(); contextMenuAdapter = mapActivityActions.createMainOptionsMenu();
break; break;
case CONFIGURE_MAP: case CONFIGURE_MAP:
ConfigureMapMenu configureMapMenu = new ConfigureMapMenu((MapActivity) activity); ConfigureMapMenu configureMapMenu = new ConfigureMapMenu();
contextMenuAdapter = configureMapMenu.createListAdapter(); contextMenuAdapter = configureMapMenu.createListAdapter((MapActivity) activity);
break; break;
case CONTEXT_MENU_ACTIONS: case CONTEXT_MENU_ACTIONS:
MapContextMenu menu = ((MapActivity) activity).getContextMenu(); MapContextMenu menu = ((MapActivity) activity).getContextMenu();