diff options
| -rw-r--r-- | core/java/com/android/internal/widget/LockPatternView.java | 63 | ||||
| -rw-r--r-- | core/res/res/values/attrs.xml | 3 | ||||
| -rw-r--r-- | core/res/res/values/dimens.xml | 6 | ||||
| -rw-r--r-- | packages/SystemUI/res/values/styles.xml | 4 |
4 files changed, 47 insertions, 29 deletions
diff --git a/core/java/com/android/internal/widget/LockPatternView.java b/core/java/com/android/internal/widget/LockPatternView.java index bad21d28416b..73c5460755b1 100644 --- a/core/java/com/android/internal/widget/LockPatternView.java +++ b/core/java/com/android/internal/widget/LockPatternView.java @@ -148,6 +148,7 @@ public class LockPatternView extends View { private int mRegularColor; private int mErrorColor; private int mSuccessColor; + private int mDotColor; private final Interpolator mFastOutSlowInInterpolator; private final Interpolator mLinearOutSlowInInterpolator; @@ -318,6 +319,7 @@ public class LockPatternView extends View { mRegularColor = a.getColor(R.styleable.LockPatternView_regularColor, 0); mErrorColor = a.getColor(R.styleable.LockPatternView_errorColor, 0); mSuccessColor = a.getColor(R.styleable.LockPatternView_successColor, 0); + mDotColor = a.getColor(R.styleable.LockPatternView_dotColor, mRegularColor); int pathColor = a.getColor(R.styleable.LockPatternView_pathColor, mRegularColor); mPathPaint.setColor(pathColor); @@ -522,7 +524,7 @@ public class LockPatternView extends View { getCenterYForRow(cellState.row) + startTranslationY); cellState.hwCenterX = CanvasProperty.createFloat(getCenterXForColumn(cellState.col)); cellState.hwRadius = CanvasProperty.createFloat(mDotSize/2 * startScale); - mPaint.setColor(getCurrentColor(false)); + mPaint.setColor(getDotColor()); mPaint.setAlpha((int) (startAlpha * 255)); cellState.hwPaint = CanvasProperty.createPaint(new Paint(mPaint)); @@ -1163,29 +1165,6 @@ public class LockPatternView extends View { final Path currentPath = mCurrentPath; currentPath.rewind(); - // draw the circles - for (int i = 0; i < 3; i++) { - float centerY = getCenterYForRow(i); - for (int j = 0; j < 3; j++) { - CellState cellState = mCellStates[i][j]; - float centerX = getCenterXForColumn(j); - float translationY = cellState.translationY; - - if (mUseLockPatternDrawable) { - drawCellDrawable(canvas, i, j, cellState.radius, drawLookup[i][j]); - } else { - if (isHardwareAccelerated() && cellState.hwAnimating) { - RecordingCanvas recordingCanvas = (RecordingCanvas) canvas; - recordingCanvas.drawCircle(cellState.hwCenterX, cellState.hwCenterY, - cellState.hwRadius, cellState.hwPaint); - } else { - drawCircle(canvas, (int) centerX, (int) centerY + translationY, - cellState.radius, drawLookup[i][j], cellState.alpha); - } - } - } - } - // TODO: the path should be created and cached every time we hit-detect a cell // only the last segment of the path should be computed here // draw the path of the pattern (unless we are in stealth mode) @@ -1256,6 +1235,29 @@ public class LockPatternView extends View { canvas.drawPath(currentPath, mPathPaint); } } + + // draw the circles + for (int i = 0; i < 3; i++) { + float centerY = getCenterYForRow(i); + for (int j = 0; j < 3; j++) { + CellState cellState = mCellStates[i][j]; + float centerX = getCenterXForColumn(j); + float translationY = cellState.translationY; + + if (mUseLockPatternDrawable) { + drawCellDrawable(canvas, i, j, cellState.radius, drawLookup[i][j]); + } else { + if (isHardwareAccelerated() && cellState.hwAnimating) { + RecordingCanvas recordingCanvas = (RecordingCanvas) canvas; + recordingCanvas.drawCircle(cellState.hwCenterX, cellState.hwCenterY, + cellState.hwRadius, cellState.hwPaint); + } else { + drawCircle(canvas, (int) centerX, (int) centerY + translationY, + cellState.radius, drawLookup[i][j], cellState.alpha); + } + } + } + } } private float calculateLastSegmentAlpha(float x, float y, float lastX, float lastY) { @@ -1266,6 +1268,17 @@ public class LockPatternView extends View { return Math.min(1f, Math.max(0f, (frac - 0.3f) * 4f)); } + private int getDotColor() { + if (mInStealthMode) { + // Always use the default color in this case + return mDotColor; + } else if (mPatternDisplayMode == DisplayMode.Wrong) { + // the pattern is wrong + return mErrorColor; + } + return mDotColor; + } + private int getCurrentColor(boolean partOfPattern) { if (!partOfPattern || mInStealthMode || mPatternInProgress) { // unselected circle @@ -1286,7 +1299,7 @@ public class LockPatternView extends View { */ private void drawCircle(Canvas canvas, float centerX, float centerY, float radius, boolean partOfPattern, float alpha) { - mPaint.setColor(getCurrentColor(partOfPattern)); + mPaint.setColor(getDotColor()); mPaint.setAlpha((int) (alpha * 255)); canvas.drawCircle(centerX, centerY, radius, mPaint); } diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index 14f1e0e20ef6..b6a5aee6473e 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -8435,6 +8435,9 @@ <attr name="errorColor" format="color|reference" /> <!-- The success color --> <attr name="successColor" format="color|reference"/> + <!-- The dot color --> + <attr name="dotColor" format="color|reference"/> + </declare-styleable> <!-- =============================== --> diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml index 3ae21311ea49..cb16af5a16b0 100644 --- a/core/res/res/values/dimens.xml +++ b/core/res/res/values/dimens.xml @@ -622,9 +622,9 @@ aliasing effects). This is only used on circular displays. --> <dimen name="circular_display_mask_thickness">1px</dimen> - <dimen name="lock_pattern_dot_line_width">3dp</dimen> - <dimen name="lock_pattern_dot_size">12dp</dimen> - <dimen name="lock_pattern_dot_size_activated">28dp</dimen> + <dimen name="lock_pattern_dot_line_width">22dp</dimen> + <dimen name="lock_pattern_dot_size">14dp</dimen> + <dimen name="lock_pattern_dot_size_activated">30dp</dimen> <dimen name="text_handle_min_size">40dp</dimen> diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml index db260ce1b7b4..9aeff7846877 100644 --- a/packages/SystemUI/res/values/styles.xml +++ b/packages/SystemUI/res/values/styles.xml @@ -354,15 +354,17 @@ </style> <style name="LockPatternStyle"> - <item name="*android:regularColor">?android:attr/textColorPrimary</item> + <item name="*android:regularColor">?android:attr/colorAccent</item> <item name="*android:successColor">?android:attr/textColorPrimary</item> <item name="*android:errorColor">?android:attr/colorError</item> + <item name="*android:dotColor">?android:attr/textColorSecondary</item> </style> <style name="LockPatternStyleBiometricPrompt"> <item name="*android:regularColor">?android:attr/colorForeground</item> <item name="*android:successColor">?android:attr/colorForeground</item> <item name="*android:errorColor">?android:attr/colorError</item> + <item name="*android:dotColor">?android:attr/textColorSecondary</item> </style> <style name="qs_theme" parent="@*android:style/Theme.DeviceDefault.QuickSettings"> |