Loading core/java/com/android/internal/widget/LockPatternView.java +44 −8 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import com.android.internal.R; import android.content.Context; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; Loading Loading @@ -50,6 +51,11 @@ import java.util.List; * "correct" states. */ public class LockPatternView extends View { // Aspect to use when rendering this view private static final int ASPECT_SQUARE = 0; // View will be the minimum of width/height private static final int ASPECT_LOCK_WIDTH = 1; // Fixed width; height will be minimum of (w,h) private static final int ASPECT_LOCK_HEIGHT = 2; // Fixed height; width will be minimum of (w,h) // Vibrator pattern for creating a tactile bump private static final long[] DEFAULT_VIBE_PATTERN = {0, 1, 40, 41}; Loading Loading @@ -122,6 +128,8 @@ public class LockPatternView extends View { private long[] mVibePattern; private int mAspect; /** * Represents a cell in the 3 X 3 matrix of the unlock pattern view. */ Loading Loading @@ -237,6 +245,20 @@ public class LockPatternView extends View { super(context, attrs); vibe = new Vibrator(); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.LockPatternView); final String aspect = a.getString(R.styleable.LockPatternView_aspect); if ("square".equals(aspect)) { mAspect = ASPECT_SQUARE; } else if ("lock_width".equals(aspect)) { mAspect = ASPECT_LOCK_WIDTH; } else if ("lock_height".equals(aspect)) { mAspect = ASPECT_LOCK_HEIGHT; } else { mAspect = ASPECT_SQUARE; } setClickable(true); mPathPaint.setAntiAlias(true); Loading Loading @@ -425,8 +447,22 @@ public class LockPatternView extends View { protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { final int width = MeasureSpec.getSize(widthMeasureSpec); final int height = MeasureSpec.getSize(heightMeasureSpec); final int squareSide = Math.min(width, height); setMeasuredDimension(squareSide, squareSide); int viewWidth = width; int viewHeight = height; switch (mAspect) { case ASPECT_SQUARE: viewWidth = viewHeight = Math.min(width, height); break; case ASPECT_LOCK_WIDTH: viewWidth = width; viewHeight = Math.min(width, height); break; case ASPECT_LOCK_HEIGHT: viewWidth = Math.min(width, height); viewHeight = height; break; } setMeasuredDimension(viewWidth, viewHeight); } /** Loading core/res/res/layout/keyguard_screen_unlock_portrait.xml +1 −0 Original line number Diff line number Diff line Loading @@ -153,6 +153,7 @@ android:layout_height="0dip" android:layout_weight="1" android:layout_marginTop="2dip" android:aspect="@string/lock_pattern_view_aspect" /> <!-- footer --> Loading core/res/res/values-port-mdpi/donottranslate.xml 0 → 100644 +23 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- /* //device/apps/common/assets/res/any/strings.xml ** ** Copyright 2009, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ --> <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <!-- @hide DO NOT TRANSLATE. There isn't enough room on mdpi devices, allow height to vary --> <string name="lock_pattern_view_aspect">lock_width</string> </resources> core/res/res/values/attrs.xml +12 −1 Original line number Diff line number Diff line Loading @@ -3624,6 +3624,17 @@ <attr name="orientation" /> </declare-styleable> <!-- =============================== --> <!-- LockPatternView class attributes --> <!-- =============================== --> <eat-comment /> <declare-styleable name="LockPatternView"> <!-- Aspect to use when drawing LockPatternView. Choices are "square"(default), "lock_width" or "lock_height" --> <attr name="aspect" format="string" /> </declare-styleable> <!-- Use <code>recognition-service</code> as the root tag of the XML resource that describes a {@link android.speech.RecognitionService}, which is reference from its {@link android.speech.RecognitionService#SERVICE_META_DATA} meta-data entry. Loading core/res/res/values/donottranslate.xml +2 −0 Original line number Diff line number Diff line Loading @@ -22,4 +22,6 @@ <string name="default_text_encoding">Latin-1</string> <!-- @hide DO NOT TRANSLATE. Workaround for resource race condition in lockscreen. --> <bool name="lockscreen_isPortrait">true</bool> <!-- @hide DO NOT TRANSLATE. Control aspect ratio of lock pattern --> <string name="lock_pattern_view_aspect">square</string> </resources> Loading
core/java/com/android/internal/widget/LockPatternView.java +44 −8 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import com.android.internal.R; import android.content.Context; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; Loading Loading @@ -50,6 +51,11 @@ import java.util.List; * "correct" states. */ public class LockPatternView extends View { // Aspect to use when rendering this view private static final int ASPECT_SQUARE = 0; // View will be the minimum of width/height private static final int ASPECT_LOCK_WIDTH = 1; // Fixed width; height will be minimum of (w,h) private static final int ASPECT_LOCK_HEIGHT = 2; // Fixed height; width will be minimum of (w,h) // Vibrator pattern for creating a tactile bump private static final long[] DEFAULT_VIBE_PATTERN = {0, 1, 40, 41}; Loading Loading @@ -122,6 +128,8 @@ public class LockPatternView extends View { private long[] mVibePattern; private int mAspect; /** * Represents a cell in the 3 X 3 matrix of the unlock pattern view. */ Loading Loading @@ -237,6 +245,20 @@ public class LockPatternView extends View { super(context, attrs); vibe = new Vibrator(); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.LockPatternView); final String aspect = a.getString(R.styleable.LockPatternView_aspect); if ("square".equals(aspect)) { mAspect = ASPECT_SQUARE; } else if ("lock_width".equals(aspect)) { mAspect = ASPECT_LOCK_WIDTH; } else if ("lock_height".equals(aspect)) { mAspect = ASPECT_LOCK_HEIGHT; } else { mAspect = ASPECT_SQUARE; } setClickable(true); mPathPaint.setAntiAlias(true); Loading Loading @@ -425,8 +447,22 @@ public class LockPatternView extends View { protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { final int width = MeasureSpec.getSize(widthMeasureSpec); final int height = MeasureSpec.getSize(heightMeasureSpec); final int squareSide = Math.min(width, height); setMeasuredDimension(squareSide, squareSide); int viewWidth = width; int viewHeight = height; switch (mAspect) { case ASPECT_SQUARE: viewWidth = viewHeight = Math.min(width, height); break; case ASPECT_LOCK_WIDTH: viewWidth = width; viewHeight = Math.min(width, height); break; case ASPECT_LOCK_HEIGHT: viewWidth = Math.min(width, height); viewHeight = height; break; } setMeasuredDimension(viewWidth, viewHeight); } /** Loading
core/res/res/layout/keyguard_screen_unlock_portrait.xml +1 −0 Original line number Diff line number Diff line Loading @@ -153,6 +153,7 @@ android:layout_height="0dip" android:layout_weight="1" android:layout_marginTop="2dip" android:aspect="@string/lock_pattern_view_aspect" /> <!-- footer --> Loading
core/res/res/values-port-mdpi/donottranslate.xml 0 → 100644 +23 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- /* //device/apps/common/assets/res/any/strings.xml ** ** Copyright 2009, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ --> <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <!-- @hide DO NOT TRANSLATE. There isn't enough room on mdpi devices, allow height to vary --> <string name="lock_pattern_view_aspect">lock_width</string> </resources>
core/res/res/values/attrs.xml +12 −1 Original line number Diff line number Diff line Loading @@ -3624,6 +3624,17 @@ <attr name="orientation" /> </declare-styleable> <!-- =============================== --> <!-- LockPatternView class attributes --> <!-- =============================== --> <eat-comment /> <declare-styleable name="LockPatternView"> <!-- Aspect to use when drawing LockPatternView. Choices are "square"(default), "lock_width" or "lock_height" --> <attr name="aspect" format="string" /> </declare-styleable> <!-- Use <code>recognition-service</code> as the root tag of the XML resource that describes a {@link android.speech.RecognitionService}, which is reference from its {@link android.speech.RecognitionService#SERVICE_META_DATA} meta-data entry. Loading
core/res/res/values/donottranslate.xml +2 −0 Original line number Diff line number Diff line Loading @@ -22,4 +22,6 @@ <string name="default_text_encoding">Latin-1</string> <!-- @hide DO NOT TRANSLATE. Workaround for resource race condition in lockscreen. --> <bool name="lockscreen_isPortrait">true</bool> <!-- @hide DO NOT TRANSLATE. Control aspect ratio of lock pattern --> <string name="lock_pattern_view_aspect">square</string> </resources>