Merge pull request #7755 from osmandapp/minor_fixes
Small fixes in route preparation and context menu
diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java
index 0aa8d18..b44add4 100644
--- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java
+++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java
@@ -1411,7 +1411,7 @@
public final OsmandPreference<Boolean> SHOW_MAPILLARY = new BooleanPreference("show_mapillary", false).makeProfile();
public final OsmandPreference<Boolean> MAPILLARY_FIRST_DIALOG_SHOWN = new BooleanPreference("mapillary_first_dialog_shown", false).makeGlobal();
- public final OsmandPreference<Boolean> ONLINE_PHOTOS_ROW_COLLAPSED = new BooleanPreference("mapillary_menu_collapsed", false).makeGlobal();
+ public final OsmandPreference<Boolean> ONLINE_PHOTOS_ROW_COLLAPSED = new BooleanPreference("mapillary_menu_collapsed", true).makeGlobal();
public final OsmandPreference<Boolean> WEBGL_SUPPORTED = new BooleanPreference("webgl_supported", true).makeGlobal();
// this value string is synchronized with settings_pref.xml preference name
diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java
index 095394e..1d92f24 100644
--- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java
+++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java
@@ -824,7 +824,8 @@
if (mapActivity == null || mainView == null) {
return;
}
- final ApplicationMode am = mapActivity.getMyApplication().getRoutingHelper().getAppMode();
+ OsmandApplication app = mapActivity.getMyApplication();
+ final ApplicationMode am = app.getRoutingHelper().getAppMode();
final Set<ApplicationMode> selected = new HashSet<>();
selected.add(am);
ViewGroup vg = (ViewGroup) mainView.findViewById(R.id.app_modes);
@@ -843,7 +844,7 @@
}
}
};
- final List<ApplicationMode> values = new ArrayList<ApplicationMode>(ApplicationMode.values(mapActivity.getMyApplication()));
+ final List<ApplicationMode> values = new ArrayList<ApplicationMode>(ApplicationMode.values(app));
values.remove(ApplicationMode.DEFAULT);
if (values.size() > 0 && !values.contains(am)) {
@@ -866,8 +867,8 @@
boolean firstMode = true;
while (iterator.hasNext()) {
ApplicationMode mode = iterator.next();
- View toggle = AppModeDialog.createToggle(mapActivity.getLayoutInflater(), (OsmandApplication) mapActivity.getApplication(),
- R.layout.mode_view_route_preparation, (LinearLayout) ll.findViewById(R.id.app_modes_content), mode, true);
+ View toggle = AppModeDialog.createToggle(mapActivity.getLayoutInflater(), app, R.layout.mode_view_route_preparation,
+ (LinearLayout) ll.findViewById(R.id.app_modes_content), mode, true);
if (firstMode && toggle.getLayoutParams() instanceof ViewGroup.MarginLayoutParams) {
firstMode = false;
@@ -882,10 +883,11 @@
buttons[k++] = toggle;
}
for (int i = 0; i < buttons.length; i++) {
- AppModeDialog.updateButtonStateForRoute((OsmandApplication) mapActivity.getApplication(), values, selected, listener, buttons, i, true, true, nightMode);
+ AppModeDialog.updateButtonStateForRoute(app, values, selected, listener, buttons, i, true, true, nightMode);
}
- final ApplicationMode activeMode = app.getSettings().getApplicationMode();
+ final ApplicationMode activeMode = app.getRoutingHelper().getAppMode();
+
final int idx = values.indexOf(activeMode);
OnGlobalLayoutListener globalListener = new OnGlobalLayoutListener() {