diff --git a/app/src/main/java/de/westnordost/streetcomplete/screens/main/MainFragment.kt b/app/src/main/java/de/westnordost/streetcomplete/screens/main/MainFragment.kt index c76a139841..dd95056cc0 100644 --- a/app/src/main/java/de/westnordost/streetcomplete/screens/main/MainFragment.kt +++ b/app/src/main/java/de/westnordost/streetcomplete/screens/main/MainFragment.kt @@ -901,9 +901,12 @@ class MainFragment : private fun showEditHistorySidebar() { val appearAnim = R.animator.edit_history_sidebar_appear val disappearAnim = R.animator.edit_history_sidebar_disappear + if (editHistoryFragment != null) { + childFragmentManager.popBackStack(EDIT_HISTORY, FragmentManager.POP_BACK_STACK_INCLUSIVE) + } childFragmentManager.commit(true) { setCustomAnimations(appearAnim, disappearAnim, appearAnim, disappearAnim) - replace(R.id.edit_history_container, EditHistoryFragment(), EDIT_HISTORY) + add(R.id.edit_history_container, EditHistoryFragment(), EDIT_HISTORY) addToBackStack(EDIT_HISTORY) } mapFragment?.hideOverlay() @@ -944,14 +947,15 @@ class MainFragment : private fun showInBottomSheet(f: Fragment, clearPreviousHighlighting: Boolean = true) { activity?.currentFocus?.hideKeyboard() freezeMap() - if (bottomSheetFragment != null && clearPreviousHighlighting) { - clearHighlighting() + if (bottomSheetFragment != null) { + if (clearPreviousHighlighting) clearHighlighting() + childFragmentManager.popBackStack(BOTTOM_SHEET, FragmentManager.POP_BACK_STACK_INCLUSIVE) } val appearAnim = R.animator.quest_answer_form_appear val disappearAnim = R.animator.quest_answer_form_disappear childFragmentManager.commit(true) { setCustomAnimations(appearAnim, disappearAnim, appearAnim, disappearAnim) - replace(R.id.map_bottom_sheet_container, f, BOTTOM_SHEET) + add(R.id.map_bottom_sheet_container, f, BOTTOM_SHEET) addToBackStack(BOTTOM_SHEET) } sheetBackPressedCallback.isEnabled = f is IsCloseableBottomSheet