Loading packages/SystemUI/src/com/android/systemui/statusbar/LightRevealScrim.kt +30 −2 Original line number Diff line number Diff line Loading @@ -178,7 +178,10 @@ class PowerButtonReveal( */ class LightRevealScrim(context: Context?, attrs: AttributeSet?) : View(context, attrs) { lateinit var revealAmountListener: Consumer<Float> /** * Listener that is called if the scrim's opaqueness changes */ lateinit var isScrimOpaqueChangedListener: Consumer<Boolean> /** * How much of the underlying views are revealed, in percent. 0 means they will be completely Loading @@ -190,7 +193,7 @@ class LightRevealScrim(context: Context?, attrs: AttributeSet?) : View(context, field = value revealEffect.setRevealAmountOnScrim(value, this) revealAmountListener.accept(value) updateScrimOpaque() invalidate() } } Loading Loading @@ -229,6 +232,31 @@ class LightRevealScrim(context: Context?, attrs: AttributeSet?) : View(context, } } /** * Is the scrim currently fully opaque */ var isScrimOpaque = false private set(value) { if (field != value) { field = value isScrimOpaqueChangedListener.accept(field) } } private fun updateScrimOpaque() { isScrimOpaque = revealAmount == 0.0f && alpha == 1.0f && visibility == VISIBLE } override fun setAlpha(alpha: Float) { super.setAlpha(alpha) updateScrimOpaque() } override fun setVisibility(visibility: Int) { super.setVisibility(visibility) updateScrimOpaque() } /** * Paint used to draw a transparent-to-white radial gradient. This will be scaled and translated * via local matrix in [onDraw] so we never need to construct a new shader. Loading packages/SystemUI/src/com/android/systemui/statusbar/NotificationShadeWindowController.java +3 −3 Original line number Diff line number Diff line Loading @@ -182,10 +182,10 @@ public interface NotificationShadeWindowController extends RemoteInputController default void setFaceAuthDisplayBrightness(float brightness) {} /** * How much {@link LightRevealScrim} obscures the UI. * @param amount 0 when opaque, 1 when not transparent * If {@link LightRevealScrim} obscures the UI. * @param opaque if the scrim is opaque */ default void setLightRevealScrimAmount(float amount) {} default void setLightRevealScrimOpaque(boolean opaque) {} /** * Custom listener to pipe data back to plugins about whether or not the status bar would be Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowControllerImpl.java +3 −4 Original line number Diff line number Diff line Loading @@ -606,12 +606,11 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW } @Override public void setLightRevealScrimAmount(float amount) { boolean lightRevealScrimOpaque = amount == 0; if (mCurrentState.mLightRevealScrimOpaque == lightRevealScrimOpaque) { public void setLightRevealScrimOpaque(boolean opaque) { if (mCurrentState.mLightRevealScrimOpaque == opaque) { return; } mCurrentState.mLightRevealScrimOpaque = lightRevealScrimOpaque; mCurrentState.mLightRevealScrimOpaque = opaque; apply(mCurrentState); } Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +13 −2 Original line number Diff line number Diff line Loading @@ -1257,8 +1257,19 @@ public class StatusBar extends SystemUI implements mScrimController.attachViews(scrimBehind, notificationsScrim, scrimInFront); mLightRevealScrim = mNotificationShadeWindowView.findViewById(R.id.light_reveal_scrim); mLightRevealScrim.setRevealAmountListener( mNotificationShadeWindowController::setLightRevealScrimAmount); mLightRevealScrim.setScrimOpaqueChangedListener((opaque) -> { Runnable updateOpaqueness = () -> { mNotificationShadeWindowController.setLightRevealScrimOpaque( mLightRevealScrim.isScrimOpaque()); }; if (opaque) { // Delay making the view opaque for a frame, because it needs some time to render // otherwise this can lead to a flicker where the scrim doesn't cover the screen mLightRevealScrim.post(updateOpaqueness); } else { updateOpaqueness.run(); } }); mUnlockedScreenOffAnimationController.initialize(this, mLightRevealScrim); updateLightRevealScrimVisibility(); Loading packages/SystemUI/src/com/android/systemui/unfold/UnfoldLightRevealOverlayAnimation.kt +1 −1 Original line number Diff line number Diff line Loading @@ -92,7 +92,7 @@ class UnfoldLightRevealOverlayAnimation @Inject constructor( val newScrimView = LightRevealScrim(context, null) .apply { revealEffect = LinearLightRevealEffect(isVerticalFold) revealAmountListener = Consumer {} isScrimOpaqueChangedListener = Consumer {} revealAmount = 0f } Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/LightRevealScrim.kt +30 −2 Original line number Diff line number Diff line Loading @@ -178,7 +178,10 @@ class PowerButtonReveal( */ class LightRevealScrim(context: Context?, attrs: AttributeSet?) : View(context, attrs) { lateinit var revealAmountListener: Consumer<Float> /** * Listener that is called if the scrim's opaqueness changes */ lateinit var isScrimOpaqueChangedListener: Consumer<Boolean> /** * How much of the underlying views are revealed, in percent. 0 means they will be completely Loading @@ -190,7 +193,7 @@ class LightRevealScrim(context: Context?, attrs: AttributeSet?) : View(context, field = value revealEffect.setRevealAmountOnScrim(value, this) revealAmountListener.accept(value) updateScrimOpaque() invalidate() } } Loading Loading @@ -229,6 +232,31 @@ class LightRevealScrim(context: Context?, attrs: AttributeSet?) : View(context, } } /** * Is the scrim currently fully opaque */ var isScrimOpaque = false private set(value) { if (field != value) { field = value isScrimOpaqueChangedListener.accept(field) } } private fun updateScrimOpaque() { isScrimOpaque = revealAmount == 0.0f && alpha == 1.0f && visibility == VISIBLE } override fun setAlpha(alpha: Float) { super.setAlpha(alpha) updateScrimOpaque() } override fun setVisibility(visibility: Int) { super.setVisibility(visibility) updateScrimOpaque() } /** * Paint used to draw a transparent-to-white radial gradient. This will be scaled and translated * via local matrix in [onDraw] so we never need to construct a new shader. Loading
packages/SystemUI/src/com/android/systemui/statusbar/NotificationShadeWindowController.java +3 −3 Original line number Diff line number Diff line Loading @@ -182,10 +182,10 @@ public interface NotificationShadeWindowController extends RemoteInputController default void setFaceAuthDisplayBrightness(float brightness) {} /** * How much {@link LightRevealScrim} obscures the UI. * @param amount 0 when opaque, 1 when not transparent * If {@link LightRevealScrim} obscures the UI. * @param opaque if the scrim is opaque */ default void setLightRevealScrimAmount(float amount) {} default void setLightRevealScrimOpaque(boolean opaque) {} /** * Custom listener to pipe data back to plugins about whether or not the status bar would be Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowControllerImpl.java +3 −4 Original line number Diff line number Diff line Loading @@ -606,12 +606,11 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW } @Override public void setLightRevealScrimAmount(float amount) { boolean lightRevealScrimOpaque = amount == 0; if (mCurrentState.mLightRevealScrimOpaque == lightRevealScrimOpaque) { public void setLightRevealScrimOpaque(boolean opaque) { if (mCurrentState.mLightRevealScrimOpaque == opaque) { return; } mCurrentState.mLightRevealScrimOpaque = lightRevealScrimOpaque; mCurrentState.mLightRevealScrimOpaque = opaque; apply(mCurrentState); } Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +13 −2 Original line number Diff line number Diff line Loading @@ -1257,8 +1257,19 @@ public class StatusBar extends SystemUI implements mScrimController.attachViews(scrimBehind, notificationsScrim, scrimInFront); mLightRevealScrim = mNotificationShadeWindowView.findViewById(R.id.light_reveal_scrim); mLightRevealScrim.setRevealAmountListener( mNotificationShadeWindowController::setLightRevealScrimAmount); mLightRevealScrim.setScrimOpaqueChangedListener((opaque) -> { Runnable updateOpaqueness = () -> { mNotificationShadeWindowController.setLightRevealScrimOpaque( mLightRevealScrim.isScrimOpaque()); }; if (opaque) { // Delay making the view opaque for a frame, because it needs some time to render // otherwise this can lead to a flicker where the scrim doesn't cover the screen mLightRevealScrim.post(updateOpaqueness); } else { updateOpaqueness.run(); } }); mUnlockedScreenOffAnimationController.initialize(this, mLightRevealScrim); updateLightRevealScrimVisibility(); Loading
packages/SystemUI/src/com/android/systemui/unfold/UnfoldLightRevealOverlayAnimation.kt +1 −1 Original line number Diff line number Diff line Loading @@ -92,7 +92,7 @@ class UnfoldLightRevealOverlayAnimation @Inject constructor( val newScrimView = LightRevealScrim(context, null) .apply { revealEffect = LinearLightRevealEffect(isVerticalFold) revealAmountListener = Consumer {} isScrimOpaqueChangedListener = Consumer {} revealAmount = 0f } Loading