Skip to content

Commit

Permalink
Allowed opening non-modals from modals (& stacks)
Browse files Browse the repository at this point in the history
Navigated A -> B with modal C -> modal D with non-modal E -> non-modal F. Then gestured back through all of them. Had to get the ancestor fragment the same was as already in NavigationStackView - so it looks for Dialog support fragment manager because the parent stack is the modal for the non-modal
  • Loading branch information
grahammendick committed Jun 24, 2024
1 parent 9c746b1 commit 8774eef
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ void onAfterUpdateTransaction() {
for (int i = 0; i < ancestorStackIds.size(); i++) {
Fragment ancestorFragment = fragmentManager.findFragmentByTag(ancestorStackIds.getString(i));
if (ancestorFragment == null) return;
fragmentManager = ancestorFragment.getChildFragmentManager();
if (!(ancestorFragment instanceof DialogFragmentController dialogFragmentController))
fragmentManager = ancestorFragment.getChildFragmentManager();
else
fragmentManager = dialogFragmentController.getSupportFragmentManager();
}
fragment = new BottomSheetView.BottomSheetFragment(this);
FragmentTransaction transaction = fragmentManager.beginTransaction();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ void onAfterUpdateTransaction() {
for (int i = 0; i < ancestorStackIds.size(); i++) {
Fragment ancestorFragment = fragmentManager.findFragmentByTag(ancestorStackIds.getString(i));
if (ancestorFragment == null) return;
fragmentManager = ancestorFragment.getChildFragmentManager();
if (!(ancestorFragment instanceof DialogFragmentController dialogFragmentController))
fragmentManager = ancestorFragment.getChildFragmentManager();
else
fragmentManager = dialogFragmentController.getSupportFragmentManager();
}
FragmentTransaction transaction;
if (fragment == null ) {
Expand Down

0 comments on commit 8774eef

Please sign in to comment.