Fix back button cancel

This commit is contained in:
Dima-1 2020-03-30 19:58:47 +03:00
parent da0f697fc0
commit 9d5209d666
2 changed files with 20 additions and 1 deletions

View file

@ -112,6 +112,9 @@ import net.osmand.plus.mapcontextmenu.AdditionalActionsBottomSheetDialogFragment
import net.osmand.plus.mapcontextmenu.MapContextMenu;
import net.osmand.plus.mapcontextmenu.MenuController.MenuState;
import net.osmand.plus.mapcontextmenu.builders.cards.dialogs.ContextMenuCardDialogFragment;
import net.osmand.plus.mapcontextmenu.editors.FavoritePointEditor;
import net.osmand.plus.mapcontextmenu.editors.PointEditorFragmentNew;
import net.osmand.plus.mapcontextmenu.editors.WptPtEditor;
import net.osmand.plus.mapcontextmenu.other.DestinationReachedMenu;
import net.osmand.plus.mapcontextmenu.other.TrackDetailsMenu;
import net.osmand.plus.mapmarkers.MapMarkersDialogFragment;
@ -700,6 +703,13 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
return;
}
}
PointEditorFragmentNew pointEditorFragmentNew = getPointEditorFragmentNew();
if (pointEditorFragmentNew != null) {
pointEditorFragmentNew.showExitDialog();
return;
}
if (mapContextMenu.isVisible() && mapContextMenu.isClosable()) {
if (mapContextMenu.getCurrentMenuState() != MenuState.HEADER_ONLY && !isLandscapeLayout()) {
mapContextMenu.openMenuHeaderOnly();
@ -2459,6 +2469,15 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
return getFragment(ImportCompleteFragment.TAG);
}
public PointEditorFragmentNew getPointEditorFragmentNew() {
PointEditorFragmentNew pointEditorFragmentNew;
pointEditorFragmentNew = getFragment(FavoritePointEditor.TAG);
if (pointEditorFragmentNew == null) {
pointEditorFragmentNew = getFragment(WptPtEditor.TAG);
}
return pointEditorFragmentNew;
}
public void backToConfigureProfileFragment() {
FragmentManager fragmentManager = getSupportFragmentManager();
int backStackEntryCount = fragmentManager.getBackStackEntryCount();

View file

@ -738,7 +738,7 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
return getPaintedContentIcon(iconId, color);
}
private void showExitDialog() {
public void showExitDialog() {
hideKeyboard();
if (!wasSaved()) {
AlertDialog.Builder dismissDialog = createWarningDialog(getActivity(),