Skip to content

Commit 3af630c

Browse files
author
Jim Miller
committed
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
1 parent 13987fb commit 3af630c

File tree

70 files changed

+358
-141
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+358
-141
lines changed

core/java/com/android/internal/widget/PasswordEntryKeyboardHelper.java

Lines changed: 56 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import android.view.KeyEvent;
3232
import android.view.View;
3333
import android.view.ViewGroup;
34+
import android.view.ViewGroup.LayoutParams;
3435
import android.view.ViewRootImpl;
3536
import com.android.internal.R;
3637

@@ -55,23 +56,56 @@ public class PasswordEntryKeyboardHelper implements OnKeyboardActionListener {
5556
private long[] mVibratePattern;
5657
private boolean mEnableHaptics = false;
5758

59+
private static final int NUMERIC = 0;
60+
private static final int QWERTY = 1;
61+
private static final int QWERTY_SHIFTED = 2;
62+
private static final int SYMBOLS = 3;
63+
private static final int SYMBOLS_SHIFTED = 4;
64+
65+
int mLayouts[] = new int[] {
66+
R.xml.password_kbd_numeric,
67+
R.xml.password_kbd_qwerty,
68+
R.xml.password_kbd_qwerty_shifted,
69+
R.xml.password_kbd_symbols,
70+
R.xml.password_kbd_symbols_shift
71+
};
72+
73+
private boolean mUsingScreenWidth;
74+
5875
public PasswordEntryKeyboardHelper(Context context, KeyboardView keyboardView, View targetView) {
59-
this(context, keyboardView, targetView, true);
76+
this(context, keyboardView, targetView, true, null);
6077
}
6178

6279
public PasswordEntryKeyboardHelper(Context context, KeyboardView keyboardView, View targetView,
6380
boolean useFullScreenWidth) {
81+
this(context, keyboardView, targetView, useFullScreenWidth, null);
82+
}
83+
84+
public PasswordEntryKeyboardHelper(Context context, KeyboardView keyboardView, View targetView,
85+
boolean useFullScreenWidth, int layouts[]) {
6486
mContext = context;
6587
mTargetView = targetView;
6688
mKeyboardView = keyboardView;
67-
if (useFullScreenWidth
68-
|| mKeyboardView.getLayoutParams().width == ViewGroup.LayoutParams.MATCH_PARENT) {
69-
createKeyboards();
89+
mKeyboardView.setOnKeyboardActionListener(this);
90+
mUsingScreenWidth = useFullScreenWidth;
91+
if (layouts != null) {
92+
if (layouts.length != mLayouts.length) {
93+
throw new RuntimeException("Wrong number of layouts");
94+
}
95+
for (int i = 0; i < mLayouts.length; i++) {
96+
mLayouts[i] = layouts[i];
97+
}
98+
}
99+
createKeyboards();
100+
}
101+
102+
public void createKeyboards() {
103+
LayoutParams lp = mKeyboardView.getLayoutParams();
104+
if (mUsingScreenWidth || lp.width == ViewGroup.LayoutParams.MATCH_PARENT) {
105+
createKeyboardsWithDefaultWidth();
70106
} else {
71-
createKeyboardsWithSpecificSize(mKeyboardView.getLayoutParams().width,
72-
mKeyboardView.getLayoutParams().height);
107+
createKeyboardsWithSpecificSize(lp.width, lp.height);
73108
}
74-
mKeyboardView.setOnKeyboardActionListener(this);
75109
}
76110

77111
public void setEnableHaptics(boolean enabled) {
@@ -82,46 +116,40 @@ public boolean isAlpha() {
82116
return mKeyboardMode == KEYBOARD_MODE_ALPHA;
83117
}
84118

85-
private void createKeyboardsWithSpecificSize(int viewWidth, int viewHeight) {
86-
mNumericKeyboard = new PasswordEntryKeyboard(mContext, R.xml.password_kbd_numeric,
87-
viewWidth, viewHeight);
88-
mQwertyKeyboard = new PasswordEntryKeyboard(mContext,
89-
R.xml.password_kbd_qwerty, R.id.mode_normal, viewWidth, viewHeight);
119+
private void createKeyboardsWithSpecificSize(int width, int height) {
120+
mNumericKeyboard = new PasswordEntryKeyboard(mContext, mLayouts[NUMERIC], width, height);
121+
mQwertyKeyboard = new PasswordEntryKeyboard(mContext, mLayouts[QWERTY], R.id.mode_normal,
122+
width, height);
90123
mQwertyKeyboard.enableShiftLock();
91124

92-
mQwertyKeyboardShifted = new PasswordEntryKeyboard(mContext,
93-
R.xml.password_kbd_qwerty_shifted,
94-
R.id.mode_normal, viewWidth, viewHeight);
125+
mQwertyKeyboardShifted = new PasswordEntryKeyboard(mContext, mLayouts[QWERTY_SHIFTED],
126+
R.id.mode_normal, width, height);
95127
mQwertyKeyboardShifted.enableShiftLock();
96128
mQwertyKeyboardShifted.setShifted(true); // always shifted.
97129

98-
mSymbolsKeyboard = new PasswordEntryKeyboard(mContext, R.xml.password_kbd_symbols,
99-
viewWidth, viewHeight);
130+
mSymbolsKeyboard = new PasswordEntryKeyboard(mContext, mLayouts[SYMBOLS], width, height);
100131
mSymbolsKeyboard.enableShiftLock();
101132

102-
mSymbolsKeyboardShifted = new PasswordEntryKeyboard(mContext,
103-
R.xml.password_kbd_symbols_shift, viewWidth, viewHeight);
133+
mSymbolsKeyboardShifted = new PasswordEntryKeyboard(mContext, mLayouts[SYMBOLS_SHIFTED],
134+
width, height);
104135
mSymbolsKeyboardShifted.enableShiftLock();
105136
mSymbolsKeyboardShifted.setShifted(true); // always shifted
106137
}
107138

108-
private void createKeyboards() {
109-
mNumericKeyboard = new PasswordEntryKeyboard(mContext, R.xml.password_kbd_numeric);
110-
mQwertyKeyboard = new PasswordEntryKeyboard(mContext,
111-
R.xml.password_kbd_qwerty, R.id.mode_normal);
139+
private void createKeyboardsWithDefaultWidth() {
140+
mNumericKeyboard = new PasswordEntryKeyboard(mContext, mLayouts[NUMERIC]);
141+
mQwertyKeyboard = new PasswordEntryKeyboard(mContext, mLayouts[QWERTY], R.id.mode_normal);
112142
mQwertyKeyboard.enableShiftLock();
113143

114-
mQwertyKeyboardShifted = new PasswordEntryKeyboard(mContext,
115-
R.xml.password_kbd_qwerty_shifted,
144+
mQwertyKeyboardShifted = new PasswordEntryKeyboard(mContext, mLayouts[QWERTY_SHIFTED],
116145
R.id.mode_normal);
117146
mQwertyKeyboardShifted.enableShiftLock();
118147
mQwertyKeyboardShifted.setShifted(true); // always shifted.
119148

120-
mSymbolsKeyboard = new PasswordEntryKeyboard(mContext, R.xml.password_kbd_symbols);
149+
mSymbolsKeyboard = new PasswordEntryKeyboard(mContext, mLayouts[SYMBOLS]);
121150
mSymbolsKeyboard.enableShiftLock();
122151

123-
mSymbolsKeyboardShifted = new PasswordEntryKeyboard(mContext,
124-
R.xml.password_kbd_symbols_shift);
152+
mSymbolsKeyboardShifted = new PasswordEntryKeyboard(mContext, mLayouts[SYMBOLS_SHIFTED]);
125153
mSymbolsKeyboardShifted.enableShiftLock();
126154
mSymbolsKeyboardShifted.setShifted(true); // always shifted
127155
}
1.37 KB
3.99 KB
347 Bytes

core/res/res/drawable-hdpi/sym_keyboard_delete.png

100755100644
-1.11 KB
2.06 KB
159 Bytes

core/res/res/drawable-hdpi/sym_keyboard_num1.png

100755100644
-183 Bytes

core/res/res/drawable-hdpi/sym_keyboard_num2.png

100755100644
-764 Bytes

core/res/res/drawable-hdpi/sym_keyboard_num3.png

100755100644
-846 Bytes

0 commit comments

Comments
 (0)