diff options
author | Jim Miller <jaggies@google.com> | 2012-09-26 14:29:18 -0700 |
---|---|---|
committer | Jim Miller <jaggies@google.com> | 2012-09-27 15:49:30 -0700 |
commit | 3af630c8d18bcf4b23a5a308917319dd04cc8ed2 (patch) | |
tree | 9e005dbb4a6890cd2eec5a032239403b8797c801 /core/java/com/android | |
parent | 13987fb43255ccb3802d415e32b1c5caf14291bb (diff) | |
download | frameworks_base-3af630c8d18bcf4b23a5a308917319dd04cc8ed2.zip frameworks_base-3af630c8d18bcf4b23a5a308917319dd04cc8ed2.tar.gz frameworks_base-3af630c8d18bcf4b23a5a308917319dd04cc8ed2.tar.bz2 |
Update keyguard layouts on phone
- Go back to using old date format
- All keyguard text is now caps
- Lower brightness on emergency call text
- Fixed CR/LF issue with Owner info
- Added new alarm icon and fixed padding
- Swapped Google Now and lock icon in landscape mode
- Centered PIN/Password/Pattern help text in view in portrait
- Fixed keyboard size issue in landscape
- Merge new assets from UX
Change-Id: I7adb44b6c9a57d40cab0a77433d43291fb277568
Diffstat (limited to 'core/java/com/android')
-rw-r--r-- | core/java/com/android/internal/widget/PasswordEntryKeyboardHelper.java | 84 |
1 files changed, 56 insertions, 28 deletions
diff --git a/core/java/com/android/internal/widget/PasswordEntryKeyboardHelper.java b/core/java/com/android/internal/widget/PasswordEntryKeyboardHelper.java index 26518eb..f8332c4 100644 --- a/core/java/com/android/internal/widget/PasswordEntryKeyboardHelper.java +++ b/core/java/com/android/internal/widget/PasswordEntryKeyboardHelper.java @@ -31,6 +31,7 @@ import android.view.KeyCharacterMap; import android.view.KeyEvent; import android.view.View; import android.view.ViewGroup; +import android.view.ViewGroup.LayoutParams; import android.view.ViewRootImpl; import com.android.internal.R; @@ -55,23 +56,56 @@ public class PasswordEntryKeyboardHelper implements OnKeyboardActionListener { private long[] mVibratePattern; private boolean mEnableHaptics = false; + private static final int NUMERIC = 0; + private static final int QWERTY = 1; + private static final int QWERTY_SHIFTED = 2; + private static final int SYMBOLS = 3; + private static final int SYMBOLS_SHIFTED = 4; + + int mLayouts[] = new int[] { + R.xml.password_kbd_numeric, + R.xml.password_kbd_qwerty, + R.xml.password_kbd_qwerty_shifted, + R.xml.password_kbd_symbols, + R.xml.password_kbd_symbols_shift + }; + + private boolean mUsingScreenWidth; + public PasswordEntryKeyboardHelper(Context context, KeyboardView keyboardView, View targetView) { - this(context, keyboardView, targetView, true); + this(context, keyboardView, targetView, true, null); } public PasswordEntryKeyboardHelper(Context context, KeyboardView keyboardView, View targetView, boolean useFullScreenWidth) { + this(context, keyboardView, targetView, useFullScreenWidth, null); + } + + public PasswordEntryKeyboardHelper(Context context, KeyboardView keyboardView, View targetView, + boolean useFullScreenWidth, int layouts[]) { mContext = context; mTargetView = targetView; mKeyboardView = keyboardView; - if (useFullScreenWidth - || mKeyboardView.getLayoutParams().width == ViewGroup.LayoutParams.MATCH_PARENT) { - createKeyboards(); + mKeyboardView.setOnKeyboardActionListener(this); + mUsingScreenWidth = useFullScreenWidth; + if (layouts != null) { + if (layouts.length != mLayouts.length) { + throw new RuntimeException("Wrong number of layouts"); + } + for (int i = 0; i < mLayouts.length; i++) { + mLayouts[i] = layouts[i]; + } + } + createKeyboards(); + } + + public void createKeyboards() { + LayoutParams lp = mKeyboardView.getLayoutParams(); + if (mUsingScreenWidth || lp.width == ViewGroup.LayoutParams.MATCH_PARENT) { + createKeyboardsWithDefaultWidth(); } else { - createKeyboardsWithSpecificSize(mKeyboardView.getLayoutParams().width, - mKeyboardView.getLayoutParams().height); + createKeyboardsWithSpecificSize(lp.width, lp.height); } - mKeyboardView.setOnKeyboardActionListener(this); } public void setEnableHaptics(boolean enabled) { @@ -82,46 +116,40 @@ 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); + private void createKeyboardsWithSpecificSize(int width, int height) { + mNumericKeyboard = new PasswordEntryKeyboard(mContext, mLayouts[NUMERIC], width, height); + mQwertyKeyboard = new PasswordEntryKeyboard(mContext, mLayouts[QWERTY], R.id.mode_normal, + width, height); mQwertyKeyboard.enableShiftLock(); - mQwertyKeyboardShifted = new PasswordEntryKeyboard(mContext, - R.xml.password_kbd_qwerty_shifted, - R.id.mode_normal, viewWidth, viewHeight); + mQwertyKeyboardShifted = new PasswordEntryKeyboard(mContext, mLayouts[QWERTY_SHIFTED], + R.id.mode_normal, width, height); mQwertyKeyboardShifted.enableShiftLock(); mQwertyKeyboardShifted.setShifted(true); // always shifted. - mSymbolsKeyboard = new PasswordEntryKeyboard(mContext, R.xml.password_kbd_symbols, - viewWidth, viewHeight); + mSymbolsKeyboard = new PasswordEntryKeyboard(mContext, mLayouts[SYMBOLS], width, height); mSymbolsKeyboard.enableShiftLock(); - mSymbolsKeyboardShifted = new PasswordEntryKeyboard(mContext, - R.xml.password_kbd_symbols_shift, viewWidth, viewHeight); + mSymbolsKeyboardShifted = new PasswordEntryKeyboard(mContext, mLayouts[SYMBOLS_SHIFTED], + width, height); mSymbolsKeyboardShifted.enableShiftLock(); mSymbolsKeyboardShifted.setShifted(true); // always shifted } - private void createKeyboards() { - mNumericKeyboard = new PasswordEntryKeyboard(mContext, R.xml.password_kbd_numeric); - mQwertyKeyboard = new PasswordEntryKeyboard(mContext, - R.xml.password_kbd_qwerty, R.id.mode_normal); + private void createKeyboardsWithDefaultWidth() { + mNumericKeyboard = new PasswordEntryKeyboard(mContext, mLayouts[NUMERIC]); + mQwertyKeyboard = new PasswordEntryKeyboard(mContext, mLayouts[QWERTY], R.id.mode_normal); mQwertyKeyboard.enableShiftLock(); - mQwertyKeyboardShifted = new PasswordEntryKeyboard(mContext, - R.xml.password_kbd_qwerty_shifted, + mQwertyKeyboardShifted = new PasswordEntryKeyboard(mContext, mLayouts[QWERTY_SHIFTED], R.id.mode_normal); mQwertyKeyboardShifted.enableShiftLock(); mQwertyKeyboardShifted.setShifted(true); // always shifted. - mSymbolsKeyboard = new PasswordEntryKeyboard(mContext, R.xml.password_kbd_symbols); + mSymbolsKeyboard = new PasswordEntryKeyboard(mContext, mLayouts[SYMBOLS]); mSymbolsKeyboard.enableShiftLock(); - mSymbolsKeyboardShifted = new PasswordEntryKeyboard(mContext, - R.xml.password_kbd_symbols_shift); + mSymbolsKeyboardShifted = new PasswordEntryKeyboard(mContext, mLayouts[SYMBOLS_SHIFTED]); mSymbolsKeyboardShifted.enableShiftLock(); mSymbolsKeyboardShifted.setShifted(true); // always shifted } |