Merge "New PIN unlock screen layout."

This commit is contained in:
Ben Komalo
2011-10-04 14:27:24 -07:00
committed by Android (Google) Code Review
5 changed files with 62 additions and 25 deletions

View File

@ -48,11 +48,11 @@ public class PasswordEntryKeyboardHelper implements OnKeyboardActionListener {
private PasswordEntryKeyboard mSymbolsKeyboard;
private PasswordEntryKeyboard mSymbolsKeyboardShifted;
private PasswordEntryKeyboard mNumericKeyboard;
private Context mContext;
private View mTargetView;
private KeyboardView mKeyboardView;
private final Context mContext;
private final View mTargetView;
private final KeyboardView mKeyboardView;
private long[] mVibratePattern;
private Vibrator mVibrator;
private final Vibrator mVibrator;
public PasswordEntryKeyboardHelper(Context context, KeyboardView keyboardView, View targetView) {
this(context, keyboardView, targetView, true);
@ -228,7 +228,7 @@ public class PasswordEntryKeyboardHelper implements OnKeyboardActionListener {
}
}
private void handleBackspace() {
public void handleBackspace() {
sendDownUpKeyEvents(KeyEvent.KEYCODE_DEL);
}

View File

@ -135,7 +135,8 @@
<LinearLayout
android:orientation="horizontal"
android:layout_width="270dip"
android:layout_gravity="center_vertical">
android:layout_gravity="center_vertical"
android:background="@drawable/lockscreen_password_field_dark">
<EditText android:id="@+id/passwordEntry"
android:layout_height="wrap_content"
@ -148,11 +149,23 @@
android:textSize="24sp"
android:minEms="8"
android:textAppearance="?android:attr/textAppearanceMedium"
android:background="@drawable/lockscreen_password_field_dark"
android:background="@null"
android:textColor="?android:attr/textColorPrimary"
android:imeOptions="flagNoFullscreen|actionDone"
/>
<!-- 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"

View File

@ -95,9 +95,12 @@
/>
<!-- Password entry field -->
<!-- Note: the entire container is styled to look like the edit field,
since the backspace/IME switcher looks better inside -->
<LinearLayout
android:layout_gravity="center_vertical|fill_horizontal"
android:orientation="horizontal"
android:background="@drawable/lockscreen_password_field_dark"
android:layout_marginLeft="16dip"
android:layout_marginRight="16dip">
@ -110,12 +113,24 @@
android:textStyle="normal"
android:inputType="textPassword"
android:textSize="36sp"
android:background="@drawable/lockscreen_password_field_dark"
android:background="@null"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#ffffffff"
android:imeOptions="actionDone"
/>
<!-- 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_vertical"
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"

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

@ -60,19 +60,18 @@ public class PasswordUnlockScreen extends LinearLayout implements KeyguardScreen
private final KeyguardUpdateMonitor mUpdateMonitor;
private final KeyguardScreenCallback mCallback;
private boolean mIsAlpha;
private final boolean mIsAlpha;
private EditText mPasswordEntry;
private LockPatternUtils mLockPatternUtils;
private PasswordEntryKeyboardView mKeyboardView;
private PasswordEntryKeyboardHelper mKeyboardHelper;
private final EditText mPasswordEntry;
private final LockPatternUtils mLockPatternUtils;
private final PasswordEntryKeyboardView mKeyboardView;
private final PasswordEntryKeyboardHelper mKeyboardHelper;
private int mCreationOrientation;
private int mCreationHardKeyboardHidden;
private CountDownTimer mCountdownTimer;
private final int mCreationOrientation;
private final int mCreationHardKeyboardHidden;
private KeyguardStatusViewManager mStatusViewManager;
private boolean mUseSystemIME = true; // TODO: Make configurable
private final KeyguardStatusViewManager mStatusViewManager;
private final boolean mUseSystemIME = true; // TODO: Make configurable
private boolean mResuming; // used to prevent poking the wakelock during onResume()
// To avoid accidental lockout due to events while the device in in the pocket, ignore
@ -119,6 +118,19 @@ public class PasswordUnlockScreen extends LinearLayout implements KeyguardScreen
mKeyboardHelper.setKeyboardMode(PasswordEntryKeyboardHelper.KEYBOARD_MODE_NUMERIC);
mKeyboardView.setVisibility(mCreationHardKeyboardHidden
== Configuration.HARDKEYBOARDHIDDEN_NO ? View.INVISIBLE : View.VISIBLE);
// The delete button is of the PIN keyboard itself in some (e.g. tablet) layouts,
// not a separate view
View pinDelete = findViewById(R.id.pinDel);
if (pinDelete != null) {
pinDelete.setVisibility(View.VISIBLE);
pinDelete.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
mKeyboardHelper.handleBackspace();
}
});
}
}
mPasswordEntry.requestFocus();
@ -293,7 +305,7 @@ public class PasswordUnlockScreen extends LinearLayout implements KeyguardScreen
mPasswordEntry.setEnabled(false);
mKeyboardView.setEnabled(false);
long elapsedRealtime = SystemClock.elapsedRealtime();
mCountdownTimer = new CountDownTimer(elapsedRealtimeDeadline - elapsedRealtime, 1000) {
new CountDownTimer(elapsedRealtimeDeadline - elapsedRealtime, 1000) {
@Override
public void onTick(long millisUntilFinished) {
@ -309,7 +321,6 @@ public class PasswordUnlockScreen extends LinearLayout implements KeyguardScreen
mPasswordEntry.setEnabled(true);
mKeyboardView.setEnabled(true);
mStatusViewManager.resetStatusInfo();
mCountdownTimer = null;
}
}.start();
}