@@ -673,36 +673,36 @@ public void doShow(boolean fromSystem) {
673673
674674 if (mCurWindowVisibility == View .VISIBLE && (mShowHideAnimationEnabled
675675 || fromSystem )) {
676- mTopVisibilityView .setAlpha (0 );
677- mTopVisibilityView .setTranslationY (-mTopVisibilityView .getHeight ());
676+ mTopVisibilityView .setTranslationY (0 ); // because we're about to ask its window loc
677+ float startingY = -mTopVisibilityView .getHeight ();
678+ if (fromSystem ) {
679+ int topLeft [] = {0 , 0 };
680+ mTopVisibilityView .getLocationInWindow (topLeft );
681+ startingY -= topLeft [1 ];
682+ }
683+ mTopVisibilityView .setTranslationY (startingY );
678684 AnimatorSet anim = new AnimatorSet ();
679- AnimatorSet .Builder b = anim .play (ObjectAnimator .ofFloat (mTopVisibilityView , "alpha" , 1 ));
680- b . with ( ObjectAnimator . ofFloat ( mTopVisibilityView , "translationY" , 0 ));
685+ AnimatorSet .Builder b = anim .play (ObjectAnimator .ofFloat (mTopVisibilityView ,
686+ "translationY" , 0 ));
681687 if (mContentView != null ) {
682688 b .with (ObjectAnimator .ofFloat (mContentView , "translationY" ,
683- - mTopVisibilityView . getHeight () , 0 ));
689+ startingY , 0 ));
684690 }
685691 if (mSplitView != null && mContextDisplayMode == CONTEXT_DISPLAY_SPLIT ) {
686- mSplitView .setAlpha (0 );
687692 mSplitView .setTranslationY (mSplitView .getHeight ());
688693 mSplitView .setVisibility (View .VISIBLE );
689- b .with (ObjectAnimator .ofFloat (mSplitView , "alpha" , 1 ));
690694 b .with (ObjectAnimator .ofFloat (mSplitView , "translationY" , 0 ));
691695 }
692696 anim .setInterpolator (AnimationUtils .loadInterpolator (mContext ,
693- com .android .internal .R .interpolator .decelerate_quad ));
694- anim .setDuration (mContext .getResources ().getInteger (
695- com .android .internal .R .integer .config_mediumAnimTime ));
697+ com .android .internal .R .interpolator .decelerate_cubic ));
698+ anim .setDuration (250 );
696699 // If this is being shown from the system, add a small delay.
697700 // This is because we will also be animating in the status bar,
698701 // and these two elements can't be done in lock-step. So we give
699702 // a little time for the status bar to start its animation before
700703 // the action bar animates. (This corresponds to the corresponding
701704 // case when hiding, where the status bar has a small delay before
702705 // starting.)
703- if (fromSystem ) {
704- anim .setStartDelay (100 );
705- }
706706 anim .addListener (mShowListener );
707707 mCurrentShowAnim = anim ;
708708 anim .start ();
@@ -734,23 +734,26 @@ public void doHide(boolean fromSystem) {
734734 mTopVisibilityView .setAlpha (1 );
735735 mContainerView .setTransitioning (true );
736736 AnimatorSet anim = new AnimatorSet ();
737- AnimatorSet .Builder b = anim .play (ObjectAnimator .ofFloat (mTopVisibilityView , "alpha" , 0 ));
738- b .with (ObjectAnimator .ofFloat (mTopVisibilityView , "translationY" ,
739- -mTopVisibilityView .getHeight ()));
737+ float endingY = -mTopVisibilityView .getHeight ();
738+ if (fromSystem ) {
739+ int topLeft [] = {0 , 0 };
740+ mTopVisibilityView .getLocationInWindow (topLeft );
741+ endingY -= topLeft [1 ];
742+ }
743+ AnimatorSet .Builder b = anim .play (ObjectAnimator .ofFloat (mTopVisibilityView ,
744+ "translationY" , endingY ));
740745 if (mContentView != null ) {
741746 b .with (ObjectAnimator .ofFloat (mContentView , "translationY" ,
742- 0 , - mTopVisibilityView . getHeight () ));
747+ 0 , endingY ));
743748 }
744749 if (mSplitView != null && mSplitView .getVisibility () == View .VISIBLE ) {
745750 mSplitView .setAlpha (1 );
746- b .with (ObjectAnimator .ofFloat (mSplitView , "alpha" , 0 ));
747751 b .with (ObjectAnimator .ofFloat (mSplitView , "translationY" ,
748752 mSplitView .getHeight ()));
749753 }
750754 anim .setInterpolator (AnimationUtils .loadInterpolator (mContext ,
751- com .android .internal .R .interpolator .accelerate_quad ));
752- anim .setDuration (mContext .getResources ().getInteger (
753- com .android .internal .R .integer .config_mediumAnimTime ));
755+ com .android .internal .R .interpolator .accelerate_cubic ));
756+ anim .setDuration (250 );
754757 anim .addListener (mHideListener );
755758 mCurrentShowAnim = anim ;
756759 anim .start ();
0 commit comments