Stop navigation only after "Finish navigation" click otherwise only close the menu

This commit is contained in:
alex 2017-11-24 15:50:31 +02:00
parent 0bd368c449
commit a85be29120

View file

@ -51,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(true); dismissMenu();
} }
}); });
@ -62,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(true); dismissMenu();
} }
}); });
@ -82,7 +82,10 @@ public class DestinationReachedMenuFragment extends Fragment {
getMapActivity().getContextMenu().close(); getMapActivity().getContextMenu().close();
} }
} }
dismissMenu(true); OsmandSettings settings = getMapActivity().getMyApplication().getSettings();
settings.APPLICATION_MODE.set(settings.DEFAULT_APPLICATION_MODE.get());
getMapActivity().getMapActions().stopNavigationWithoutConfirm();
dismissMenu();
} }
}); });
@ -96,7 +99,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(false); dismissMenu();
if (target != null) { if (target != null) {
helper.navigateToPoint(new LatLon(target.getLatitude(), target.getLongitude()), helper.navigateToPoint(new LatLon(target.getLatitude(), target.getLongitude()),
@ -130,7 +133,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(false); dismissMenu();
} }
}); });
@ -182,12 +185,7 @@ public class DestinationReachedMenuFragment extends Fragment {
.addToBackStack(TAG).commitAllowingStateLoss(); .addToBackStack(TAG).commitAllowingStateLoss();
} }
public void dismissMenu(boolean restoreAppMode) { public void dismissMenu() {
if (restoreAppMode) {
OsmandSettings settings = getMapActivity().getMyApplication().getSettings();
settings.APPLICATION_MODE.set(settings.DEFAULT_APPLICATION_MODE.get());
}
getMapActivity().getMapActions().stopNavigationWithoutConfirm();
getMapActivity().getSupportFragmentManager().popBackStack(); getMapActivity().getSupportFragmentManager().popBackStack();
} }