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 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) {

View file

@ -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<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 boolean nightMode;

View file

@ -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();

View file

@ -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();