Fix app mode change while navigating

This commit is contained in:
Alexey Kulish 2016-11-03 14:39:07 +03:00
parent 9a075668dc
commit c5b49de6de

View file

@ -33,6 +33,8 @@ import net.osmand.plus.MapMarkersHelper;
import net.osmand.plus.MapMarkersHelper.MapMarker;
import net.osmand.plus.OsmAndFormatter;
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.TargetPointsHelper;
import net.osmand.plus.TargetPointsHelper.TargetPoint;
@ -228,7 +230,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
private void updateApplicationModes(final View parentView) {
//final OsmandSettings settings = mapActivity.getMyApplication().getSettings();
//ApplicationMode am = settings.APPLICATION_MODE.get();
ApplicationMode am = routingHelper.getAppMode();
final ApplicationMode am = routingHelper.getAppMode();
final Set<ApplicationMode> selected = new HashSet<>();
selected.add(am);
ViewGroup vg = (ViewGroup) parentView.findViewById(R.id.app_modes);
@ -239,10 +241,14 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
public void onClick(View v) {
if (selected.size() > 0) {
ApplicationMode next = selected.iterator().next();
//settings.APPLICATION_MODE.set(next);
//updateMenu();
OsmandPreference<ApplicationMode> appMode
= mapActivity.getMyApplication().getSettings().APPLICATION_MODE;
if (routingHelper.isFollowingMode() && appMode.get() == am) {
appMode.set(next);
//updateMenu();
}
routingHelper.setAppMode(next);
mapActivity.getRoutingHelper().recalculateRouteDueToSettingsChange();
routingHelper.recalculateRouteDueToSettingsChange();
}
}
});