Fix app mode change while navigating
This commit is contained in:
parent
9a075668dc
commit
c5b49de6de
1 changed files with 10 additions and 4 deletions
|
@ -33,6 +33,8 @@ import net.osmand.plus.MapMarkersHelper;
|
||||||
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
||||||
import net.osmand.plus.OsmAndFormatter;
|
import net.osmand.plus.OsmAndFormatter;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
import net.osmand.plus.OsmandSettings;
|
||||||
|
import net.osmand.plus.OsmandSettings.OsmandPreference;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.TargetPointsHelper;
|
import net.osmand.plus.TargetPointsHelper;
|
||||||
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
||||||
|
@ -228,7 +230,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
private void updateApplicationModes(final View parentView) {
|
private void updateApplicationModes(final View parentView) {
|
||||||
//final OsmandSettings settings = mapActivity.getMyApplication().getSettings();
|
//final OsmandSettings settings = mapActivity.getMyApplication().getSettings();
|
||||||
//ApplicationMode am = settings.APPLICATION_MODE.get();
|
//ApplicationMode am = settings.APPLICATION_MODE.get();
|
||||||
ApplicationMode am = routingHelper.getAppMode();
|
final ApplicationMode am = routingHelper.getAppMode();
|
||||||
final Set<ApplicationMode> selected = new HashSet<>();
|
final Set<ApplicationMode> selected = new HashSet<>();
|
||||||
selected.add(am);
|
selected.add(am);
|
||||||
ViewGroup vg = (ViewGroup) parentView.findViewById(R.id.app_modes);
|
ViewGroup vg = (ViewGroup) parentView.findViewById(R.id.app_modes);
|
||||||
|
@ -239,10 +241,14 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (selected.size() > 0) {
|
if (selected.size() > 0) {
|
||||||
ApplicationMode next = selected.iterator().next();
|
ApplicationMode next = selected.iterator().next();
|
||||||
//settings.APPLICATION_MODE.set(next);
|
OsmandPreference<ApplicationMode> appMode
|
||||||
//updateMenu();
|
= mapActivity.getMyApplication().getSettings().APPLICATION_MODE;
|
||||||
|
if (routingHelper.isFollowingMode() && appMode.get() == am) {
|
||||||
|
appMode.set(next);
|
||||||
|
//updateMenu();
|
||||||
|
}
|
||||||
routingHelper.setAppMode(next);
|
routingHelper.setAppMode(next);
|
||||||
mapActivity.getRoutingHelper().recalculateRouteDueToSettingsChange();
|
routingHelper.recalculateRouteDueToSettingsChange();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue