Lockscreen shade transition: rename and split resources
There were two existing resource names that didn't reflect the their real usage, and have been renamed. The resources have also been split into multiple resources for easier fine tuning. Bug: 214946307 Test: Manually Change-Id: I7328e54c4b76d844327b5fd24b5de1afb2bb5904
This commit is contained in:
@@ -34,17 +34,44 @@
|
||||
<item name="controls_task_view_width_percentage" translatable="false" format="float" type="dimen">0.45</item>
|
||||
<dimen name="controls_task_view_right_margin">8dp</dimen>
|
||||
|
||||
<!-- Distance that the full shade transition takes in order for qs to fully transition to the
|
||||
shade -->
|
||||
<dimen name="lockscreen_shade_qs_transition_distance">200dp</dimen>
|
||||
<!-- Distance that the full shade transition takes in order to complete by tapping on a button
|
||||
like "expand". -->
|
||||
<dimen name="lockscreen_shade_transition_by_tap_distance">200dp</dimen>
|
||||
|
||||
<!-- Distance that the full shade transition takes in order to complete. -->
|
||||
<dimen name="lockscreen_shade_full_transition_distance">200dp</dimen>
|
||||
|
||||
<!-- Distance that the full shade transition takes in order for media to fully transition to
|
||||
the shade -->
|
||||
<dimen name="lockscreen_shade_media_transition_distance">200dp</dimen>
|
||||
|
||||
<!-- Distance that the full shade transition takes in order for scrim to fully transition to
|
||||
the shade (in alpha) -->
|
||||
<dimen name="lockscreen_shade_scrim_transition_distance">200dp</dimen>
|
||||
<dimen name="lockscreen_shade_scrim_transition_distance">@dimen/lockscreen_shade_full_transition_distance</dimen>
|
||||
|
||||
<!-- Distance that the full shade transition takes in order for media to fully transition to
|
||||
the shade -->
|
||||
<dimen name="lockscreen_shade_media_transition_distance">200dp</dimen>
|
||||
<!-- Distance that the full shade transition takes in order for the keyguard content on
|
||||
NotificationPanelViewController to fully fade (e.g. Clock & Smartspace) -->
|
||||
<dimen name="lockscreen_shade_npvc_keyguard_content_alpha_transition_distance">@dimen/lockscreen_shade_full_transition_distance</dimen>
|
||||
|
||||
<!-- Distance that the full shade transition takes in order for the notification shell to fully
|
||||
expand. -->
|
||||
<dimen name="lockscreen_shade_notif_shelf_transition_distance">@dimen/lockscreen_shade_full_transition_distance</dimen>
|
||||
|
||||
<!-- Distance that the full shade transition takes in order for the Quick Settings to fully
|
||||
fade and expand. -->
|
||||
<dimen name="lockscreen_shade_qs_transition_distance">@dimen/lockscreen_shade_full_transition_distance</dimen>
|
||||
|
||||
<!-- Distance that the full shade transition takes in order for depth of the wallpaper to fully
|
||||
change. -->
|
||||
<dimen name="lockscreen_shade_depth_controller_transition_distance">@dimen/lockscreen_shade_full_transition_distance</dimen>
|
||||
|
||||
<!-- Distance that the full shade transition takes in order for the UDFPS Keyguard View to fully
|
||||
fade. -->
|
||||
<dimen name="lockscreen_shade_udfps_keyguard_transition_distance">@dimen/lockscreen_shade_full_transition_distance</dimen>
|
||||
|
||||
<!-- Used for StatusBar to know that a transition is in progress. At the moment it only checks
|
||||
whether the progress is > 0, therefore this value is not very important. -->
|
||||
<dimen name="lockscreen_shade_status_bar_transition_distance">@dimen/lockscreen_shade_full_transition_distance</dimen>
|
||||
|
||||
<dimen name="notification_panel_margin_horizontal">12dp</dimen>
|
||||
</resources>
|
||||
|
||||
@@ -1122,13 +1122,40 @@
|
||||
<dimen name="media_output_dialog_title_anim_y_delta">12.5dp</dimen>
|
||||
<dimen name="media_output_dialog_app_tier_icon_size">20dp</dimen>
|
||||
|
||||
<!-- Distance that the full shade transition takes in order for qs to fully transition to the
|
||||
shade -->
|
||||
<dimen name="lockscreen_shade_qs_transition_distance">200dp</dimen>
|
||||
<!-- Distance that the full shade transition takes in order to complete by tapping on a button
|
||||
like "expand". -->
|
||||
<dimen name="lockscreen_shade_transition_by_tap_distance">200dp</dimen>
|
||||
|
||||
<!-- Distance that the full shade transition takes in order to complete. -->
|
||||
<dimen name="lockscreen_shade_full_transition_distance">80dp</dimen>
|
||||
|
||||
<!-- Distance that the full shade transition takes in order for scrim to fully transition to
|
||||
the shade (in alpha) -->
|
||||
<dimen name="lockscreen_shade_scrim_transition_distance">80dp</dimen>
|
||||
<dimen name="lockscreen_shade_scrim_transition_distance">@dimen/lockscreen_shade_full_transition_distance</dimen>
|
||||
|
||||
<!-- Distance that the full shade transition takes in order for the keyguard content on
|
||||
NotificationPanelViewController to fully fade (e.g. Clock & Smartspace) -->
|
||||
<dimen name="lockscreen_shade_npvc_keyguard_content_alpha_transition_distance">@dimen/lockscreen_shade_full_transition_distance</dimen>
|
||||
|
||||
<!-- Distance that the full shade transition takes in order for the notification shelf to fully
|
||||
expand. -->
|
||||
<dimen name="lockscreen_shade_notif_shelf_transition_distance">@dimen/lockscreen_shade_full_transition_distance</dimen>
|
||||
|
||||
<!-- Distance that the full shade transition takes in order for the Quick Settings to fully
|
||||
fade and expand. -->
|
||||
<dimen name="lockscreen_shade_qs_transition_distance">@dimen/lockscreen_shade_full_transition_distance</dimen>
|
||||
|
||||
<!-- Distance that the full shade transition takes in order for depth of the wallpaper to fully
|
||||
change. -->
|
||||
<dimen name="lockscreen_shade_depth_controller_transition_distance">@dimen/lockscreen_shade_full_transition_distance</dimen>
|
||||
|
||||
<!-- Distance that the full shade transition takes in order for the UDFPS Keyguard View to fully
|
||||
fade. -->
|
||||
<dimen name="lockscreen_shade_udfps_keyguard_transition_distance">@dimen/lockscreen_shade_full_transition_distance</dimen>
|
||||
|
||||
<!-- Used for StatusBar to know that a transition is in progress. At the moment it only checks
|
||||
whether the progress is > 0, therefore this value is not very important. -->
|
||||
<dimen name="lockscreen_shade_status_bar_transition_distance">@dimen/lockscreen_shade_full_transition_distance</dimen>
|
||||
|
||||
<!-- Distance that the full shade transition takes in order for media to fully transition to
|
||||
the shade -->
|
||||
|
||||
@@ -99,15 +99,57 @@ class LockscreenShadeTransitionController @Inject constructor(
|
||||
internal var pulseHeightAnimator: ValueAnimator? = null
|
||||
|
||||
/**
|
||||
* Distance that the full shade transition takes in order for scrim to fully transition to
|
||||
* the shade (in alpha)
|
||||
* Distance that the full shade transition takes in order to complete.
|
||||
*/
|
||||
private var fullTransitionDistance = 0
|
||||
|
||||
/**
|
||||
* Distance that the full transition takes in order for us to fully transition to the shade by
|
||||
* tapping on a button, such as "expand".
|
||||
*/
|
||||
private var fullTransitionDistanceByTap = 0
|
||||
|
||||
/**
|
||||
* Distance that the full shade transition takes in order for scrim to fully transition to the
|
||||
* shade (in alpha)
|
||||
*/
|
||||
private var scrimTransitionDistance = 0
|
||||
|
||||
/**
|
||||
* Distance that the full transition takes in order for us to fully transition to the shade
|
||||
* Distance that the full shade transition takes in order for the notification shelf to fully
|
||||
* expand.
|
||||
*/
|
||||
private var fullTransitionDistance = 0
|
||||
private var notificationShelfTransitionDistance = 0
|
||||
|
||||
/**
|
||||
* Distance that the full shade transition takes in order for the Quick Settings to fully fade
|
||||
* and expand.
|
||||
*/
|
||||
private var qsTransitionDistance = 0
|
||||
|
||||
/**
|
||||
* Distance that the full shade transition takes in order for the keyguard content on
|
||||
* NotificationPanelViewController to fully fade (e.g. Clock & Smartspace).
|
||||
*/
|
||||
private var npvcKeyguardContentAlphaTransitionDistance = 0
|
||||
|
||||
/**
|
||||
* Distance that the full shade transition takes in order for depth of the wallpaper to fully
|
||||
* change.
|
||||
*/
|
||||
private var depthControllerTransitionDistance = 0
|
||||
|
||||
/**
|
||||
* Distance that the full shade transition takes in order for the UDFPS Keyguard View to fully
|
||||
* fade.
|
||||
*/
|
||||
private var udfpsTransitionDistance = 0
|
||||
|
||||
/**
|
||||
* Used for StatusBar to know that a transition is in progress. At the moment it only checks
|
||||
* whether the progress is > 0, therefore this value is not very important.
|
||||
*/
|
||||
private var statusBarTransitionDistance = 0
|
||||
|
||||
/**
|
||||
* Flag to make sure that the dragDownAmount is applied to the listeners even when in the
|
||||
@@ -130,7 +172,7 @@ class LockscreenShadeTransitionController @Inject constructor(
|
||||
* The distance until we're showing the notifications when pulsing
|
||||
*/
|
||||
val distanceUntilShowingPulsingNotifications
|
||||
get() = scrimTransitionDistance
|
||||
get() = fullTransitionDistance
|
||||
|
||||
/**
|
||||
* The udfpsKeyguardViewController if it exists.
|
||||
@@ -177,10 +219,24 @@ class LockscreenShadeTransitionController @Inject constructor(
|
||||
}
|
||||
|
||||
private fun updateResources() {
|
||||
fullTransitionDistance = context.resources.getDimensionPixelSize(
|
||||
R.dimen.lockscreen_shade_full_transition_distance)
|
||||
fullTransitionDistanceByTap = context.resources.getDimensionPixelSize(
|
||||
R.dimen.lockscreen_shade_transition_by_tap_distance)
|
||||
scrimTransitionDistance = context.resources.getDimensionPixelSize(
|
||||
R.dimen.lockscreen_shade_scrim_transition_distance)
|
||||
fullTransitionDistance = context.resources.getDimensionPixelSize(
|
||||
notificationShelfTransitionDistance = context.resources.getDimensionPixelSize(
|
||||
R.dimen.lockscreen_shade_notif_shelf_transition_distance)
|
||||
qsTransitionDistance = context.resources.getDimensionPixelSize(
|
||||
R.dimen.lockscreen_shade_qs_transition_distance)
|
||||
npvcKeyguardContentAlphaTransitionDistance = context.resources.getDimensionPixelSize(
|
||||
R.dimen.lockscreen_shade_npvc_keyguard_content_alpha_transition_distance)
|
||||
depthControllerTransitionDistance = context.resources.getDimensionPixelSize(
|
||||
R.dimen.lockscreen_shade_depth_controller_transition_distance)
|
||||
udfpsTransitionDistance = context.resources.getDimensionPixelSize(
|
||||
R.dimen.lockscreen_shade_udfps_keyguard_transition_distance)
|
||||
statusBarTransitionDistance = context.resources.getDimensionPixelSize(
|
||||
R.dimen.lockscreen_shade_status_bar_transition_distance)
|
||||
useSplitShade = Utils.shouldUseSplitNotificationShade(context.resources)
|
||||
}
|
||||
|
||||
@@ -337,11 +393,16 @@ class LockscreenShadeTransitionController @Inject constructor(
|
||||
if (field != value || forceApplyAmount) {
|
||||
field = value
|
||||
if (!nsslController.isInLockedDownShade() || field == 0f || forceApplyAmount) {
|
||||
qSDragProgress = MathUtils.saturate(dragDownAmount / scrimTransitionDistance)
|
||||
nsslController.setTransitionToFullShadeAmount(field, qSDragProgress)
|
||||
val notificationShelfProgress =
|
||||
MathUtils.saturate(dragDownAmount / notificationShelfTransitionDistance)
|
||||
nsslController.setTransitionToFullShadeAmount(field, notificationShelfProgress)
|
||||
|
||||
qSDragProgress = MathUtils.saturate(dragDownAmount / qsTransitionDistance)
|
||||
qS.setTransitionToFullShadeAmount(field, qSDragProgress)
|
||||
|
||||
notificationPanelController.setTransitionToFullShadeAmount(field,
|
||||
false /* animate */, 0 /* delay */)
|
||||
|
||||
mediaHierarchyManager.setTransitionToFullShadeAmount(field)
|
||||
transitionToShadeAmountCommon(field)
|
||||
}
|
||||
@@ -357,11 +418,20 @@ class LockscreenShadeTransitionController @Inject constructor(
|
||||
private fun transitionToShadeAmountCommon(dragDownAmount: Float) {
|
||||
val scrimProgress = MathUtils.saturate(dragDownAmount / scrimTransitionDistance)
|
||||
scrimController.setTransitionToFullShadeProgress(scrimProgress)
|
||||
|
||||
// Fade out all content only visible on the lockscreen
|
||||
notificationPanelController.setKeyguardOnlyContentAlpha(1.0f - scrimProgress)
|
||||
depthController.transitionToFullShadeProgress = scrimProgress
|
||||
udfpsKeyguardViewController?.setTransitionToFullShadeProgress(scrimProgress)
|
||||
centralSurfaces.setTransitionToFullShadeProgress(scrimProgress)
|
||||
val npvcProgress =
|
||||
MathUtils.saturate(dragDownAmount / npvcKeyguardContentAlphaTransitionDistance)
|
||||
notificationPanelController.setKeyguardOnlyContentAlpha(1.0f - npvcProgress)
|
||||
|
||||
val depthProgress = MathUtils.saturate(dragDownAmount / depthControllerTransitionDistance)
|
||||
depthController.transitionToFullShadeProgress = depthProgress
|
||||
|
||||
val udfpsProgress = MathUtils.saturate(dragDownAmount / udfpsTransitionDistance)
|
||||
udfpsKeyguardViewController?.setTransitionToFullShadeProgress(udfpsProgress)
|
||||
|
||||
val statusBarProgress = MathUtils.saturate(dragDownAmount / statusBarTransitionDistance)
|
||||
centralSurfaces.setTransitionToFullShadeProgress(statusBarProgress)
|
||||
}
|
||||
|
||||
private fun setDragDownAmountAnimated(
|
||||
@@ -404,7 +474,7 @@ class LockscreenShadeTransitionController @Inject constructor(
|
||||
// be a couple of frames later. if we're setting it to 0, it will use the
|
||||
// default inset and therefore flicker
|
||||
dragDownAmount = 1f
|
||||
setDragDownAmountAnimated(fullTransitionDistance.toFloat(), delay = delay) {
|
||||
setDragDownAmountAnimated(fullTransitionDistanceByTap.toFloat(), delay = delay) {
|
||||
// End listener:
|
||||
// Reset
|
||||
dragDownAmount = 0f
|
||||
|
||||
Reference in New Issue
Block a user