Loading packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/transitions/ClockSizeTransition.kt +28 −17 Original line number Original line Diff line number Diff line Loading @@ -57,9 +57,9 @@ class ClockSizeTransition( addTransition(SmartspaceMoveTransition(config, clockViewModel)) addTransition(SmartspaceMoveTransition(config, clockViewModel)) } } open class VisibilityBoundsTransition() : Transition() { abstract class VisibilityBoundsTransition() : Transition() { var captureSmartspace: Boolean = false abstract val captureSmartspace: Boolean protected val TAG = this::class.simpleName!! override fun captureEndValues(transition: TransitionValues) = captureValues(transition) override fun captureEndValues(transition: TransitionValues) = captureValues(transition) override fun captureStartValues(transition: TransitionValues) = captureValues(transition) override fun captureStartValues(transition: TransitionValues) = captureValues(transition) override fun getTransitionProperties(): Array<String> = TRANSITION_PROPERTIES override fun getTransitionProperties(): Array<String> = TRANSITION_PROPERTIES Loading @@ -76,7 +76,7 @@ class ClockSizeTransition( parent.findViewById<View>(sharedR.id.bc_smartspace_view) parent.findViewById<View>(sharedR.id.bc_smartspace_view) ?: parent.findViewById<View>(R.id.keyguard_slice_view) ?: parent.findViewById<View>(R.id.keyguard_slice_view) if (targetSSView == null) { if (targetSSView == null) { Log.e(TAG, "Failed to find smartspace equivalent target for animation") Log.e(TAG, "Failed to find smartspace equivalent target under $parent") return return } } transition.values[SMARTSPACE_BOUNDS] = targetSSView.getRect() transition.values[SMARTSPACE_BOUNDS] = targetSSView.getRect() Loading Loading @@ -109,14 +109,12 @@ class ClockSizeTransition( var fromIsVis = fromVis == View.VISIBLE var fromIsVis = fromVis == View.VISIBLE var fromAlpha = startValues.values[PROP_ALPHA] as Float var fromAlpha = startValues.values[PROP_ALPHA] as Float val fromBounds = startValues.values[PROP_BOUNDS] as Rect val fromBounds = startValues.values[PROP_BOUNDS] as Rect val fromSSBounds = val fromSSBounds = startValues.values[SMARTSPACE_BOUNDS] as Rect? if (captureSmartspace) startValues.values[SMARTSPACE_BOUNDS] as Rect else null val toView = endValues.view val toView = endValues.view val toVis = endValues.values[PROP_VISIBILITY] as Int val toVis = endValues.values[PROP_VISIBILITY] as Int val toBounds = endValues.values[PROP_BOUNDS] as Rect val toBounds = endValues.values[PROP_BOUNDS] as Rect val toSSBounds = val toSSBounds = endValues.values[SMARTSPACE_BOUNDS] as Rect? if (captureSmartspace) endValues.values[SMARTSPACE_BOUNDS] as Rect else null val toIsVis = toVis == View.VISIBLE val toIsVis = toVis == View.VISIBLE val toAlpha = if (toIsVis) 1f else 0f val toAlpha = if (toIsVis) 1f else 0f Loading Loading @@ -221,9 +219,6 @@ class ClockSizeTransition( private const val SMARTSPACE_BOUNDS = "ClockSizeTransition:SSBounds" private const val SMARTSPACE_BOUNDS = "ClockSizeTransition:SSBounds" private val TRANSITION_PROPERTIES = private val TRANSITION_PROPERTIES = arrayOf(PROP_VISIBILITY, PROP_ALPHA, PROP_BOUNDS, SMARTSPACE_BOUNDS) arrayOf(PROP_VISIBILITY, PROP_ALPHA, PROP_BOUNDS, SMARTSPACE_BOUNDS) private val DEBUG = false private val TAG = VisibilityBoundsTransition::class.simpleName!! } } } } Loading @@ -232,18 +227,24 @@ class ClockSizeTransition( val viewModel: KeyguardClockViewModel, val viewModel: KeyguardClockViewModel, val smartspaceViewModel: KeyguardSmartspaceViewModel, val smartspaceViewModel: KeyguardSmartspaceViewModel, ) : VisibilityBoundsTransition() { ) : VisibilityBoundsTransition() { override val captureSmartspace = !viewModel.isLargeClockVisible.value init { init { duration = CLOCK_IN_MILLIS duration = CLOCK_IN_MILLIS startDelay = CLOCK_IN_START_DELAY_MILLIS startDelay = CLOCK_IN_START_DELAY_MILLIS interpolator = CLOCK_IN_INTERPOLATOR interpolator = CLOCK_IN_INTERPOLATOR captureSmartspace = !viewModel.isLargeClockVisible.value && smartspaceViewModel.isSmartspaceEnabled if (viewModel.isLargeClockVisible.value) { if (viewModel.isLargeClockVisible.value) { viewModel.currentClock.value?.let { viewModel.currentClock.value?.let { if (DEBUG) Log.i(TAG, "Large Clock In: ${it.largeClock.layout.views}") it.largeClock.layout.views.forEach { addTarget(it) } it.largeClock.layout.views.forEach { addTarget(it) } } } ?: run { Log.e(TAG, "No large clock set, falling back") addTarget(R.id.lockscreen_clock_view_large) } } else { } else { if (DEBUG) Log.i(TAG, "Small Clock In") addTarget(R.id.lockscreen_clock_view) addTarget(R.id.lockscreen_clock_view) } } } } Loading Loading @@ -282,7 +283,6 @@ class ClockSizeTransition( val CLOCK_IN_INTERPOLATOR = Interpolators.LINEAR_OUT_SLOW_IN val CLOCK_IN_INTERPOLATOR = Interpolators.LINEAR_OUT_SLOW_IN const val SMALL_CLOCK_IN_MOVE_SCALE = const val SMALL_CLOCK_IN_MOVE_SCALE = CLOCK_IN_MILLIS / SmartspaceMoveTransition.STATUS_AREA_MOVE_DOWN_MILLIS.toFloat() CLOCK_IN_MILLIS / SmartspaceMoveTransition.STATUS_AREA_MOVE_DOWN_MILLIS.toFloat() private val TAG = ClockFaceInTransition::class.simpleName!! } } } } Loading @@ -291,18 +291,24 @@ class ClockSizeTransition( val viewModel: KeyguardClockViewModel, val viewModel: KeyguardClockViewModel, val smartspaceViewModel: KeyguardSmartspaceViewModel, val smartspaceViewModel: KeyguardSmartspaceViewModel, ) : VisibilityBoundsTransition() { ) : VisibilityBoundsTransition() { override val captureSmartspace = viewModel.isLargeClockVisible.value init { init { duration = CLOCK_OUT_MILLIS duration = CLOCK_OUT_MILLIS interpolator = CLOCK_OUT_INTERPOLATOR interpolator = CLOCK_OUT_INTERPOLATOR captureSmartspace = viewModel.isLargeClockVisible.value && smartspaceViewModel.isSmartspaceEnabled if (viewModel.isLargeClockVisible.value) { if (viewModel.isLargeClockVisible.value) { if (DEBUG) Log.i(TAG, "Small Clock Out") addTarget(R.id.lockscreen_clock_view) addTarget(R.id.lockscreen_clock_view) } else { } else { viewModel.currentClock.value?.let { viewModel.currentClock.value?.let { if (DEBUG) Log.i(TAG, "Large Clock Out: ${it.largeClock.layout.views}") it.largeClock.layout.views.forEach { addTarget(it) } it.largeClock.layout.views.forEach { addTarget(it) } } } ?: run { Log.e(TAG, "No large clock set, falling back") addTarget(R.id.lockscreen_clock_view_large) } } } } } Loading Loading @@ -339,7 +345,6 @@ class ClockSizeTransition( val CLOCK_OUT_INTERPOLATOR = Interpolators.LINEAR val CLOCK_OUT_INTERPOLATOR = Interpolators.LINEAR const val SMALL_CLOCK_OUT_MOVE_SCALE = const val SMALL_CLOCK_OUT_MOVE_SCALE = CLOCK_OUT_MILLIS / SmartspaceMoveTransition.STATUS_AREA_MOVE_UP_MILLIS.toFloat() CLOCK_OUT_MILLIS / SmartspaceMoveTransition.STATUS_AREA_MOVE_UP_MILLIS.toFloat() private val TAG = ClockFaceOutTransition::class.simpleName!! } } } } Loading @@ -348,6 +353,8 @@ class ClockSizeTransition( val config: IntraBlueprintTransition.Config, val config: IntraBlueprintTransition.Config, viewModel: KeyguardClockViewModel, viewModel: KeyguardClockViewModel, ) : VisibilityBoundsTransition() { ) : VisibilityBoundsTransition() { override val captureSmartspace = false init { init { duration = duration = if (viewModel.isLargeClockVisible.value) STATUS_AREA_MOVE_UP_MILLIS if (viewModel.isLargeClockVisible.value) STATUS_AREA_MOVE_UP_MILLIS Loading @@ -367,4 +374,8 @@ class ClockSizeTransition( const val STATUS_AREA_MOVE_DOWN_MILLIS = 467L const val STATUS_AREA_MOVE_DOWN_MILLIS = 467L } } } } companion object { val DEBUG = true } } } Loading
packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/transitions/ClockSizeTransition.kt +28 −17 Original line number Original line Diff line number Diff line Loading @@ -57,9 +57,9 @@ class ClockSizeTransition( addTransition(SmartspaceMoveTransition(config, clockViewModel)) addTransition(SmartspaceMoveTransition(config, clockViewModel)) } } open class VisibilityBoundsTransition() : Transition() { abstract class VisibilityBoundsTransition() : Transition() { var captureSmartspace: Boolean = false abstract val captureSmartspace: Boolean protected val TAG = this::class.simpleName!! override fun captureEndValues(transition: TransitionValues) = captureValues(transition) override fun captureEndValues(transition: TransitionValues) = captureValues(transition) override fun captureStartValues(transition: TransitionValues) = captureValues(transition) override fun captureStartValues(transition: TransitionValues) = captureValues(transition) override fun getTransitionProperties(): Array<String> = TRANSITION_PROPERTIES override fun getTransitionProperties(): Array<String> = TRANSITION_PROPERTIES Loading @@ -76,7 +76,7 @@ class ClockSizeTransition( parent.findViewById<View>(sharedR.id.bc_smartspace_view) parent.findViewById<View>(sharedR.id.bc_smartspace_view) ?: parent.findViewById<View>(R.id.keyguard_slice_view) ?: parent.findViewById<View>(R.id.keyguard_slice_view) if (targetSSView == null) { if (targetSSView == null) { Log.e(TAG, "Failed to find smartspace equivalent target for animation") Log.e(TAG, "Failed to find smartspace equivalent target under $parent") return return } } transition.values[SMARTSPACE_BOUNDS] = targetSSView.getRect() transition.values[SMARTSPACE_BOUNDS] = targetSSView.getRect() Loading Loading @@ -109,14 +109,12 @@ class ClockSizeTransition( var fromIsVis = fromVis == View.VISIBLE var fromIsVis = fromVis == View.VISIBLE var fromAlpha = startValues.values[PROP_ALPHA] as Float var fromAlpha = startValues.values[PROP_ALPHA] as Float val fromBounds = startValues.values[PROP_BOUNDS] as Rect val fromBounds = startValues.values[PROP_BOUNDS] as Rect val fromSSBounds = val fromSSBounds = startValues.values[SMARTSPACE_BOUNDS] as Rect? if (captureSmartspace) startValues.values[SMARTSPACE_BOUNDS] as Rect else null val toView = endValues.view val toView = endValues.view val toVis = endValues.values[PROP_VISIBILITY] as Int val toVis = endValues.values[PROP_VISIBILITY] as Int val toBounds = endValues.values[PROP_BOUNDS] as Rect val toBounds = endValues.values[PROP_BOUNDS] as Rect val toSSBounds = val toSSBounds = endValues.values[SMARTSPACE_BOUNDS] as Rect? if (captureSmartspace) endValues.values[SMARTSPACE_BOUNDS] as Rect else null val toIsVis = toVis == View.VISIBLE val toIsVis = toVis == View.VISIBLE val toAlpha = if (toIsVis) 1f else 0f val toAlpha = if (toIsVis) 1f else 0f Loading Loading @@ -221,9 +219,6 @@ class ClockSizeTransition( private const val SMARTSPACE_BOUNDS = "ClockSizeTransition:SSBounds" private const val SMARTSPACE_BOUNDS = "ClockSizeTransition:SSBounds" private val TRANSITION_PROPERTIES = private val TRANSITION_PROPERTIES = arrayOf(PROP_VISIBILITY, PROP_ALPHA, PROP_BOUNDS, SMARTSPACE_BOUNDS) arrayOf(PROP_VISIBILITY, PROP_ALPHA, PROP_BOUNDS, SMARTSPACE_BOUNDS) private val DEBUG = false private val TAG = VisibilityBoundsTransition::class.simpleName!! } } } } Loading @@ -232,18 +227,24 @@ class ClockSizeTransition( val viewModel: KeyguardClockViewModel, val viewModel: KeyguardClockViewModel, val smartspaceViewModel: KeyguardSmartspaceViewModel, val smartspaceViewModel: KeyguardSmartspaceViewModel, ) : VisibilityBoundsTransition() { ) : VisibilityBoundsTransition() { override val captureSmartspace = !viewModel.isLargeClockVisible.value init { init { duration = CLOCK_IN_MILLIS duration = CLOCK_IN_MILLIS startDelay = CLOCK_IN_START_DELAY_MILLIS startDelay = CLOCK_IN_START_DELAY_MILLIS interpolator = CLOCK_IN_INTERPOLATOR interpolator = CLOCK_IN_INTERPOLATOR captureSmartspace = !viewModel.isLargeClockVisible.value && smartspaceViewModel.isSmartspaceEnabled if (viewModel.isLargeClockVisible.value) { if (viewModel.isLargeClockVisible.value) { viewModel.currentClock.value?.let { viewModel.currentClock.value?.let { if (DEBUG) Log.i(TAG, "Large Clock In: ${it.largeClock.layout.views}") it.largeClock.layout.views.forEach { addTarget(it) } it.largeClock.layout.views.forEach { addTarget(it) } } } ?: run { Log.e(TAG, "No large clock set, falling back") addTarget(R.id.lockscreen_clock_view_large) } } else { } else { if (DEBUG) Log.i(TAG, "Small Clock In") addTarget(R.id.lockscreen_clock_view) addTarget(R.id.lockscreen_clock_view) } } } } Loading Loading @@ -282,7 +283,6 @@ class ClockSizeTransition( val CLOCK_IN_INTERPOLATOR = Interpolators.LINEAR_OUT_SLOW_IN val CLOCK_IN_INTERPOLATOR = Interpolators.LINEAR_OUT_SLOW_IN const val SMALL_CLOCK_IN_MOVE_SCALE = const val SMALL_CLOCK_IN_MOVE_SCALE = CLOCK_IN_MILLIS / SmartspaceMoveTransition.STATUS_AREA_MOVE_DOWN_MILLIS.toFloat() CLOCK_IN_MILLIS / SmartspaceMoveTransition.STATUS_AREA_MOVE_DOWN_MILLIS.toFloat() private val TAG = ClockFaceInTransition::class.simpleName!! } } } } Loading @@ -291,18 +291,24 @@ class ClockSizeTransition( val viewModel: KeyguardClockViewModel, val viewModel: KeyguardClockViewModel, val smartspaceViewModel: KeyguardSmartspaceViewModel, val smartspaceViewModel: KeyguardSmartspaceViewModel, ) : VisibilityBoundsTransition() { ) : VisibilityBoundsTransition() { override val captureSmartspace = viewModel.isLargeClockVisible.value init { init { duration = CLOCK_OUT_MILLIS duration = CLOCK_OUT_MILLIS interpolator = CLOCK_OUT_INTERPOLATOR interpolator = CLOCK_OUT_INTERPOLATOR captureSmartspace = viewModel.isLargeClockVisible.value && smartspaceViewModel.isSmartspaceEnabled if (viewModel.isLargeClockVisible.value) { if (viewModel.isLargeClockVisible.value) { if (DEBUG) Log.i(TAG, "Small Clock Out") addTarget(R.id.lockscreen_clock_view) addTarget(R.id.lockscreen_clock_view) } else { } else { viewModel.currentClock.value?.let { viewModel.currentClock.value?.let { if (DEBUG) Log.i(TAG, "Large Clock Out: ${it.largeClock.layout.views}") it.largeClock.layout.views.forEach { addTarget(it) } it.largeClock.layout.views.forEach { addTarget(it) } } } ?: run { Log.e(TAG, "No large clock set, falling back") addTarget(R.id.lockscreen_clock_view_large) } } } } } Loading Loading @@ -339,7 +345,6 @@ class ClockSizeTransition( val CLOCK_OUT_INTERPOLATOR = Interpolators.LINEAR val CLOCK_OUT_INTERPOLATOR = Interpolators.LINEAR const val SMALL_CLOCK_OUT_MOVE_SCALE = const val SMALL_CLOCK_OUT_MOVE_SCALE = CLOCK_OUT_MILLIS / SmartspaceMoveTransition.STATUS_AREA_MOVE_UP_MILLIS.toFloat() CLOCK_OUT_MILLIS / SmartspaceMoveTransition.STATUS_AREA_MOVE_UP_MILLIS.toFloat() private val TAG = ClockFaceOutTransition::class.simpleName!! } } } } Loading @@ -348,6 +353,8 @@ class ClockSizeTransition( val config: IntraBlueprintTransition.Config, val config: IntraBlueprintTransition.Config, viewModel: KeyguardClockViewModel, viewModel: KeyguardClockViewModel, ) : VisibilityBoundsTransition() { ) : VisibilityBoundsTransition() { override val captureSmartspace = false init { init { duration = duration = if (viewModel.isLargeClockVisible.value) STATUS_AREA_MOVE_UP_MILLIS if (viewModel.isLargeClockVisible.value) STATUS_AREA_MOVE_UP_MILLIS Loading @@ -367,4 +374,8 @@ class ClockSizeTransition( const val STATUS_AREA_MOVE_DOWN_MILLIS = 467L const val STATUS_AREA_MOVE_DOWN_MILLIS = 467L } } } } companion object { val DEBUG = true } } }