summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java')
-rw-r--r--core/java/com/android/internal/widget/LockPatternView.java88
1 files changed, 46 insertions, 42 deletions
diff --git a/core/java/com/android/internal/widget/LockPatternView.java b/core/java/com/android/internal/widget/LockPatternView.java
index 0c0205ca5837..97bbe5218b70 100644
--- a/core/java/com/android/internal/widget/LockPatternView.java
+++ b/core/java/com/android/internal/widget/LockPatternView.java
@@ -103,7 +103,8 @@ public class LockPatternView extends View {
private boolean mTactileFeedbackEnabled = true;
private boolean mPatternInProgress = false;
- private float mDiameterFactor = 0.5f;
+ private float mDiameterFactor = 0.10f; // TODO: move to attrs
+ private final int mStrokeAlpha = 128;
private float mHitFactor = 0.6f;
private float mSquareWidth;
@@ -133,6 +134,7 @@ public class LockPatternView extends View {
private final Matrix mArrowMatrix = new Matrix();
private final Matrix mCircleMatrix = new Matrix();
+
/**
* Represents a cell in the 3 X 3 matrix of the unlock pattern view.
*/
@@ -267,17 +269,17 @@ public class LockPatternView extends View {
mPathPaint.setAntiAlias(true);
mPathPaint.setDither(true);
mPathPaint.setColor(Color.WHITE); // TODO this should be from the style
- mPathPaint.setAlpha(128);
+ mPathPaint.setAlpha(mStrokeAlpha);
mPathPaint.setStyle(Paint.Style.STROKE);
mPathPaint.setStrokeJoin(Paint.Join.ROUND);
mPathPaint.setStrokeCap(Paint.Cap.ROUND);
// lot's of bitmaps!
- mBitmapBtnDefault = getBitmapFor(R.drawable.btn_code_lock_default);
- mBitmapBtnTouched = getBitmapFor(R.drawable.btn_code_lock_touched);
- mBitmapCircleDefault = getBitmapFor(R.drawable.indicator_code_lock_point_area_default);
- mBitmapCircleGreen = getBitmapFor(R.drawable.indicator_code_lock_point_area_green);
- mBitmapCircleRed = getBitmapFor(R.drawable.indicator_code_lock_point_area_red);
+ 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);
+ mBitmapCircleGreen = getBitmapFor(R.drawable.indicator_code_lock_point_area_green_holo);
+ mBitmapCircleRed = getBitmapFor(R.drawable.indicator_code_lock_point_area_red_holo);
mBitmapArrowGreenUp = getBitmapFor(R.drawable.indicator_code_lock_drag_direction_green_up);
mBitmapArrowRedUp = getBitmapFor(R.drawable.indicator_code_lock_drag_direction_red_up);
@@ -889,41 +891,6 @@ public class LockPatternView extends View {
final Path currentPath = mCurrentPath;
currentPath.rewind();
- // 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 the user is in progress, and
- // we are in stealth mode)
- final boolean drawPath = (!mInStealthMode || mPatternDisplayMode == DisplayMode.Wrong);
- if (drawPath) {
- boolean anyCircles = false;
- for (int i = 0; i < count; i++) {
- Cell cell = pattern.get(i);
-
- // only draw the part of the pattern stored in
- // the lookup table (this is only different in the case
- // of animation).
- if (!drawLookup[cell.row][cell.column]) {
- break;
- }
- anyCircles = true;
-
- float centerX = getCenterXForColumn(cell.column);
- float centerY = getCenterYForRow(cell.row);
- if (i == 0) {
- currentPath.moveTo(centerX, centerY);
- } else {
- currentPath.lineTo(centerX, centerY);
- }
- }
-
- // add last in progress section
- if ((mPatternInProgress || mPatternDisplayMode == DisplayMode.Animate)
- && anyCircles) {
- currentPath.lineTo(mInProgressX, mInProgressY);
- }
- canvas.drawPath(currentPath, mPathPaint);
- }
-
// draw the circles
final int paddingTop = mPaddingTop;
final int paddingLeft = mPaddingLeft;
@@ -937,6 +904,12 @@ public class LockPatternView extends View {
}
}
+ // 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 the user is in progress, and
+ // we are in stealth mode)
+ final boolean drawPath = (!mInStealthMode || mPatternDisplayMode == DisplayMode.Wrong);
+
// draw the arrows associated with the path (unless the user is in progress, and
// we are in stealth mode)
boolean oldFlag = (mPaint.getFlags() & Paint.FILTER_BITMAP_FLAG) != 0;
@@ -959,6 +932,37 @@ public class LockPatternView extends View {
drawArrow(canvas, leftX, topY, cell, next);
}
}
+
+ if (drawPath) {
+ boolean anyCircles = false;
+ for (int i = 0; i < count; i++) {
+ Cell cell = pattern.get(i);
+
+ // only draw the part of the pattern stored in
+ // the lookup table (this is only different in the case
+ // of animation).
+ if (!drawLookup[cell.row][cell.column]) {
+ break;
+ }
+ anyCircles = true;
+
+ float centerX = getCenterXForColumn(cell.column);
+ float centerY = getCenterYForRow(cell.row);
+ if (i == 0) {
+ currentPath.moveTo(centerX, centerY);
+ } else {
+ currentPath.lineTo(centerX, centerY);
+ }
+ }
+
+ // add last in progress section
+ if ((mPatternInProgress || mPatternDisplayMode == DisplayMode.Animate)
+ && anyCircles) {
+ currentPath.lineTo(mInProgressX, mInProgressY);
+ }
+ canvas.drawPath(currentPath, mPathPaint);
+ }
+
mPaint.setFilterBitmap(oldFlag); // restore default flag
}