diff options
author | 2025-02-14 11:36:20 -0800 | |
---|---|---|
committer | 2025-02-14 11:36:20 -0800 | |
commit | 70382f3712f24c8d93e71b80346f39f40f99f85a (patch) | |
tree | 78d65e193f3a794056ed3d8affc2453069a8a9bc | |
parent | 63a6571ac125121c2fae7dbece7f488e8edde6ed (diff) | |
parent | 25a32bb3373136db9a260dc559b08b4b6ee18af2 (diff) |
Merge "Update pattern bouncer to match spec" into main
4 files changed, 61 insertions, 3 deletions
diff --git a/core/java/com/android/internal/widget/LockPatternView.java b/core/java/com/android/internal/widget/LockPatternView.java index 0ec55f958f38..1f907602cb9b 100644 --- a/core/java/com/android/internal/widget/LockPatternView.java +++ b/core/java/com/android/internal/widget/LockPatternView.java @@ -87,10 +87,10 @@ public class LockPatternView extends View { private static final int CELL_ACTIVATE = 0; private static final int CELL_DEACTIVATE = 1; - private final int mDotSize; - private final int mDotSizeActivated; + private int mDotSize; + private int mDotSizeActivated; private final float mDotHitFactor; - private final int mPathWidth; + private int mPathWidth; private final int mLineFadeOutAnimationDurationMs; private final int mLineFadeOutAnimationDelayMs; private final int mFadePatternAnimationDurationMs; @@ -1341,6 +1341,38 @@ public class LockPatternView extends View { invalidate(); } + /** + * Change dot colors + */ + public void setDotColors(int dotColor, int dotActivatedColor) { + mDotColor = dotColor; + mDotActivatedColor = dotActivatedColor; + invalidate(); + } + + /** + * Keeps dot activated until the next dot gets activated. + */ + public void setKeepDotActivated(boolean keepDotActivated) { + mKeepDotActivated = keepDotActivated; + } + + /** + * Set dot sizes in dp + */ + public void setDotSizes(int dotSizeDp, int dotSizeActivatedDp) { + mDotSize = dotSizeDp; + mDotSizeActivated = dotSizeActivatedDp; + } + + /** + * Set the stroke width of the pattern line. + */ + public void setPathWidth(int pathWidthDp) { + mPathWidth = pathWidthDp; + mPathPaint.setStrokeWidth(mPathWidth); + } + private float getCenterXForColumn(int column) { return mPaddingLeft + column * mSquareWidth + mSquareWidth / 2f; } diff --git a/packages/SystemUI/res-keyguard/values/dimens.xml b/packages/SystemUI/res-keyguard/values/dimens.xml index bfb37a0d97a7..6d446453d9f7 100644 --- a/packages/SystemUI/res-keyguard/values/dimens.xml +++ b/packages/SystemUI/res-keyguard/values/dimens.xml @@ -31,6 +31,10 @@ <!-- height for the keyguard pin input field --> <dimen name="keyguard_pin_field_height">56dp</dimen> + <dimen name="keyguard_pattern_dot_size">16dp</dimen> + <dimen name="keyguard_pattern_activated_dot_size">24dp</dimen> + <dimen name="keyguard_pattern_stroke_width">32dp</dimen> + <!-- height for the keyguard password input field --> <dimen name="keyguard_password_field_height">56dp</dimen> diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardPatternView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardPatternView.java index 5d63c2a92ba8..4a4cb7a232c5 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardPatternView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPatternView.java @@ -43,6 +43,8 @@ import com.android.internal.widget.LockPatternView; import com.android.settingslib.animation.AppearAnimationCreator; import com.android.settingslib.animation.AppearAnimationUtils; import com.android.settingslib.animation.DisappearAnimationUtils; +import com.android.systemui.Flags; +import com.android.systemui.bouncer.shared.constants.PatternBouncerConstants.ColorId; import com.android.systemui.res.R; import com.android.systemui.statusbar.policy.DevicePostureController.DevicePostureInt; @@ -227,6 +229,18 @@ public class KeyguardPatternView extends KeyguardInputView super.onFinishInflate(); mLockPatternView = findViewById(R.id.lockPatternView); + if (Flags.bouncerUiRevamp2()) { + mLockPatternView.setDotColors(mContext.getColor(ColorId.dotColor), mContext.getColor( + ColorId.activatedDotColor)); + mLockPatternView.setColors(mContext.getColor(ColorId.pathColor), 0, 0); + mLockPatternView.setDotSizes( + getResources().getDimensionPixelSize(R.dimen.keyguard_pattern_dot_size), + getResources().getDimensionPixelSize( + R.dimen.keyguard_pattern_activated_dot_size)); + mLockPatternView.setPathWidth( + getResources().getDimensionPixelSize(R.dimen.keyguard_pattern_stroke_width)); + mLockPatternView.setKeepDotActivated(true); + } mEcaView = findViewById(R.id.keyguard_selector_fade_container); } diff --git a/packages/SystemUI/src/com/android/systemui/bouncer/shared/constants/KeyguardBouncerConstants.kt b/packages/SystemUI/src/com/android/systemui/bouncer/shared/constants/KeyguardBouncerConstants.kt index 149efcdcbb8a..3ef50f68cba4 100644 --- a/packages/SystemUI/src/com/android/systemui/bouncer/shared/constants/KeyguardBouncerConstants.kt +++ b/packages/SystemUI/src/com/android/systemui/bouncer/shared/constants/KeyguardBouncerConstants.kt @@ -87,6 +87,14 @@ private fun <T> c(old: T, new: T): T { } } +object PatternBouncerConstants { + object ColorId { + @JvmField val dotColor = colors.materialColorOnSurfaceVariant + @JvmField val activatedDotColor = colors.materialColorOnPrimary + @JvmField val pathColor = colors.materialColorPrimary + } +} + object PinBouncerConstants { @JvmField val pinShapes = c(old = R.array.bouncer_pin_shapes, new = R.array.updated_bouncer_pin_shapes) |