diff options
| -rw-r--r-- | core/java/com/android/internal/widget/LockPatternView.java | 13 | ||||
| -rw-r--r-- | core/res/res/values/attrs.xml | 2 |
2 files changed, 14 insertions, 1 deletions
diff --git a/core/java/com/android/internal/widget/LockPatternView.java b/core/java/com/android/internal/widget/LockPatternView.java index 26cb4e5bc5a3..36ed3445d131 100644 --- a/core/java/com/android/internal/widget/LockPatternView.java +++ b/core/java/com/android/internal/widget/LockPatternView.java @@ -32,6 +32,7 @@ import android.os.Parcel; import android.os.Parcelable; import android.os.SystemClock; import android.util.AttributeSet; +import android.util.TypedValue; import android.view.HapticFeedbackConstants; import android.view.MotionEvent; import android.view.View; @@ -260,13 +261,23 @@ public class LockPatternView extends View { mPathPaint.setAntiAlias(true); mPathPaint.setDither(true); - mPathPaint.setColor(Color.WHITE); // TODO this should be from the style + + int defaultColor = Color.WHITE; + TypedValue outValue = new TypedValue(); + if (context.getTheme().resolveAttribute(android.R.attr.textColorPrimary, outValue, true)) { + defaultColor = context.getResources().getColor(outValue.resourceId); + } + + final int color = a.getColor(R.styleable.LockPatternView_pathColor, defaultColor); + mPathPaint.setColor(color); + mPathPaint.setAlpha(mStrokeAlpha); mPathPaint.setStyle(Paint.Style.STROKE); mPathPaint.setStrokeJoin(Paint.Join.ROUND); mPathPaint.setStrokeCap(Paint.Cap.ROUND); // lot's of bitmaps! + // TODO: those bitmaps are hardcoded to the Holo Theme which should not be the case! mBitmapBtnDefault = getBitmapFor(R.drawable.btn_code_lock_default_holo); mBitmapBtnTouched = getBitmapFor(R.drawable.btn_code_lock_touched_holo); mBitmapCircleDefault = getBitmapFor(R.drawable.indicator_code_lock_point_area_default_holo); diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index bd53e498428c..369dda13f500 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -6138,6 +6138,8 @@ <!-- Aspect to use when drawing LockPatternView. Choices are "square"(default), "lock_width" or "lock_height" --> <attr name="aspect" format="string" /> + <!-- Color to use when drawing LockPatternView paths. --> + <attr name="pathColor" format="color|reference" /> </declare-styleable> <!-- Use <code>recognition-service</code> as the root tag of the XML resource that |