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

Commit e8118e17 authored by Chet Haase's avatar Chet Haase
Browse files

Sped up ActionBar and StatusBar animations

Animations to show/hide the ActionBar and StatusBar were very slow, given
the size of the objects and the distances covered by the sliding animations.
Also, the ActionBar animation was sometimes hiccuppy as it faded in/out.
This change eliminates the ActionBar fade (which is unnecessary) and speeds
up the animations (smaller durations and steeper interpolation curves). Also,
it eliminates the startDelay on the ActionBar show animation.

Issue #6564089 Options menu should slide in much quicker (nakasi/JB)

Change-Id: I2c8298301f7bf26bbbc94444e715420a2c029ba0
parent 20c15a42
Loading
Loading
Loading
Loading
+24 −21
Original line number Diff line number Diff line
@@ -673,26 +673,29 @@ public class ActionBarImpl extends ActionBar {

        if (mCurWindowVisibility == View.VISIBLE && (mShowHideAnimationEnabled
                || fromSystem)) {
            mTopVisibilityView.setAlpha(0);
            mTopVisibilityView.setTranslationY(-mTopVisibilityView.getHeight());
            mTopVisibilityView.setTranslationY(0); // because we're about to ask its window loc
            float startingY = -mTopVisibilityView.getHeight();
            if (fromSystem) {
                int topLeft[] = {0, 0};
                mTopVisibilityView.getLocationInWindow(topLeft);
                startingY -= topLeft[1];
            }
            mTopVisibilityView.setTranslationY(startingY);
            AnimatorSet anim = new AnimatorSet();
            AnimatorSet.Builder b = anim.play(ObjectAnimator.ofFloat(mTopVisibilityView, "alpha", 1));
            b.with(ObjectAnimator.ofFloat(mTopVisibilityView, "translationY", 0));
            AnimatorSet.Builder b = anim.play(ObjectAnimator.ofFloat(mTopVisibilityView,
                    "translationY", 0));
            if (mContentView != null) {
                b.with(ObjectAnimator.ofFloat(mContentView, "translationY",
                        -mTopVisibilityView.getHeight(), 0));
                        startingY, 0));
            }
            if (mSplitView != null && mContextDisplayMode == CONTEXT_DISPLAY_SPLIT) {
                mSplitView.setAlpha(0);
                mSplitView.setTranslationY(mSplitView.getHeight());
                mSplitView.setVisibility(View.VISIBLE);
                b.with(ObjectAnimator.ofFloat(mSplitView, "alpha", 1));
                b.with(ObjectAnimator.ofFloat(mSplitView, "translationY", 0));
            }
            anim.setInterpolator(AnimationUtils.loadInterpolator(mContext,
                    com.android.internal.R.interpolator.decelerate_quad));
            anim.setDuration(mContext.getResources().getInteger(
                    com.android.internal.R.integer.config_mediumAnimTime));
                    com.android.internal.R.interpolator.decelerate_cubic));
            anim.setDuration(250);
            // If this is being shown from the system, add a small delay.
            // This is because we will also be animating in the status bar,
            // and these two elements can't be done in lock-step.  So we give
@@ -700,9 +703,6 @@ public class ActionBarImpl extends ActionBar {
            // the action bar animates.  (This corresponds to the corresponding
            // case when hiding, where the status bar has a small delay before
            // starting.)
            if (fromSystem) {
                anim.setStartDelay(100);
            }
            anim.addListener(mShowListener);
            mCurrentShowAnim = anim;
            anim.start();
@@ -734,23 +734,26 @@ public class ActionBarImpl extends ActionBar {
            mTopVisibilityView.setAlpha(1);
            mContainerView.setTransitioning(true);
            AnimatorSet anim = new AnimatorSet();
            AnimatorSet.Builder b = anim.play(ObjectAnimator.ofFloat(mTopVisibilityView, "alpha", 0));
            b.with(ObjectAnimator.ofFloat(mTopVisibilityView, "translationY",
                    -mTopVisibilityView.getHeight()));
            float endingY = -mTopVisibilityView.getHeight();
            if (fromSystem) {
                int topLeft[] = {0, 0};
                mTopVisibilityView.getLocationInWindow(topLeft);
                endingY -= topLeft[1];
            }
            AnimatorSet.Builder b = anim.play(ObjectAnimator.ofFloat(mTopVisibilityView,
                    "translationY", endingY));
            if (mContentView != null) {
                b.with(ObjectAnimator.ofFloat(mContentView, "translationY",
                        0, -mTopVisibilityView.getHeight()));
                        0, endingY));
            }
            if (mSplitView != null && mSplitView.getVisibility() == View.VISIBLE) {
                mSplitView.setAlpha(1);
                b.with(ObjectAnimator.ofFloat(mSplitView, "alpha", 0));
                b.with(ObjectAnimator.ofFloat(mSplitView, "translationY",
                        mSplitView.getHeight()));
            }
            anim.setInterpolator(AnimationUtils.loadInterpolator(mContext,
                    com.android.internal.R.interpolator.accelerate_quad));
            anim.setDuration(mContext.getResources().getInteger(
                    com.android.internal.R.integer.config_mediumAnimTime));
                    com.android.internal.R.interpolator.accelerate_cubic));
            anim.setDuration(250);
            anim.addListener(mHideListener);
            mCurrentShowAnim = anim;
            anim.start();
+2 −2
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@

<!-- Animation for when a dock window at the bottom of the screen is entering. -->
<set xmlns:android="http://schemas.android.com/apk/res/android"
        android:interpolator="@android:interpolator/decelerate_quad">
        android:interpolator="@android:interpolator/decelerate_cubic">
    <translate android:fromYDelta="100%" android:toYDelta="0"
        android:duration="@android:integer/config_mediumAnimTime"/>
        android:duration="250"/>
</set>
+2 −2
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@

<!-- Animation for when a dock window at the bottom of the screen is exiting. -->
<set xmlns:android="http://schemas.android.com/apk/res/android"
        android:interpolator="@android:interpolator/accelerate_quad">
        android:interpolator="@android:interpolator/accelerate_cubic">
    <translate android:fromYDelta="0" android:toYDelta="100%"
        android:startOffset="100" android:duration="@android:integer/config_mediumAnimTime"/>
        android:startOffset="100" android:duration="250"/>
</set>
+2 −2
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@

<!-- Animation for when a dock window at the left of the screen is entering. -->
<set xmlns:android="http://schemas.android.com/apk/res/android"
        android:interpolator="@android:interpolator/decelerate_quad">
        android:interpolator="@android:interpolator/decelerate_cubic">
    <translate android:fromXDelta="-100%" android:toXDelta="0"
        android:duration="@android:integer/config_mediumAnimTime"/>
        android:duration="250"/>
</set>
+2 −2
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@

<!-- Animation for when a dock window at the right of the screen is exiting. -->
<set xmlns:android="http://schemas.android.com/apk/res/android"
        android:interpolator="@android:interpolator/accelerate_quad">
        android:interpolator="@android:interpolator/accelerate_cubic">
    <translate android:fromXDelta="0" android:toXDelta="-100%"
        android:startOffset="100" android:duration="@android:integer/config_mediumAnimTime"/>
        android:startOffset="100" android:duration="250"/>
</set>
Loading