diff options
| author | 2023-10-10 10:27:13 -0400 | |
|---|---|---|
| committer | 2023-10-10 11:12:16 -0400 | |
| commit | 151d48231410e8d7ad6272333947c19f93676bb3 (patch) | |
| tree | ed2e08c310634add37df3c4e0978cd2100d71760 | |
| parent | f00f4b3943d858ec0a22f5bf3b0feaa82b2e681a (diff) | |
Set shortcuts back to original position after shaking
Due to the nature of the "shake" animation, the shortcuts were ending up
a few pixels to the left from their original location after the
animation ended.
Additionally update the horizontal position of the shortcuts, per design
spec change to align them with notifications.
Fixes: 301079105
Fixes: 298964750
Test: manual - turn show layout bounds on. Tap shortcut to initiate shake, observe that the shortcut goes back to its original position after shaking
Test: manual - notice that the shortcuts are moved outwards as expected
Change-Id: I493ed2f6744d06ab3abc9bd992edfd1c73ec85a6
3 files changed, 9 insertions, 1 deletions
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 0ee5da22a31b..6d54058f8e0c 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -846,7 +846,7 @@ <!-- Amount the button should shake when it's not long-pressed for long enough. --> <dimen name="keyguard_affordance_shake_amplitude">8dp</dimen> - <dimen name="keyguard_affordance_horizontal_offset">32dp</dimen> + <dimen name="keyguard_affordance_horizontal_offset">16dp</dimen> <dimen name="keyguard_affordance_vertical_offset">32dp</dimen> <!-- Value should be at least sum of 'keyguard_affordance_width' + 'keyguard_affordance_horizontal_offset' --> diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBottomAreaViewBinder.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBottomAreaViewBinder.kt index abc30efec716..c5a8375f5576 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBottomAreaViewBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBottomAreaViewBinder.kt @@ -47,6 +47,7 @@ import com.android.systemui.lifecycle.repeatWhenAttached import com.android.systemui.plugins.ActivityStarter import com.android.systemui.plugins.FalsingManager import com.android.systemui.statusbar.VibratorHelper +import com.android.systemui.util.doOnEnd import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableStateFlow @@ -402,6 +403,9 @@ object KeyguardBottomAreaViewBinder { KeyguardBottomAreaVibrations.ShakeAnimationDuration.inWholeMilliseconds shakeAnimator.interpolator = CycleInterpolator(KeyguardBottomAreaVibrations.ShakeAnimationCycles) + shakeAnimator.doOnEnd { + view.translationX = 0f + } shakeAnimator.start() vibratorHelper?.vibrate(KeyguardBottomAreaVibrations.Shake) diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardQuickAffordanceViewBinder.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardQuickAffordanceViewBinder.kt index f0d118cbe20f..99025acef70d 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardQuickAffordanceViewBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardQuickAffordanceViewBinder.kt @@ -41,6 +41,7 @@ import com.android.systemui.keyguard.ui.viewmodel.KeyguardQuickAffordanceViewMod import com.android.systemui.lifecycle.repeatWhenAttached import com.android.systemui.plugins.FalsingManager import com.android.systemui.statusbar.VibratorHelper +import com.android.systemui.util.doOnEnd import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.combine @@ -240,6 +241,9 @@ object KeyguardQuickAffordanceViewBinder { KeyguardBottomAreaVibrations.ShakeAnimationDuration.inWholeMilliseconds shakeAnimator.interpolator = CycleInterpolator(KeyguardBottomAreaVibrations.ShakeAnimationCycles) + shakeAnimator.doOnEnd { + view.translationX = 0f + } shakeAnimator.start() vibratorHelper?.vibrate(KeyguardBottomAreaVibrations.Shake) |