PIN pad cosmetics.

Also pull the Klondike telephone exchange letter strings out
into arrays.xml so we can override it for specific locales.

Change-Id: Idf79ff8bfd53e5a8277271cc85ac7a1784ae3b64
This commit is contained in:
Daniel Sandler
2012-10-24 00:21:32 -04:00
parent 2c1ce0564f
commit d5692742c1
13 changed files with 79 additions and 48 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 823 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 823 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -31,34 +31,37 @@
android:orientation="horizontal"
android:layout_weight="1"
>
<EditText android:id="@+id/passwordEntry"
<TextView android:id="@+id/passwordEntry"
android:editable="true"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_horizontal"
android:layout_gravity="center_vertical"
android:gravity="center"
android:layout_marginStart="@*android:dimen/keyguard_lockscreen_pin_margin_left"
android:singleLine="true"
android:textStyle="normal"
android:inputType="textPassword"
android:cursorVisible="false"
android:textSize="36sp"
android:background="@null"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#ffffffff"
android:textAppearance="@android:style/TextAppearance.NumPadKey"
android:imeOptions="flagForceAscii|actionDone"
/>
<ImageButton android:id="@+id/delete_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:src="@*android:drawable/ic_input_delete"
android:clickable="true"
android:padding="8dip"
android:paddingTop="8dip"
android:paddingBottom="8dip"
android:paddingLeft="24dp"
android:paddingRight="24dp"
android:background="?android:attr/selectableItemBackground"
/>
</LinearLayout>
<View
android:layout_width="wrap_content"
android:layout_height="1dp"
android:background="#55FFFFFF"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
@@ -67,7 +70,7 @@
>
<view class="com.android.internal.policy.impl.keyguard.NumPadKey"
android:id="@+id/key1"
style="@style/PINButton"
style="@style/Widget.Button.NumPadKey"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="1"
@@ -76,7 +79,7 @@
/>
<view class="com.android.internal.policy.impl.keyguard.NumPadKey"
android:id="@+id/key2"
style="@style/PINButton"
style="@style/Widget.Button.NumPadKey"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="1"
@@ -85,7 +88,7 @@
/>
<view class="com.android.internal.policy.impl.keyguard.NumPadKey"
android:id="@+id/key3"
style="@style/PINButton"
style="@style/Widget.Button.NumPadKey"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="1"
@@ -101,7 +104,7 @@
>
<view class="com.android.internal.policy.impl.keyguard.NumPadKey"
android:id="@+id/key4"
style="@style/PINButton"
style="@style/Widget.Button.NumPadKey"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="1"
@@ -110,7 +113,7 @@
/>
<view class="com.android.internal.policy.impl.keyguard.NumPadKey"
android:id="@+id/key5"
style="@style/PINButton"
style="@style/Widget.Button.NumPadKey"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="1"
@@ -119,7 +122,7 @@
/>
<view class="com.android.internal.policy.impl.keyguard.NumPadKey"
android:id="@+id/key6"
style="@style/PINButton"
style="@style/Widget.Button.NumPadKey"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="1"
@@ -135,7 +138,7 @@
>
<view class="com.android.internal.policy.impl.keyguard.NumPadKey"
android:id="@+id/key7"
style="@style/PINButton"
style="@style/Widget.Button.NumPadKey"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="1"
@@ -144,7 +147,7 @@
/>
<view class="com.android.internal.policy.impl.keyguard.NumPadKey"
android:id="@+id/key8"
style="@style/PINButton"
style="@style/Widget.Button.NumPadKey"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="1"
@@ -153,7 +156,7 @@
/>
<view class="com.android.internal.policy.impl.keyguard.NumPadKey"
android:id="@+id/key9"
style="@style/PINButton"
style="@style/Widget.Button.NumPadKey"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="1"
@@ -174,21 +177,21 @@
/>
<view class="com.android.internal.policy.impl.keyguard.NumPadKey"
android:id="@+id/key0"
style="@style/PINButton"
style="@style/Widget.Button.NumPadKey"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="1"
androidprv:textView="@+id/passwordEntry"
androidprv:digit="0"
/>
<Button
android:id="@+id/keyOK"
style="@style/PINButton"
<ImageButton
android:id="@+id/key_enter"
style="@android:style/Widget.Button.NumPadKey"
android:gravity="center"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="@android:string/ok"
android:src="@drawable/sym_keyboard_return_holo"
/>
</LinearLayout>

View File

@@ -398,4 +398,17 @@
<item>@null</item>
</array>
<!-- list of 3- or 4-letter mnemonics for a 10-key numeric keypad -->
<string-array translatable="false" name="lockscreen_num_pad_klondike">
<item></item><!-- 0 -->
<item></item><!-- 1 -->
<item>ABC</item><!-- 2 -->
<item>DEF</item><!-- 3 -->
<item>GHI</item><!-- 4 -->
<item>JKL</item><!-- 5 -->
<item>MNO</item><!-- 6 -->
<item>PQRS</item><!-- 7 -->
<item>TUV</item><!-- 8 -->
<item>WXYZ</item><!-- 9 -->
</string-array>
</resources>

View File

@@ -2479,20 +2479,26 @@ please see styles_device_defaults.xml.
</style>
<!-- Keyguard PIN pad styles -->
<style name="PINButton" parent="@android:style/Widget.Button">
<style name="Widget.Button.NumPadKey">
<item name="android:singleLine">true</item>
<item name="android:padding">6dip</item>
<item name="android:gravity">left|center_vertical</item>
<item name="android:background">?android:attr/selectableItemBackground</item>
<item name="android:textSize">30dp</item>
<item name="android:fontFamily">sans-serif-light</item>
<item name="android:textSize">34dp</item>
<item name="android:fontFamily">sans-serif</item>
<item name="android:textStyle">normal</item>
<item name="android:textColor">#ffffff</item>
</style>
<style name="PINButtonKlondikeText">
<item name="android:textSize">20dp</item>
<style name="TextAppearance.NumPadKey">
<item name="android:textSize">34dp</item>
<item name="android:fontFamily">sans-serif</item>
<item name="android:textStyle">normal</item>
<item name="android:textColor">#ffffff</item>
</style>
<style name="TextAppearance.NumPadKey.Klondike">
<item name="android:textSize">20dp</item>
<item name="android:fontFamily">sans-serif-condensed</item>
<item name="android:textStyle">normal</item>
<item name="android:textColor">#80ffffff</item>
</style>
</resources>

View File

@@ -962,6 +962,7 @@
<java-symbol type="drawable" name="status_bar_background" />
<java-symbol type="drawable" name="sym_keyboard_shift" />
<java-symbol type="drawable" name="sym_keyboard_shift_locked" />
<java-symbol type="drawable" name="sym_keyboard_return_holo" />
<java-symbol type="drawable" name="tab_bottom_left" />
<java-symbol type="drawable" name="tab_bottom_left_v4" />
<java-symbol type="drawable" name="tab_bottom_right" />
@@ -1177,6 +1178,7 @@
<java-symbol type="array" name="lockscreen_targets_when_silent" />
<java-symbol type="array" name="lockscreen_targets_when_soundon" />
<java-symbol type="array" name="lockscreen_targets_with_camera" />
<java-symbol type="array" name="lockscreen_num_pad_klondike" />
<java-symbol type="attr" name="actionModePopupWindowStyle" />
<java-symbol type="attr" name="dialogCustomTitleDecorLayout" />
<java-symbol type="attr" name="dialogTitleDecorLayout" />
@@ -1322,7 +1324,7 @@
<java-symbol type="id" name="sliding_layout" />
<java-symbol type="id" name="multi_pane_challenge" />
<java-symbol type="id" name="keyguard_user_selector" />
<java-symbol type="id" name="keyOK" />
<java-symbol type="id" name="key_enter" />
<java-symbol type="integer" name="config_carDockRotation" />
<java-symbol type="integer" name="config_defaultUiModeType" />
<java-symbol type="integer" name="config_deskDockRotation" />
@@ -1421,7 +1423,9 @@
<java-symbol type="style" name="Animation.LockScreen" />
<java-symbol type="style" name="Theme.Dialog.RecentApplications" />
<java-symbol type="style" name="Theme.ExpandedMenu" />
<java-symbol type="style" name="PINButtonKlondikeText" />
<java-symbol type="style" name="Widget.Button.NumPadKey" />
<java-symbol type="style" name="TextAppearance.NumPadKey" />
<java-symbol type="style" name="TextAppearance.NumPadKey.Klondike" />
<java-symbol type="string" name="kg_emergency_call_label" />
<java-symbol type="string" name="kg_forgot_pattern_button_text" />
<java-symbol type="string" name="kg_wrong_pattern" />

View File

@@ -58,7 +58,7 @@ import com.android.internal.R;
public abstract class KeyguardAbsKeyInputView extends LinearLayout
implements KeyguardSecurityView, OnEditorActionListener, TextWatcher {
protected KeyguardSecurityCallback mCallback;
protected EditText mPasswordEntry;
protected TextView mPasswordEntry;
protected LockPatternUtils mLockPatternUtils;
protected SecurityMessageDisplay mSecurityMessageDisplay;
@@ -112,7 +112,7 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout
mLockPatternUtils = new LockPatternUtils(mContext); // TODO: use common one
mPasswordEntry = (EditText) findViewById(R.id.passwordEntry);
mPasswordEntry = (TextView) findViewById(R.id.passwordEntry);
mPasswordEntry.setOnEditorActionListener(this);
mPasswordEntry.addTextChangedListener(this);

View File

@@ -82,7 +82,7 @@ public class KeyguardPINView extends KeyguardAbsKeyInputView
protected void onFinishInflate() {
super.onFinishInflate();
final View ok = findViewById(R.id.keyOK);
final View ok = findViewById(R.id.key_enter);
if (ok != null) {
ok.setOnClickListener(new View.OnClickListener() {
@Override
@@ -99,7 +99,7 @@ public class KeyguardPINView extends KeyguardAbsKeyInputView
pinDelete.setVisibility(View.VISIBLE);
pinDelete.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Editable str = mPasswordEntry.getText();
CharSequence str = mPasswordEntry.getText();
if (str.length() > 0) {
mPasswordEntry.setText(str.subSequence(0, str.length()-1));
}

View File

@@ -29,9 +29,8 @@ import android.widget.TextView;
import com.android.internal.R;
public class NumPadKey extends Button {
// XXX localize
static final String KLONDIKE[] = {
"", "", " ABC", " DEF", " GHI", " JKL", " MNO", " PQRS", " TUV", " WXYZ" };
// list of "ABC", etc per digit, starting with '0'
static String sKlondike[];
int mDigit = -1;
int mTextViewResId;
@@ -74,13 +73,19 @@ public class NumPadKey extends Button {
SpannableStringBuilder builder = new SpannableStringBuilder();
builder.append(String.valueOf(mDigit));
if (mDigit >= 0) {
final String extra = KLONDIKE[mDigit];
final int extraLen = extra.length();
if (extraLen > 0) {
builder.append(extra);
builder.setSpan(
new TextAppearanceSpan(context, R.style.PINButtonKlondikeText),
if (sKlondike == null) {
sKlondike = context.getResources().getStringArray(
R.array.lockscreen_num_pad_klondike);
}
if (sKlondike != null && sKlondike.length > mDigit) {
final String extra = sKlondike[mDigit];
final int extraLen = extra.length();
if (extraLen > 0) {
builder.append(extra);
builder.setSpan(
new TextAppearanceSpan(context, R.style.TextAppearance_NumPadKey_Klondike),
builder.length()-extraLen, builder.length(), 0);
}
}
}
setText(builder);
@@ -94,4 +99,4 @@ public class NumPadKey extends Button {
mTextView = null;
mTextViewResId = resId;
}
}
}