Merge "Move ripple to end state on jump when hardware exit is pending" into lmp-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
9a1b4c2967
@@ -214,7 +214,7 @@ class Ripple {
|
|||||||
final boolean canUseHardware = c.isHardwareAccelerated();
|
final boolean canUseHardware = c.isHardwareAccelerated();
|
||||||
if (mCanUseHardware != canUseHardware && mCanUseHardware) {
|
if (mCanUseHardware != canUseHardware && mCanUseHardware) {
|
||||||
// We've switched from hardware to non-hardware mode. Panic.
|
// We've switched from hardware to non-hardware mode. Panic.
|
||||||
cancelHardwareAnimations(true);
|
cancelHardwareAnimations(false);
|
||||||
}
|
}
|
||||||
mCanUseHardware = canUseHardware;
|
mCanUseHardware = canUseHardware;
|
||||||
|
|
||||||
@@ -493,7 +493,7 @@ class Ripple {
|
|||||||
public void cancel() {
|
public void cancel() {
|
||||||
mCanceled = true;
|
mCanceled = true;
|
||||||
cancelSoftwareAnimations();
|
cancelSoftwareAnimations();
|
||||||
cancelHardwareAnimations(true);
|
cancelHardwareAnimations(false);
|
||||||
mCanceled = false;
|
mCanceled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -522,15 +522,30 @@ class Ripple {
|
|||||||
/**
|
/**
|
||||||
* Cancels any running hardware animations.
|
* Cancels any running hardware animations.
|
||||||
*/
|
*/
|
||||||
private void cancelHardwareAnimations(boolean cancelPending) {
|
private void cancelHardwareAnimations(boolean jumpToEnd) {
|
||||||
final ArrayList<RenderNodeAnimator> runningAnimations = mRunningAnimations;
|
final ArrayList<RenderNodeAnimator> runningAnimations = mRunningAnimations;
|
||||||
final int N = runningAnimations.size();
|
final int N = runningAnimations.size();
|
||||||
for (int i = 0; i < N; i++) {
|
for (int i = 0; i < N; i++) {
|
||||||
|
if (jumpToEnd) {
|
||||||
|
runningAnimations.get(i).end();
|
||||||
|
} else {
|
||||||
runningAnimations.get(i).cancel();
|
runningAnimations.get(i).cancel();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
runningAnimations.clear();
|
runningAnimations.clear();
|
||||||
|
|
||||||
|
if (mHasPendingHardwareExit) {
|
||||||
|
// If we had a pending hardware exit, jump to the end state.
|
||||||
mHasPendingHardwareExit = false;
|
mHasPendingHardwareExit = false;
|
||||||
|
|
||||||
|
if (jumpToEnd) {
|
||||||
|
mOpacity = 0;
|
||||||
|
mTweenX = 1;
|
||||||
|
mTweenY = 1;
|
||||||
|
mTweenRadius = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mHardwareAnimating = false;
|
mHardwareAnimating = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ class RippleBackground {
|
|||||||
final boolean canUseHardware = c.isHardwareAccelerated();
|
final boolean canUseHardware = c.isHardwareAccelerated();
|
||||||
if (mCanUseHardware != canUseHardware && mCanUseHardware) {
|
if (mCanUseHardware != canUseHardware && mCanUseHardware) {
|
||||||
// We've switched from hardware to non-hardware mode. Panic.
|
// We've switched from hardware to non-hardware mode. Panic.
|
||||||
cancelHardwareAnimations(true);
|
cancelHardwareAnimations(false);
|
||||||
}
|
}
|
||||||
mCanUseHardware = canUseHardware;
|
mCanUseHardware = canUseHardware;
|
||||||
|
|
||||||
@@ -399,7 +399,7 @@ class RippleBackground {
|
|||||||
*/
|
*/
|
||||||
public void cancel() {
|
public void cancel() {
|
||||||
cancelSoftwareAnimations();
|
cancelSoftwareAnimations();
|
||||||
cancelHardwareAnimations(true);
|
cancelHardwareAnimations(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cancelSoftwareAnimations() {
|
private void cancelSoftwareAnimations() {
|
||||||
@@ -412,15 +412,27 @@ class RippleBackground {
|
|||||||
/**
|
/**
|
||||||
* Cancels any running hardware animations.
|
* Cancels any running hardware animations.
|
||||||
*/
|
*/
|
||||||
private void cancelHardwareAnimations(boolean cancelPending) {
|
private void cancelHardwareAnimations(boolean jumpToEnd) {
|
||||||
final ArrayList<RenderNodeAnimator> runningAnimations = mRunningAnimations;
|
final ArrayList<RenderNodeAnimator> runningAnimations = mRunningAnimations;
|
||||||
final int N = runningAnimations.size();
|
final int N = runningAnimations.size();
|
||||||
for (int i = 0; i < N; i++) {
|
for (int i = 0; i < N; i++) {
|
||||||
|
if (jumpToEnd) {
|
||||||
|
runningAnimations.get(i).end();
|
||||||
|
} else {
|
||||||
runningAnimations.get(i).cancel();
|
runningAnimations.get(i).cancel();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
runningAnimations.clear();
|
runningAnimations.clear();
|
||||||
|
|
||||||
|
if (mHasPendingHardwareExit) {
|
||||||
|
// If we had a pending hardware exit, jump to the end state.
|
||||||
mHasPendingHardwareExit = false;
|
mHasPendingHardwareExit = false;
|
||||||
|
|
||||||
|
if (jumpToEnd) {
|
||||||
|
mOuterOpacity = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mHardwareAnimating = false;
|
mHardwareAnimating = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user