Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c5828b50 authored by George Mount's avatar George Mount
Browse files

Fix FragmentTransaction.show() to show the fragment.

Bug 37413327

When there was an animation and the fragment transaction wasn't
optimized, the fragment visiiblity wasn't being set during show().

Test: I0fd4029a02d6c9f082011bf56f0d3c8245803f68
Change-Id: Idc2c74ae2fc4759a755a5988ce6ca1b39ef8d554
parent dc2dd6ed
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -1462,18 +1462,22 @@ final class FragmentManagerImpl extends FragmentManager implements LayoutInflate
                    if (fragment.isHideReplaced()) {
                        fragment.setHideReplaced(false);
                    } else {
                        final ViewGroup container = fragment.mContainer;
                        final View animatingView = fragment.mView;
                        container.startViewTransition(animatingView);
                        // Delay the actual hide operation until the animation finishes, otherwise
                        // the fragment will just immediately disappear
                        anim.addListener(new AnimatorListenerAdapter() {
                            @Override
                            public void onAnimationEnd(Animator animation) {
                                container.endViewTransition(animatingView);
                                animation.removeListener(this);
                                if (fragment.mView != null) {
                                    fragment.mView.setVisibility(View.GONE);
                                }
                                animatingView.setVisibility(View.GONE);
                            }
                        });
                    }
                } else {
                    fragment.mView.setVisibility(View.VISIBLE);
                }
                setHWLayerAnimListenerIfAlpha(fragment.mView, anim);
                anim.start();