Merge "New PIN unlock screen layout."
This commit is contained in:
@ -48,11 +48,11 @@ public class PasswordEntryKeyboardHelper implements OnKeyboardActionListener {
|
|||||||
private PasswordEntryKeyboard mSymbolsKeyboard;
|
private PasswordEntryKeyboard mSymbolsKeyboard;
|
||||||
private PasswordEntryKeyboard mSymbolsKeyboardShifted;
|
private PasswordEntryKeyboard mSymbolsKeyboardShifted;
|
||||||
private PasswordEntryKeyboard mNumericKeyboard;
|
private PasswordEntryKeyboard mNumericKeyboard;
|
||||||
private Context mContext;
|
private final Context mContext;
|
||||||
private View mTargetView;
|
private final View mTargetView;
|
||||||
private KeyboardView mKeyboardView;
|
private final KeyboardView mKeyboardView;
|
||||||
private long[] mVibratePattern;
|
private long[] mVibratePattern;
|
||||||
private Vibrator mVibrator;
|
private final Vibrator mVibrator;
|
||||||
|
|
||||||
public PasswordEntryKeyboardHelper(Context context, KeyboardView keyboardView, View targetView) {
|
public PasswordEntryKeyboardHelper(Context context, KeyboardView keyboardView, View targetView) {
|
||||||
this(context, keyboardView, targetView, true);
|
this(context, keyboardView, targetView, true);
|
||||||
@ -228,7 +228,7 @@ public class PasswordEntryKeyboardHelper implements OnKeyboardActionListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleBackspace() {
|
public void handleBackspace() {
|
||||||
sendDownUpKeyEvents(KeyEvent.KEYCODE_DEL);
|
sendDownUpKeyEvents(KeyEvent.KEYCODE_DEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,7 +135,8 @@
|
|||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:layout_width="270dip"
|
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"
|
<EditText android:id="@+id/passwordEntry"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@ -148,11 +149,23 @@
|
|||||||
android:textSize="24sp"
|
android:textSize="24sp"
|
||||||
android:minEms="8"
|
android:minEms="8"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
android:background="@drawable/lockscreen_password_field_dark"
|
android:background="@null"
|
||||||
android:textColor="?android:attr/textColorPrimary"
|
android:textColor="?android:attr/textColorPrimary"
|
||||||
android:imeOptions="flagNoFullscreen|actionDone"
|
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"
|
<ImageView android:id="@+id/switch_ime_button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -95,9 +95,12 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- Password entry field -->
|
<!-- Password entry field -->
|
||||||
|
<!-- Note: the entire container is styled to look like the edit field,
|
||||||
|
since the backspace/IME switcher looks better inside -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_gravity="center_vertical|fill_horizontal"
|
android:layout_gravity="center_vertical|fill_horizontal"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
|
android:background="@drawable/lockscreen_password_field_dark"
|
||||||
android:layout_marginLeft="16dip"
|
android:layout_marginLeft="16dip"
|
||||||
android:layout_marginRight="16dip">
|
android:layout_marginRight="16dip">
|
||||||
|
|
||||||
@ -110,12 +113,24 @@
|
|||||||
android:textStyle="normal"
|
android:textStyle="normal"
|
||||||
android:inputType="textPassword"
|
android:inputType="textPassword"
|
||||||
android:textSize="36sp"
|
android:textSize="36sp"
|
||||||
android:background="@drawable/lockscreen_password_field_dark"
|
android:background="@null"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
android:textColor="#ffffffff"
|
android:textColor="#ffffffff"
|
||||||
android:imeOptions="actionDone"
|
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"
|
<ImageView android:id="@+id/switch_ime_button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -49,12 +49,10 @@
|
|||||||
</Row>
|
</Row>
|
||||||
|
|
||||||
<Row android:rowEdgeFlags="bottom">
|
<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"
|
<Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_ok"
|
||||||
android:keyEdgeFlags="left"/>
|
android:keyEdgeFlags="right"/>
|
||||||
<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"/>
|
|
||||||
</Row>
|
</Row>
|
||||||
|
|
||||||
</Keyboard>
|
</Keyboard>
|
||||||
|
@ -60,19 +60,18 @@ public class PasswordUnlockScreen extends LinearLayout implements KeyguardScreen
|
|||||||
private final KeyguardUpdateMonitor mUpdateMonitor;
|
private final KeyguardUpdateMonitor mUpdateMonitor;
|
||||||
private final KeyguardScreenCallback mCallback;
|
private final KeyguardScreenCallback mCallback;
|
||||||
|
|
||||||
private boolean mIsAlpha;
|
private final boolean mIsAlpha;
|
||||||
|
|
||||||
private EditText mPasswordEntry;
|
private final EditText mPasswordEntry;
|
||||||
private LockPatternUtils mLockPatternUtils;
|
private final LockPatternUtils mLockPatternUtils;
|
||||||
private PasswordEntryKeyboardView mKeyboardView;
|
private final PasswordEntryKeyboardView mKeyboardView;
|
||||||
private PasswordEntryKeyboardHelper mKeyboardHelper;
|
private final PasswordEntryKeyboardHelper mKeyboardHelper;
|
||||||
|
|
||||||
private int mCreationOrientation;
|
private final int mCreationOrientation;
|
||||||
private int mCreationHardKeyboardHidden;
|
private final int mCreationHardKeyboardHidden;
|
||||||
private CountDownTimer mCountdownTimer;
|
|
||||||
|
|
||||||
private KeyguardStatusViewManager mStatusViewManager;
|
private final KeyguardStatusViewManager mStatusViewManager;
|
||||||
private boolean mUseSystemIME = true; // TODO: Make configurable
|
private final boolean mUseSystemIME = true; // TODO: Make configurable
|
||||||
private boolean mResuming; // used to prevent poking the wakelock during onResume()
|
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
|
// 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);
|
mKeyboardHelper.setKeyboardMode(PasswordEntryKeyboardHelper.KEYBOARD_MODE_NUMERIC);
|
||||||
mKeyboardView.setVisibility(mCreationHardKeyboardHidden
|
mKeyboardView.setVisibility(mCreationHardKeyboardHidden
|
||||||
== Configuration.HARDKEYBOARDHIDDEN_NO ? View.INVISIBLE : View.VISIBLE);
|
== 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();
|
mPasswordEntry.requestFocus();
|
||||||
@ -293,7 +305,7 @@ public class PasswordUnlockScreen extends LinearLayout implements KeyguardScreen
|
|||||||
mPasswordEntry.setEnabled(false);
|
mPasswordEntry.setEnabled(false);
|
||||||
mKeyboardView.setEnabled(false);
|
mKeyboardView.setEnabled(false);
|
||||||
long elapsedRealtime = SystemClock.elapsedRealtime();
|
long elapsedRealtime = SystemClock.elapsedRealtime();
|
||||||
mCountdownTimer = new CountDownTimer(elapsedRealtimeDeadline - elapsedRealtime, 1000) {
|
new CountDownTimer(elapsedRealtimeDeadline - elapsedRealtime, 1000) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTick(long millisUntilFinished) {
|
public void onTick(long millisUntilFinished) {
|
||||||
@ -309,7 +321,6 @@ public class PasswordUnlockScreen extends LinearLayout implements KeyguardScreen
|
|||||||
mPasswordEntry.setEnabled(true);
|
mPasswordEntry.setEnabled(true);
|
||||||
mKeyboardView.setEnabled(true);
|
mKeyboardView.setEnabled(true);
|
||||||
mStatusViewManager.resetStatusInfo();
|
mStatusViewManager.resetStatusInfo();
|
||||||
mCountdownTimer = null;
|
|
||||||
}
|
}
|
||||||
}.start();
|
}.start();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user