This commit is contained in:
Alexey Kulish 2017-10-11 20:56:32 +03:00
parent f5cf28b740
commit ea3739c95f
2 changed files with 12 additions and 7 deletions

View file

@ -16,6 +16,7 @@ import net.osmand.AndroidUtils;
import net.osmand.data.LatLon; import net.osmand.data.LatLon;
import net.osmand.plus.ApplicationMode; import net.osmand.plus.ApplicationMode;
import net.osmand.plus.IconsCache; import net.osmand.plus.IconsCache;
import net.osmand.plus.OsmandSettings;
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;
@ -50,7 +51,7 @@ public class DestinationReachedMenuFragment extends Fragment {
view.setOnClickListener(new View.OnClickListener() { view.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
dismissMenu(); dismissMenu(true);
} }
}); });
@ -61,7 +62,7 @@ public class DestinationReachedMenuFragment extends Fragment {
closeImageButton.setOnClickListener(new View.OnClickListener() { closeImageButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
dismissMenu(); dismissMenu(true);
} }
}); });
@ -81,7 +82,7 @@ public class DestinationReachedMenuFragment extends Fragment {
getMapActivity().getContextMenu().close(); getMapActivity().getContextMenu().close();
} }
} }
dismissMenu(); dismissMenu(true);
} }
}); });
@ -95,7 +96,7 @@ public class DestinationReachedMenuFragment extends Fragment {
TargetPointsHelper helper = getMapActivity().getMyApplication().getTargetPointsHelper(); TargetPointsHelper helper = getMapActivity().getMyApplication().getTargetPointsHelper();
TargetPoint target = helper.getPointToNavigate(); TargetPoint target = helper.getPointToNavigate();
dismissMenu(); dismissMenu(false);
if (target != null) { if (target != null) {
helper.navigateToPoint(new LatLon(target.getLatitude(), target.getLongitude()), helper.navigateToPoint(new LatLon(target.getLatitude(), target.getLongitude()),
@ -129,7 +130,7 @@ public class DestinationReachedMenuFragment extends Fragment {
newIntent.putExtra(SearchActivity.SEARCH_NEARBY, true); newIntent.putExtra(SearchActivity.SEARCH_NEARBY, true);
startActivityForResult(newIntent, 0); startActivityForResult(newIntent, 0);
} }
dismissMenu(); dismissMenu(false);
} }
}); });
@ -181,7 +182,11 @@ public class DestinationReachedMenuFragment extends Fragment {
.addToBackStack(TAG).commitAllowingStateLoss(); .addToBackStack(TAG).commitAllowingStateLoss();
} }
public void dismissMenu() { public void dismissMenu(boolean restoreAppMode) {
if (restoreAppMode) {
OsmandSettings settings = getMapActivity().getMyApplication().getSettings();
settings.APPLICATION_MODE.set(settings.DEFAULT_APPLICATION_MODE.get());
}
getMapActivity().getMapActions().stopNavigationWithoutConfirm(); getMapActivity().getMapActions().stopNavigationWithoutConfirm();
getMapActivity().getSupportFragmentManager().popBackStack(); getMapActivity().getSupportFragmentManager().popBackStack();
} }

View file

@ -549,7 +549,7 @@ public class RoutingHelper {
@Override @Override
public void run() { public void run() {
settings.LAST_ROUTING_APPLICATION_MODE = settings.APPLICATION_MODE.get(); settings.LAST_ROUTING_APPLICATION_MODE = settings.APPLICATION_MODE.get();
settings.APPLICATION_MODE.set(settings.DEFAULT_APPLICATION_MODE.get()); //settings.APPLICATION_MODE.set(settings.DEFAULT_APPLICATION_MODE.get());
} }
}); });
finishCurrentRoute(); finishCurrentRoute();