Fix action mode animation on recreations - framework edition
am: e65b3fbb63
* commit 'e65b3fbb63b4b6937fede2e4b889c0a51a881358':
Fix action mode animation on recreations - framework edition
Change-Id: I19274b7ede1fae09deb915807c35a478caf939ee
This commit is contained in:
@@ -873,6 +873,7 @@ public class WindowDecorActionBar extends ActionBar implements
|
|||||||
hideForActionMode();
|
hideForActionMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (shouldAnimateContextView()) {
|
||||||
Animator fadeIn, fadeOut;
|
Animator fadeIn, fadeOut;
|
||||||
if (toActionMode) {
|
if (toActionMode) {
|
||||||
fadeOut = mDecorToolbar.setupAnimatorToVisibility(View.GONE,
|
fadeOut = mDecorToolbar.setupAnimatorToVisibility(View.GONE,
|
||||||
@@ -888,9 +889,24 @@ public class WindowDecorActionBar extends ActionBar implements
|
|||||||
AnimatorSet set = new AnimatorSet();
|
AnimatorSet set = new AnimatorSet();
|
||||||
set.playSequentially(fadeOut, fadeIn);
|
set.playSequentially(fadeOut, fadeIn);
|
||||||
set.start();
|
set.start();
|
||||||
|
} else {
|
||||||
|
if (toActionMode) {
|
||||||
|
mDecorToolbar.setVisibility(View.GONE);
|
||||||
|
mContextView.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
mDecorToolbar.setVisibility(View.VISIBLE);
|
||||||
|
mContextView.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
// mTabScrollView's visibility is not affected by action mode.
|
// mTabScrollView's visibility is not affected by action mode.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean shouldAnimateContextView() {
|
||||||
|
// We only to animate the action mode in if the container view has already been laid out.
|
||||||
|
// If it hasn't been laid out, it hasn't been drawn to screen yet.
|
||||||
|
return mContainerView.isLaidOut();
|
||||||
|
}
|
||||||
|
|
||||||
public Context getThemedContext() {
|
public Context getThemedContext() {
|
||||||
if (mThemedContext == null) {
|
if (mThemedContext == null) {
|
||||||
TypedValue outValue = new TypedValue();
|
TypedValue outValue = new TypedValue();
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import com.android.internal.widget.FloatingToolbar;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import android.animation.Animator;
|
import android.animation.Animator;
|
||||||
|
import android.animation.AnimatorListenerAdapter;
|
||||||
import android.animation.ObjectAnimator;
|
import android.animation.ObjectAnimator;
|
||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -1588,9 +1589,11 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
|
|||||||
mPrimaryActionModeView.getApplicationWindowToken(),
|
mPrimaryActionModeView.getApplicationWindowToken(),
|
||||||
Gravity.TOP | Gravity.FILL_HORIZONTAL, 0, 0);
|
Gravity.TOP | Gravity.FILL_HORIZONTAL, 0, 0);
|
||||||
endOnGoingFadeAnimation();
|
endOnGoingFadeAnimation();
|
||||||
|
|
||||||
|
if (shouldAnimatePrimaryActionModeView()) {
|
||||||
mFadeAnim = ObjectAnimator.ofFloat(mPrimaryActionModeView, View.ALPHA,
|
mFadeAnim = ObjectAnimator.ofFloat(mPrimaryActionModeView, View.ALPHA,
|
||||||
0f, 1f);
|
0f, 1f);
|
||||||
mFadeAnim.addListener(new Animator.AnimatorListener() {
|
mFadeAnim.addListener(new AnimatorListenerAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationStart(Animator animation) {
|
public void onAnimationStart(Animator animation) {
|
||||||
mPrimaryActionModeView.setVisibility(VISIBLE);
|
mPrimaryActionModeView.setVisibility(VISIBLE);
|
||||||
@@ -1601,18 +1604,12 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
|
|||||||
mPrimaryActionModeView.setAlpha(1f);
|
mPrimaryActionModeView.setAlpha(1f);
|
||||||
mFadeAnim = null;
|
mFadeAnim = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAnimationCancel(Animator animation) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAnimationRepeat(Animator animation) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
mFadeAnim.start();
|
mFadeAnim.start();
|
||||||
|
} else {
|
||||||
|
mPrimaryActionModeView.setAlpha(1f);
|
||||||
|
mPrimaryActionModeView.setVisibility(VISIBLE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
@@ -1646,8 +1643,9 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
|
|||||||
if (mPrimaryActionModePopup != null) {
|
if (mPrimaryActionModePopup != null) {
|
||||||
post(mShowPrimaryActionModePopup);
|
post(mShowPrimaryActionModePopup);
|
||||||
} else {
|
} else {
|
||||||
|
if (shouldAnimatePrimaryActionModeView()) {
|
||||||
mFadeAnim = ObjectAnimator.ofFloat(mPrimaryActionModeView, View.ALPHA, 0f, 1f);
|
mFadeAnim = ObjectAnimator.ofFloat(mPrimaryActionModeView, View.ALPHA, 0f, 1f);
|
||||||
mFadeAnim.addListener(new Animator.AnimatorListener() {
|
mFadeAnim.addListener(new AnimatorListenerAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationStart(Animator animation) {
|
public void onAnimationStart(Animator animation) {
|
||||||
mPrimaryActionModeView.setVisibility(View.VISIBLE);
|
mPrimaryActionModeView.setVisibility(View.VISIBLE);
|
||||||
@@ -1658,23 +1656,23 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
|
|||||||
mPrimaryActionModeView.setAlpha(1f);
|
mPrimaryActionModeView.setAlpha(1f);
|
||||||
mFadeAnim = null;
|
mFadeAnim = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAnimationCancel(Animator animation) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAnimationRepeat(Animator animation) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
mFadeAnim.start();
|
mFadeAnim.start();
|
||||||
|
} else {
|
||||||
|
mPrimaryActionModeView.setAlpha(1f);
|
||||||
|
mPrimaryActionModeView.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
mPrimaryActionModeView.sendAccessibilityEvent(
|
mPrimaryActionModeView.sendAccessibilityEvent(
|
||||||
AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
|
AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean shouldAnimatePrimaryActionModeView() {
|
||||||
|
// We only to animate the action mode in if the decor has already been laid out.
|
||||||
|
// If it hasn't been laid out, it hasn't been drawn to screen yet.
|
||||||
|
return isLaidOut();
|
||||||
|
}
|
||||||
|
|
||||||
private ActionMode createFloatingActionMode(
|
private ActionMode createFloatingActionMode(
|
||||||
View originatingView, ActionMode.Callback2 callback) {
|
View originatingView, ActionMode.Callback2 callback) {
|
||||||
if (mFloatingActionMode != null) {
|
if (mFloatingActionMode != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user