Merge "Fix 5231823: PIN/Password polish on lock screen" into ics-mr1

This commit is contained in:
Jim Miller
2011-11-07 14:24:43 -08:00
committed by Android (Google) Code Review
10 changed files with 123 additions and 32 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 970 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 778 B

After

Width:  |  Height:  |  Size: 683 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -50,20 +50,56 @@
android:layout_centerVertical="true"
android:layout_marginRight="155dip">
<!-- Password entry field -->
<EditText android:id="@+id/passwordEntry"
android:layout_height="wrap_content"
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:singleLine="true"
android:textStyle="normal"
android:inputType="textPassword"
android:gravity="center"
android:textSize="24sp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:background="@drawable/lockscreen_password_field_dark"
android:textColor="#ffffffff"
android:privateImeOptions="com.google.android.inputmethod.latin.forceAscii"
/>
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="@drawable/lockscreen_password_field_dark">
<EditText android:id="@+id/passwordEntry"
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="1"
android:gravity="center"
android:layout_gravity="center"
android:layout_marginLeft="@dimen/keyguard_lockscreen_pin_margin_left"
android:singleLine="true"
android:textStyle="normal"
android:inputType="textPassword"
android:textSize="24sp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:background="@null"
android:textColor="#ffffffff"
android:imeOptions="flagNoFullscreen|actionDone"
android:privateImeOptions="com.google.android.inputmethod.latin.forceAscii"
/>
<!-- This delete button is only visible for numeric PIN entry -->
<ImageButton android:id="@+id/pinDel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@android:drawable/ic_input_delete"
android:clickable="true"
android:padding="8dip"
android:layout_gravity="center"
android:background="?android:attr/selectableItemBackground"
android:visibility="gone"
/>
<ImageView android:id="@+id/switch_ime_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_lockscreen_ime"
android:clickable="true"
android:padding="8dip"
android:layout_gravity="center"
android:background="?android:attr/selectableItemBackground"
android:visibility="gone"
/>
</LinearLayout>
<!-- Numeric keyboard -->
<com.android.internal.widget.PasswordEntryKeyboardView android:id="@+id/keyboard"
@@ -71,7 +107,7 @@
android:layout_height="330dip"
android:background="#40000000"
android:layout_marginTop="5dip"
android:keyBackground="@drawable/btn_keyboard_key_fulltrans"
android:keyBackground="@drawable/btn_keyboard_key_ics"
android:visibility="gone"
/>
</LinearLayout>

View File

@@ -44,22 +44,56 @@
android:gravity="center">
<!-- Password entry field -->
<EditText android:id="@+id/passwordEntry"
android:layout_height="wrap_content"
<LinearLayout
android:orientation="horizontal"
android:layout_width="330dip"
android:singleLine="true"
android:textStyle="normal"
android:inputType="textPassword"
android:gravity="center"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textSize="24sp"
android:layout_marginTop="120dip"
android:layout_marginBottom="5dip"
android:textAppearance="?android:attr/textAppearanceMedium"
android:background="@drawable/lockscreen_password_field_dark"
android:textColor="#ffffffff"
android:privateImeOptions="com.google.android.inputmethod.latin.forceAscii"
/>
android:background="@drawable/lockscreen_password_field_dark">
<EditText android:id="@+id/passwordEntry"
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="1"
android:singleLine="true"
android:textStyle="normal"
android:inputType="textPassword"
android:gravity="center"
android:layout_gravity="center"
android:layout_marginLeft="@dimen/keyguard_lockscreen_pin_margin_left"
android:textSize="24sp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:background="@null"
android:textColor="#ffffffff"
android:privateImeOptions="com.google.android.inputmethod.latin.forceAscii"
/>
<!-- This delete button is only visible for numeric PIN entry -->
<ImageButton android:id="@+id/pinDel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@android:drawable/ic_input_delete"
android:clickable="true"
android:padding="8dip"
android:layout_gravity="center"
android:background="?android:attr/selectableItemBackground"
android:visibility="gone"
/>
<ImageView android:id="@+id/switch_ime_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_lockscreen_ime"
android:clickable="true"
android:padding="8dip"
android:layout_gravity="center"
android:background="?android:attr/selectableItemBackground"
android:visibility="gone"
/>
</LinearLayout>
<View
android:layout_width="match_parent"
@@ -72,7 +106,7 @@
android:layout_width="330dip"
android:layout_height="260dip"
android:background="#40000000"
android:keyBackground="@drawable/btn_keyboard_key_fulltrans"
android:keyBackground="@drawable/btn_keyboard_key_ics"
android:layout_marginBottom="80dip"
/>

View File

@@ -143,6 +143,8 @@
android:layout_width="0dip"
android:layout_weight="1"
android:gravity="center"
android:layout_marginLeft="@dimen/keyguard_lockscreen_pin_margin_left"
android:layout_gravity="center_vertical"
android:singleLine="true"
android:textStyle="normal"
android:inputType="textPassword"

View File

@@ -109,6 +109,8 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_horizontal"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/keyguard_lockscreen_pin_margin_left"
android:singleLine="true"
android:textStyle="normal"
android:inputType="textPassword"

View File

@@ -169,6 +169,9 @@
<!-- Size of top margin on Clock font to edge on unlock LockScreen -->
<dimen name="keyguard_lockscreen_status_line_clockfont_bottom_margin">12dip</dimen>
<!-- Padding on left margin of PIN text entry field to center it when del button is showing -->
<dimen name="keyguard_lockscreen_pin_margin_left">40dip</dimen>
<!-- Minimum popup width for selecting an activity in ActivityChooserDialog/ActivityChooserView. -->
<dimen name="activity_chooser_popup_min_width">200dip</dimen>

View File

@@ -49,12 +49,10 @@
</Row>
<Row android:rowEdgeFlags="bottom">
<Key android:codes="48" android:keyIcon="@drawable/sym_keyboard_num0_no_plus"
android:keyWidth="66.66%p" android:keyEdgeFlags="left"/>
<Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_ok"
android:keyEdgeFlags="left"/>
<Key android:codes="48" android:keyIcon="@drawable/sym_keyboard_num0_no_plus"/>
<Key android:codes="-5" android:keyIcon="@drawable/sym_keyboard_delete"
android:iconPreview="@drawable/sym_keyboard_feedback_delete"
android:isRepeatable="true" android:keyEdgeFlags="right"/>
android:keyEdgeFlags="right"/>
</Row>
</Keyboard>

View File

@@ -35,15 +35,18 @@ import android.text.InputType;
import android.text.TextWatcher;
import android.text.method.DigitsKeyListener;
import android.text.method.TextKeyListener;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodInfo;
import android.view.inputmethod.InputMethodManager;
import android.view.inputmethod.InputMethodSubtype;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.Space;
import android.widget.TextView;
import android.widget.TextView.OnEditorActionListener;
@@ -114,6 +117,7 @@ public class PasswordUnlockScreen extends LinearLayout implements KeyguardScreen
Settings.Secure.getInt(mContext.getContentResolver(),
Settings.Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED, 0)
!= 0);
boolean imeOrDeleteButtonVisible = false;
if (mIsAlpha) {
// We always use the system IME for alpha keyboard, so hide lockscreen's soft keyboard
mKeyboardHelper.setKeyboardMode(PasswordEntryKeyboardHelper.KEYBOARD_MODE_ALPHA);
@@ -129,6 +133,7 @@ public class PasswordUnlockScreen extends LinearLayout implements KeyguardScreen
View pinDelete = findViewById(R.id.pinDel);
if (pinDelete != null) {
pinDelete.setVisibility(View.VISIBLE);
imeOrDeleteButtonVisible = true;
pinDelete.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
@@ -181,6 +186,7 @@ public class PasswordUnlockScreen extends LinearLayout implements KeyguardScreen
Context.INPUT_METHOD_SERVICE);
if (mIsAlpha && switchImeButton != null && hasMultipleEnabledIMEsOrSubtypes(imm, false)) {
switchImeButton.setVisibility(View.VISIBLE);
imeOrDeleteButtonVisible = true;
switchImeButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
mCallback.pokeWakelock(); // Leave the screen on a bit longer
@@ -188,6 +194,16 @@ public class PasswordUnlockScreen extends LinearLayout implements KeyguardScreen
}
});
}
// If no icon is visible, reset the left margin on the password field so the text is
// still centered.
if (!imeOrDeleteButtonVisible) {
android.view.ViewGroup.LayoutParams params = mPasswordEntry.getLayoutParams();
if (params instanceof MarginLayoutParams) {
((MarginLayoutParams)params).leftMargin = 0;
mPasswordEntry.setLayoutParams(params);
}
}
}
/**