| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent c8c0be7 commit 158621e
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -778,11 +778,17 @@ class FragmentCallbacksImplementation implements AndroidFragmentCallbacks { | |||
| 778 | 778 | ||
| 779 | 779 | // fixes 'java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first'. | |
| 780 | 780 | // on app resume in nested frame scenarios with support library version greater than 26.0.0 | |
| 781 | - const view = fragment.getView(); | ||
| 782 | - if (view != null) { | ||
| 783 | - const viewParent = view.getParent(); | ||
| 784 | - if (viewParent instanceof android.view.ViewGroup) { | ||
| 785 | - viewParent.removeView(view); | ||
| 781 | + // NOTE: ensure this is executed only for nested fragments as removing the view for top level fragments | ||
| 782 | + // would break exit animations e.g. for navigation with Flip transition the old(exiting) fragment disappears | ||
| 783 | + // immediately and one can see the flipping new fragment all the way from reverse side to front; | ||
| 784 | + // animating nested fragments is half-impossible at the moment either way -- see http://delyan.me/android-s-matryoshka-problem/ | ||
| 785 | + if (fragment.getParentFragment()) { | ||
| 786 | + const view = fragment.getView(); | ||
| 787 | + if (view != null) { | ||
| 788 | + const viewParent = view.getParent(); | ||
| 789 | + if (viewParent instanceof android.view.ViewGroup) { | ||
| 790 | + viewParent.removeView(view); | ||
| 791 | + } | ||
| 786 | 792 | } | |
| 787 | 793 | } | |
| 788 | 794 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments