Loading core/java/android/app/Activity.java +2 −0 Original line number Diff line number Diff line Loading @@ -1073,6 +1073,7 @@ public class Activity extends ContextThemeWrapper protected void onPostResume() { final Window win = getWindow(); if (win != null) win.makeActive(); if (mActionBar != null) mActionBar.setShowHideAnimationEnabled(true); mCalled = true; } Loading Loading @@ -1325,6 +1326,7 @@ public class Activity extends ContextThemeWrapper * @see #onDestroy */ protected void onStop() { if (mActionBar != null) mActionBar.setShowHideAnimationEnabled(false); mCalled = true; } Loading core/java/android/app/Dialog.java +2 −0 Original line number Diff line number Diff line Loading @@ -352,12 +352,14 @@ public class Dialog implements DialogInterface, Window.Callback, * Called when the dialog is starting. */ protected void onStart() { if (mActionBar != null) mActionBar.setShowHideAnimationEnabled(true); } /** * Called to tell you that you're stopping. */ protected void onStop() { if (mActionBar != null) mActionBar.setShowHideAnimationEnabled(false); } private static final String DIALOG_SHOWING_TAG = "android:dialogShowing"; Loading core/java/com/android/internal/app/ActionBarImpl.java +49 −23 Original line number Diff line number Diff line Loading @@ -92,6 +92,7 @@ public class ActionBarImpl extends ActionBar { final Handler mHandler = new Handler(); private Animator mCurrentAnim; private boolean mShowHideAnimationEnabled; private static final TimeInterpolator sFadeOutInterpolator = new DecelerateInterpolator(); Loading Loading @@ -217,6 +218,20 @@ public class ActionBarImpl extends ActionBar { CONTEXT_DISPLAY_NORMAL : CONTEXT_DISPLAY_SPLIT; } /** * Enables or disables animation between show/hide states. * If animation is disabled using this method, animations in progress * will be finished. * * @param enabled true to animate, false to not animate. */ public void setShowHideAnimationEnabled(boolean enabled) { mShowHideAnimationEnabled = enabled; if (!enabled && mCurrentAnim != null) { mCurrentAnim.end(); } } public void addOnMenuVisibilityListener(OnMenuVisibilityListener listener) { mMenuVisibilityListeners.add(listener); } Loading Loading @@ -361,6 +376,7 @@ public class ActionBarImpl extends ActionBar { mLowerContextView.setVisibility(View.VISIBLE); } mActionMode = mode; show(); return mode; } return null; Loading Loading @@ -487,6 +503,8 @@ public class ActionBarImpl extends ActionBar { return; } mContainerView.setVisibility(View.VISIBLE); if (mShowHideAnimationEnabled) { mContainerView.setAlpha(0); AnimatorSet anim = new AnimatorSet(); AnimatorSet.Builder b = anim.play(ObjectAnimator.ofFloat(mContainerView, "alpha", 1)); Loading @@ -499,6 +517,9 @@ public class ActionBarImpl extends ActionBar { anim.addListener(mShowListener); mCurrentAnim = anim; anim.start(); } else { mShowListener.onAnimationEnd(null); } } @Override Loading @@ -509,6 +530,8 @@ public class ActionBarImpl extends ActionBar { if (mContainerView.getVisibility() == View.GONE) { return; } if (mShowHideAnimationEnabled) { mContainerView.setAlpha(1); AnimatorSet anim = new AnimatorSet(); AnimatorSet.Builder b = anim.play(ObjectAnimator.ofFloat(mContainerView, "alpha", 0)); Loading @@ -521,6 +544,9 @@ public class ActionBarImpl extends ActionBar { anim.addListener(mHideListener); mCurrentAnim = anim; anim.start(); } else { mHideListener.onAnimationEnd(null); } } public boolean isShowing() { Loading Loading
core/java/android/app/Activity.java +2 −0 Original line number Diff line number Diff line Loading @@ -1073,6 +1073,7 @@ public class Activity extends ContextThemeWrapper protected void onPostResume() { final Window win = getWindow(); if (win != null) win.makeActive(); if (mActionBar != null) mActionBar.setShowHideAnimationEnabled(true); mCalled = true; } Loading Loading @@ -1325,6 +1326,7 @@ public class Activity extends ContextThemeWrapper * @see #onDestroy */ protected void onStop() { if (mActionBar != null) mActionBar.setShowHideAnimationEnabled(false); mCalled = true; } Loading
core/java/android/app/Dialog.java +2 −0 Original line number Diff line number Diff line Loading @@ -352,12 +352,14 @@ public class Dialog implements DialogInterface, Window.Callback, * Called when the dialog is starting. */ protected void onStart() { if (mActionBar != null) mActionBar.setShowHideAnimationEnabled(true); } /** * Called to tell you that you're stopping. */ protected void onStop() { if (mActionBar != null) mActionBar.setShowHideAnimationEnabled(false); } private static final String DIALOG_SHOWING_TAG = "android:dialogShowing"; Loading
core/java/com/android/internal/app/ActionBarImpl.java +49 −23 Original line number Diff line number Diff line Loading @@ -92,6 +92,7 @@ public class ActionBarImpl extends ActionBar { final Handler mHandler = new Handler(); private Animator mCurrentAnim; private boolean mShowHideAnimationEnabled; private static final TimeInterpolator sFadeOutInterpolator = new DecelerateInterpolator(); Loading Loading @@ -217,6 +218,20 @@ public class ActionBarImpl extends ActionBar { CONTEXT_DISPLAY_NORMAL : CONTEXT_DISPLAY_SPLIT; } /** * Enables or disables animation between show/hide states. * If animation is disabled using this method, animations in progress * will be finished. * * @param enabled true to animate, false to not animate. */ public void setShowHideAnimationEnabled(boolean enabled) { mShowHideAnimationEnabled = enabled; if (!enabled && mCurrentAnim != null) { mCurrentAnim.end(); } } public void addOnMenuVisibilityListener(OnMenuVisibilityListener listener) { mMenuVisibilityListeners.add(listener); } Loading Loading @@ -361,6 +376,7 @@ public class ActionBarImpl extends ActionBar { mLowerContextView.setVisibility(View.VISIBLE); } mActionMode = mode; show(); return mode; } return null; Loading Loading @@ -487,6 +503,8 @@ public class ActionBarImpl extends ActionBar { return; } mContainerView.setVisibility(View.VISIBLE); if (mShowHideAnimationEnabled) { mContainerView.setAlpha(0); AnimatorSet anim = new AnimatorSet(); AnimatorSet.Builder b = anim.play(ObjectAnimator.ofFloat(mContainerView, "alpha", 1)); Loading @@ -499,6 +517,9 @@ public class ActionBarImpl extends ActionBar { anim.addListener(mShowListener); mCurrentAnim = anim; anim.start(); } else { mShowListener.onAnimationEnd(null); } } @Override Loading @@ -509,6 +530,8 @@ public class ActionBarImpl extends ActionBar { if (mContainerView.getVisibility() == View.GONE) { return; } if (mShowHideAnimationEnabled) { mContainerView.setAlpha(1); AnimatorSet anim = new AnimatorSet(); AnimatorSet.Builder b = anim.play(ObjectAnimator.ofFloat(mContainerView, "alpha", 0)); Loading @@ -521,6 +544,9 @@ public class ActionBarImpl extends ActionBar { anim.addListener(mHideListener); mCurrentAnim = anim; anim.start(); } else { mHideListener.onAnimationEnd(null); } } public boolean isShowing() { Loading