summaryrefslogtreecommitdiffstats
path: root/core/java/com
diff options
context:
space:
mode:
authorChet Haase <chet@google.com>2012-05-30 14:19:02 -0700
committerChet Haase <chet@google.com>2012-05-30 16:47:54 -0700
commite8118e17b2f088f2ebecfbe050c4ffa80f686abf (patch)
tree24efe4807f9e224cd4a74b6745b3cfe375a98a67 /core/java/com
parent20c15a4271ea3a7fb2210430bfc53f611603cf76 (diff)
downloadframeworks_base-e8118e17b2f088f2ebecfbe050c4ffa80f686abf.zip
frameworks_base-e8118e17b2f088f2ebecfbe050c4ffa80f686abf.tar.gz
frameworks_base-e8118e17b2f088f2ebecfbe050c4ffa80f686abf.tar.bz2
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
Diffstat (limited to 'core/java/com')
-rw-r--r--core/java/com/android/internal/app/ActionBarImpl.java45
1 files changed, 24 insertions, 21 deletions
diff --git a/core/java/com/android/internal/app/ActionBarImpl.java b/core/java/com/android/internal/app/ActionBarImpl.java
index 234cb71..46478ca 100644
--- a/core/java/com/android/internal/app/ActionBarImpl.java
+++ b/core/java/com/android/internal/app/ActionBarImpl.java
@@ -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();