diff options
| author | Jae Yong Sung <jysung@google.com> | 2010-08-05 10:44:27 -0700 |
|---|---|---|
| committer | Jae Yong Sung <jysung@google.com> | 2010-08-13 15:08:05 -0700 |
| commit | 8171b5182f5f07d33c9dfdf2dd8f0f6ae9588039 (patch) | |
| tree | 8c6c4b9de2a045809ce420a89edd76e6bf837f25 /core/java | |
| parent | aece2d0ca012144007870db9bb2cf0e360cbb973 (diff) | |
| download | frameworks_base-8171b5182f5f07d33c9dfdf2dd8f0f6ae9588039.zip frameworks_base-8171b5182f5f07d33c9dfdf2dd8f0f6ae9588039.tar.gz frameworks_base-8171b5182f5f07d33c9dfdf2dd8f0f6ae9588039.tar.bz2 | |
lock screen for xlarge
Change-Id: Iab9f53609bf24be774752a9960aaaa654d7a614f
Diffstat (limited to 'core/java')
3 files changed, 72 insertions, 2 deletions
diff --git a/core/java/android/inputmethodservice/Keyboard.java b/core/java/android/inputmethodservice/Keyboard.java index 4814b0a..885a6b8 100755 --- a/core/java/android/inputmethodservice/Keyboard.java +++ b/core/java/android/inputmethodservice/Keyboard.java @@ -500,7 +500,30 @@ public class Keyboard { public Keyboard(Context context, int xmlLayoutResId) { this(context, xmlLayoutResId, 0); } - + + /** + * Creates a keyboard from the given xml key layout file. Weeds out rows + * that have a keyboard mode defined but don't match the specified mode. + * @param context the application or service context + * @param xmlLayoutResId the resource file that contains the keyboard layout and keys. + * @param modeId keyboard mode identifier + * @param width sets width of keyboard + * @param height sets height of keyboard + */ + public Keyboard(Context context, int xmlLayoutResId, int modeId, int width, int height) { + mDisplayWidth = width; + mDisplayHeight = height; + + mDefaultHorizontalGap = 0; + mDefaultWidth = mDisplayWidth / 10; + mDefaultVerticalGap = 0; + mDefaultHeight = mDefaultWidth; + mKeys = new ArrayList<Key>(); + mModifierKeys = new ArrayList<Key>(); + mKeyboardMode = modeId; + loadKeyboard(context, context.getResources().getXml(xmlLayoutResId)); + } + /** * Creates a keyboard from the given xml key layout file. Weeds out rows * that have a keyboard mode defined but don't match the specified mode. diff --git a/core/java/com/android/internal/widget/PasswordEntryKeyboard.java b/core/java/com/android/internal/widget/PasswordEntryKeyboard.java index e1a6737..facda36 100644 --- a/core/java/com/android/internal/widget/PasswordEntryKeyboard.java +++ b/core/java/com/android/internal/widget/PasswordEntryKeyboard.java @@ -67,8 +67,22 @@ public class PasswordEntryKeyboard extends Keyboard { this(context, xmlLayoutResId, 0); } + public PasswordEntryKeyboard(Context context, int xmlLayoutResId, int width, int height) { + this(context, xmlLayoutResId, 0, width, height); + } + public PasswordEntryKeyboard(Context context, int xmlLayoutResId, int mode) { super(context, xmlLayoutResId, mode); + init(context); + } + + public PasswordEntryKeyboard(Context context, int xmlLayoutResId, int mode, + int width, int height) { + super(context, xmlLayoutResId, mode, width, height); + init(context); + } + + private void init(Context context) { final Resources res = context.getResources(); mRes = res; mShiftIcon = res.getDrawable(R.drawable.sym_keyboard_shift); diff --git a/core/java/com/android/internal/widget/PasswordEntryKeyboardHelper.java b/core/java/com/android/internal/widget/PasswordEntryKeyboardHelper.java index 53720e4..384f7bc 100644 --- a/core/java/com/android/internal/widget/PasswordEntryKeyboardHelper.java +++ b/core/java/com/android/internal/widget/PasswordEntryKeyboardHelper.java @@ -54,10 +54,20 @@ public class PasswordEntryKeyboardHelper implements OnKeyboardActionListener { private Vibrator mVibrator; public PasswordEntryKeyboardHelper(Context context, KeyboardView keyboardView, View targetView) { + this(context, keyboardView, targetView, true); + } + + public PasswordEntryKeyboardHelper(Context context, KeyboardView keyboardView, View targetView, + boolean useFullScreenWidth) { mContext = context; mTargetView = targetView; mKeyboardView = keyboardView; - createKeyboards(); + if (useFullScreenWidth || mKeyboardView.getLayoutParams().width == -1) { + createKeyboards(); + } else { + createKeyboardsWithSpecificSize(mKeyboardView.getLayoutParams().width, + mKeyboardView.getLayoutParams().height); + } mKeyboardView.setOnKeyboardActionListener(this); mVibrator = new Vibrator(); } @@ -66,6 +76,29 @@ public class PasswordEntryKeyboardHelper implements OnKeyboardActionListener { return mKeyboardMode == KEYBOARD_MODE_ALPHA; } + private void createKeyboardsWithSpecificSize(int viewWidth, int viewHeight) { + mNumericKeyboard = new PasswordEntryKeyboard(mContext, R.xml.password_kbd_numeric, + viewWidth, viewHeight); + mQwertyKeyboard = new PasswordEntryKeyboard(mContext, + R.xml.password_kbd_qwerty, R.id.mode_normal, viewWidth, viewHeight); + mQwertyKeyboard.enableShiftLock(); + + mQwertyKeyboardShifted = new PasswordEntryKeyboard(mContext, + R.xml.password_kbd_qwerty_shifted, + R.id.mode_normal, viewWidth, viewHeight); + mQwertyKeyboardShifted.enableShiftLock(); + mQwertyKeyboardShifted.setShifted(true); // always shifted. + + mSymbolsKeyboard = new PasswordEntryKeyboard(mContext, R.xml.password_kbd_symbols, + viewWidth, viewHeight); + mSymbolsKeyboard.enableShiftLock(); + + mSymbolsKeyboardShifted = new PasswordEntryKeyboard(mContext, + R.xml.password_kbd_symbols_shift, viewWidth, viewHeight); + mSymbolsKeyboardShifted.enableShiftLock(); + mSymbolsKeyboardShifted.setShifted(true); // always shifted + } + private void createKeyboards() { mNumericKeyboard = new PasswordEntryKeyboard(mContext, R.xml.password_kbd_numeric); mQwertyKeyboard = new PasswordEntryKeyboard(mContext, |
