diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/PointEditorFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/PointEditorFragment.java index fa8d62fb88..bdf49bf7b6 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/PointEditorFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/PointEditorFragment.java @@ -141,7 +141,7 @@ public abstract class PointEditorFragment extends BaseOsmAndFragment { FragmentManager fragmentManager = getFragmentManager(); SelectFavoriteCategoryBottomSheet dialogFragment = createSelectCategoryDialog(); if (fragmentManager != null && dialogFragment != null) { - dialogFragment.showInstance(getChildFragmentManager(), getTargetFragment()); + dialogFragment.show(fragmentManager, SelectFavoriteCategoryBottomSheet.class.getSimpleName()); } return true; } diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/PointEditorFragmentNew.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/PointEditorFragmentNew.java index 3b7768db5c..7388c08415 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/PointEditorFragmentNew.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/PointEditorFragmentNew.java @@ -195,7 +195,7 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment implemen FragmentManager fragmentManager = getFragmentManager(); SelectFavoriteCategoryBottomSheet dialogFragment = createSelectCategoryDialog(); if (fragmentManager != null && dialogFragment != null) { - dialogFragment.showInstance(getChildFragmentManager(), getTargetFragment()); + dialogFragment.show(fragmentManager, SelectFavoriteCategoryBottomSheet.class.getSimpleName()); } } }); @@ -741,6 +741,17 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment implemen } } + @Nullable + protected AddNewFavoriteCategoryBottomSheet createAddCategoryDialog() { + PointEditor editor = getEditor(); + if (editor != null) { + return AddNewFavoriteCategoryBottomSheet.createInstance(editor.getFragmentTag(), getCategories(), + !editor.getFragmentTag().equals(FavoritePointEditor.TAG)); + } else { + return null; + } + } + @Override public void onDestroyView() { PointEditor editor = getEditor(); @@ -1008,8 +1019,9 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment implemen @Override public void onClick(View view) { FragmentManager fragmentManager = getFragmentManager(); - if (fragmentManager != null) { - SelectFavoriteCategoryBottomSheet.showInstance(getChildFragmentManager(), getTargetFragment()); + AddNewFavoriteCategoryBottomSheet dialogFragment = createAddCategoryDialog(); + if (fragmentManager != null && dialogFragment != null) { + dialogFragment.show(fragmentManager, SelectFavoriteCategoryBottomSheet.class.getSimpleName()); } } }); diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/SelectFavoriteCategoryBottomSheet.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/SelectFavoriteCategoryBottomSheet.java index 0d7c78599e..ad19a14700 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/SelectFavoriteCategoryBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/SelectFavoriteCategoryBottomSheet.java @@ -32,6 +32,7 @@ import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithDescription; import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem; import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerItem; import net.osmand.plus.helpers.AndroidUiHelper; +import net.osmand.plus.myplaces.AddNewTrackFolderBottomSheet; import java.util.List; import java.util.Map; @@ -43,7 +44,7 @@ public class SelectFavoriteCategoryBottomSheet extends MenuBottomSheetDialogFrag private static final String KEY_CTX_SEL_CAT_EDITOR_TAG = "key_ctx_sel_cat_editor_tag"; private OsmandApplication app; private GPXUtilities.GPXFile gpxFile; - private String editorTag; + private static String editorTag; private Map gpxCategories; private SelectFavoriteCategoryBottomSheet.CategorySelectionListener selectionListener; @@ -125,7 +126,7 @@ public class SelectFavoriteCategoryBottomSheet extends MenuBottomSheetDialogFrag MapActivity mapActivity = (MapActivity) activity; Set categories = gpxCategories != null ? gpxCategories.keySet() : null; AddNewFavoriteCategoryBottomSheet fragment = AddNewFavoriteCategoryBottomSheet.createInstance(editorTag, categories, gpxFile != null); - AddNewFavoriteCategoryBottomSheet.showInstance(mapActivity.getSupportFragmentManager(), getTargetFragment()); + fragment.show(mapActivity.getSupportFragmentManager(), AddNewTrackFolderBottomSheet.class.getName()); fragment.setSelectionListener(selectionListener); dismiss(); }