Merge "Fixed a bug where the scrim could flash black when snoozing huns" into nyc-dev am: 7fc88ac214

am: c91da73326

* commit 'c91da7332696afc6fc3594cb9e090c2897109f49':
  Fixed a bug where the scrim could flash black when snoozing huns

Change-Id: I513c76ed5bf5e0a72aa7db1cdcf15043172d66de
This commit is contained in:
Selim Cinek
2016-05-23 19:38:49 +00:00
committed by android-build-merger

View File

@@ -322,6 +322,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
if (scrim instanceof ScrimView) {
float alpha2 = getDozeAlpha(scrim);
float alpha = 1 - (1 - alpha1) * (1 - alpha2);
alpha = Math.max(0, Math.min(1.0f, alpha));
((ScrimView) scrim).setScrimColor(Color.argb((int) (alpha * 255), 0, 0, 0));
} else {
scrim.setAlpha(alpha1);
@@ -468,6 +469,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
PropertyValuesHolder[] values = previousAnimator.getValues();
float relativeDiff = alpha - previousEndValue;
float newStartValue = previousStartValue + relativeDiff;
newStartValue = Math.max(0, Math.min(1.0f, newStartValue));
values[0].setFloatValues(newStartValue, alpha);
scrim.setTag(TAG_START_ALPHA, newStartValue);
scrim.setTag(TAG_END_ALPHA, alpha);