Loading core/java/com/android/internal/widget/LockPatternView.java +46 −42 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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. */ Loading Loading @@ -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); Loading Loading @@ -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; Loading @@ -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; Loading @@ -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 } Loading core/res/res/drawable-hdpi/btn_code_lock_default_holo.png +265 B (597 B) Loading image diff... core/res/res/drawable-hdpi/btn_code_lock_touched_holo.png +205 B (537 B) Loading image diff... core/res/res/drawable-xlarge-mdpi/btn_code_lock_default.png→core/res/res/drawable-large-mdpi/btn_code_lock_default_holo.png (298 B) File moved. View file core/res/res/drawable-xlarge-mdpi/btn_code_lock_touched.png→core/res/res/drawable-large-mdpi/btn_code_lock_touched_holo.png (298 B) File moved. View file Loading
core/java/com/android/internal/widget/LockPatternView.java +46 −42 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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. */ Loading Loading @@ -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); Loading Loading @@ -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; Loading @@ -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; Loading @@ -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 } Loading
core/res/res/drawable-xlarge-mdpi/btn_code_lock_default.png→core/res/res/drawable-large-mdpi/btn_code_lock_default_holo.png (298 B) File moved. View file
core/res/res/drawable-xlarge-mdpi/btn_code_lock_touched.png→core/res/res/drawable-large-mdpi/btn_code_lock_touched_holo.png (298 B) File moved. View file