Merge "Fixed an issue where the lockscreen could be all white" into oc-dr1-dev

This commit is contained in:
TreeHugger Robot
2017-07-06 14:32:53 +00:00
committed by Android (Google) Code Review
2 changed files with 9 additions and 19 deletions

View File

@@ -168,8 +168,7 @@ public class KeyguardAffordanceHelper {
distance = mTranslationOnDown + distance; distance = mTranslationOnDown + distance;
distance = Math.max(0, distance); distance = Math.max(0, distance);
} }
setTranslation(distance, false /* isReset */, false /* animateReset */, setTranslation(distance, false /* isReset */, false /* animateReset */);
false /* force */);
} }
break; break;
@@ -374,12 +373,11 @@ public class KeyguardAffordanceHelper {
targetView.finishAnimation(velocity, mAnimationEndRunnable); targetView.finishAnimation(velocity, mAnimationEndRunnable);
} }
private void setTranslation(float translation, boolean isReset, boolean animateReset, private void setTranslation(float translation, boolean isReset, boolean animateReset) {
boolean force) {
translation = rightSwipePossible() ? translation : Math.max(0, translation); translation = rightSwipePossible() ? translation : Math.max(0, translation);
translation = leftSwipePossible() ? translation : Math.min(0, translation); translation = leftSwipePossible() ? translation : Math.min(0, translation);
float absTranslation = Math.abs(translation); float absTranslation = Math.abs(translation);
if (translation != mTranslation || isReset || force) { if (translation != mTranslation || isReset) {
KeyguardAffordanceView targetView = translation > 0 ? mLeftIcon : mRightIcon; KeyguardAffordanceView targetView = translation > 0 ? mLeftIcon : mRightIcon;
KeyguardAffordanceView otherView = translation > 0 ? mRightIcon : mLeftIcon; KeyguardAffordanceView otherView = translation > 0 ? mRightIcon : mLeftIcon;
float alpha = absTranslation / getMinTranslationAmount(); float alpha = absTranslation / getMinTranslationAmount();
@@ -394,15 +392,15 @@ public class KeyguardAffordanceHelper {
boolean slowAnimation = isReset && isBelowFalsingThreshold(); boolean slowAnimation = isReset && isBelowFalsingThreshold();
if (!isReset) { if (!isReset) {
updateIcon(targetView, radius, alpha + fadeOutAlpha * targetView.getRestingAlpha(), updateIcon(targetView, radius, alpha + fadeOutAlpha * targetView.getRestingAlpha(),
false, false, force, false); false, false, false, false);
} else { } else {
updateIcon(targetView, 0.0f, fadeOutAlpha * targetView.getRestingAlpha(), updateIcon(targetView, 0.0f, fadeOutAlpha * targetView.getRestingAlpha(),
animateIcons, slowAnimation, force, forceNoCircleAnimation); animateIcons, slowAnimation, true /* isReset */, forceNoCircleAnimation);
} }
updateIcon(otherView, 0.0f, fadeOutAlpha * otherView.getRestingAlpha(), updateIcon(otherView, 0.0f, fadeOutAlpha * otherView.getRestingAlpha(),
animateIcons, slowAnimation, force, forceNoCircleAnimation); animateIcons, slowAnimation, isReset, forceNoCircleAnimation);
updateIcon(mCenterIcon, 0.0f, fadeOutAlpha * mCenterIcon.getRestingAlpha(), updateIcon(mCenterIcon, 0.0f, fadeOutAlpha * mCenterIcon.getRestingAlpha(),
animateIcons, slowAnimation, force, forceNoCircleAnimation); animateIcons, slowAnimation, isReset, forceNoCircleAnimation);
mTranslation = translation; mTranslation = translation;
} }
@@ -510,12 +508,8 @@ public class KeyguardAffordanceHelper {
} }
public void reset(boolean animate) { public void reset(boolean animate) {
reset(animate, false /* force */);
}
public void reset(boolean animate, boolean force) {
cancelAnimation(); cancelAnimation();
setTranslation(0.0f, true, animate, force); setTranslation(0.0f, true /* isReset */, animate);
mMotionCancelled = true; mMotionCancelled = true;
if (mSwipingInProgress) { if (mSwipingInProgress) {
mCallback.onSwipingAborted(); mCallback.onSwipingAborted();
@@ -523,10 +517,6 @@ public class KeyguardAffordanceHelper {
} }
} }
public void resetImmediately() {
reset(false /* animate */, true /* force */);
}
public boolean isSwipingInProgress() { public boolean isSwipingInProgress() {
return mSwipingInProgress; return mSwipingInProgress;
} }

View File

@@ -2573,7 +2573,7 @@ public class NotificationPanelView extends PanelView implements
public void setTouchDisabled(boolean disabled) { public void setTouchDisabled(boolean disabled) {
super.setTouchDisabled(disabled); super.setTouchDisabled(disabled);
if (disabled && mAffordanceHelper.isSwipingInProgress() && !mIsLaunchTransitionRunning) { if (disabled && mAffordanceHelper.isSwipingInProgress() && !mIsLaunchTransitionRunning) {
mAffordanceHelper.resetImmediately(); mAffordanceHelper.reset(false /* animate */);
} }
} }