Merge "Avoid overlap when fading notifications in" into sc-dev
This commit is contained in:
@@ -99,8 +99,10 @@ public class Interpolators {
|
||||
* @param forNotification If we want the alpha of the notification shade or the scrim.
|
||||
*/
|
||||
public static float getNotificationScrimAlpha(float fraction, boolean forNotification) {
|
||||
if (!forNotification) {
|
||||
fraction = MathUtils.saturate(1.7f * fraction);
|
||||
if (forNotification) {
|
||||
fraction = MathUtils.constrainedMap(0f, 1f, 0.3f, 1f, fraction);
|
||||
} else {
|
||||
fraction = MathUtils.constrainedMap(0f, 1f, 0f, 0.5f, fraction);
|
||||
}
|
||||
fraction = fraction * 1.2f - 0.2f;
|
||||
if (fraction <= 0) {
|
||||
|
||||
@@ -587,7 +587,7 @@ public class ScrimControllerTest extends SysuiTestCase {
|
||||
));
|
||||
|
||||
// Back scrim should be visible after start dragging
|
||||
mScrimController.setPanelExpansion(0.5f);
|
||||
mScrimController.setPanelExpansion(0.3f);
|
||||
assertScrimAlpha(Map.of(
|
||||
mScrimInFront, TRANSPARENT,
|
||||
mNotificationsScrim, SEMI_TRANSPARENT,
|
||||
@@ -1049,7 +1049,7 @@ public class ScrimControllerTest extends SysuiTestCase {
|
||||
@Test
|
||||
public void testScrimsVisible_whenShadeVisible() {
|
||||
mScrimController.transitionTo(ScrimState.UNLOCKED);
|
||||
mScrimController.setPanelExpansion(0.5f);
|
||||
mScrimController.setPanelExpansion(0.3f);
|
||||
// notifications scrim alpha change require calling setQsPosition
|
||||
mScrimController.setQsPosition(0, 300);
|
||||
finishAnimationsImmediately();
|
||||
@@ -1064,7 +1064,7 @@ public class ScrimControllerTest extends SysuiTestCase {
|
||||
public void testScrimsVisible_whenShadeVisible_clippingQs() {
|
||||
mScrimController.setClipsQsScrim(true);
|
||||
mScrimController.transitionTo(ScrimState.UNLOCKED);
|
||||
mScrimController.setPanelExpansion(0.5f);
|
||||
mScrimController.setPanelExpansion(0.3f);
|
||||
// notifications scrim alpha change require calling setQsPosition
|
||||
mScrimController.setQsPosition(0.5f, 300);
|
||||
finishAnimationsImmediately();
|
||||
@@ -1114,7 +1114,7 @@ public class ScrimControllerTest extends SysuiTestCase {
|
||||
mScrimController.transitionTo(ScrimState.SHADE_LOCKED);
|
||||
|
||||
assertAlphaAfterExpansion(mNotificationsScrim, /* alpha */ 0.8f, /* expansion */ 0.8f);
|
||||
assertAlphaAfterExpansion(mNotificationsScrim, /* alpha */ 0.2f, /* expansion */ 0.2f);
|
||||
assertAlphaAfterExpansion(mNotificationsScrim, /* alpha */ 0.47f, /* expansion */ 0.2f);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -1122,7 +1122,7 @@ public class ScrimControllerTest extends SysuiTestCase {
|
||||
mScrimController.transitionTo(ScrimState.KEYGUARD);
|
||||
|
||||
assertAlphaAfterExpansion(mNotificationsScrim, /* alpha */ 0.2f, /* expansion */ 0.4f);
|
||||
assertAlphaAfterExpansion(mNotificationsScrim, /* alpha */ 0.8f, /* expansion */ 0.2f);
|
||||
assertAlphaAfterExpansion(mNotificationsScrim, /* alpha */ 0.52f, /* expansion */ 0.2f);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user