Add 'clear' button to pin/password lock screen
am: be2246bee7
Change-Id: I21c6c68199c281fbdb3ac97fd50f06bd612173dc
This commit is contained in:
@@ -211,6 +211,7 @@ public class ChooseLockPassword extends SettingsActivity {
|
||||
private RecyclerView mPasswordRestrictionView;
|
||||
protected boolean mIsAlphaMode;
|
||||
protected Button mCancelButton;
|
||||
private Button mClearButton;
|
||||
private Button mNextButton;
|
||||
|
||||
private TextChangedHandler mTextChangedHandler;
|
||||
@@ -347,6 +348,8 @@ public class ChooseLockPassword extends SettingsActivity {
|
||||
mCancelButton.setOnClickListener(this);
|
||||
mNextButton = (Button) view.findViewById(R.id.next_button);
|
||||
mNextButton.setOnClickListener(this);
|
||||
mClearButton = view.findViewById(R.id.clear_button);
|
||||
mClearButton.setOnClickListener(this);
|
||||
|
||||
if (mForFingerprint) {
|
||||
TextView fingerprintBackupMessage =
|
||||
@@ -735,6 +738,10 @@ public class ChooseLockPassword extends SettingsActivity {
|
||||
case R.id.cancel_button:
|
||||
getActivity().finish();
|
||||
break;
|
||||
|
||||
case R.id.clear_button:
|
||||
mPasswordEntry.setText("");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -839,11 +846,20 @@ public class ChooseLockPassword extends SettingsActivity {
|
||||
mPasswordRestrictionView.setVisibility(View.GONE);
|
||||
setHeaderText(getString(mUiStage.getHint(mIsAlphaMode, mForFingerprint)));
|
||||
setNextEnabled(canInput && length > 0);
|
||||
mClearButton.setEnabled(canInput && length > 0);
|
||||
}
|
||||
|
||||
mClearButton.setVisibility(toVisibility(mUiStage != Stage.Introduction));
|
||||
mCancelButton.setVisibility(toVisibility(mUiStage == Stage.Introduction));
|
||||
|
||||
setNextText(mUiStage.buttonText);
|
||||
mPasswordEntryInputDisabler.setInputEnabled(canInput);
|
||||
}
|
||||
|
||||
private int toVisibility(boolean visibleOrGone) {
|
||||
return visibleOrGone ? View.VISIBLE : View.GONE;
|
||||
}
|
||||
|
||||
private void setHeaderText(String text) {
|
||||
// Only set the text if it is different than the existing one to avoid announcing again.
|
||||
if (!TextUtils.isEmpty(mLayout.getHeaderText())
|
||||
|
@@ -84,13 +84,6 @@ public class SetupChooseLockPassword extends ChooseLockPassword {
|
||||
@Override
|
||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
if (mForFingerprint) {
|
||||
mCancelButton.setVisibility(View.GONE);
|
||||
} else {
|
||||
mCancelButton.setText(R.string.skip_label);
|
||||
}
|
||||
|
||||
final Activity activity = getActivity();
|
||||
ChooseLockGenericController chooseLockGenericController =
|
||||
new ChooseLockGenericController(activity, mUserId);
|
||||
@@ -190,6 +183,12 @@ public class SetupChooseLockPassword extends ChooseLockPassword {
|
||||
@Override
|
||||
protected void updateUi() {
|
||||
super.updateUi();
|
||||
if (mForFingerprint) {
|
||||
mCancelButton.setVisibility(View.GONE);
|
||||
} else {
|
||||
mCancelButton.setText(R.string.skip_label);
|
||||
}
|
||||
|
||||
if (mOptionsButton != null) {
|
||||
mOptionsButton.setVisibility(
|
||||
mUiStage == Stage.Introduction ? View.VISIBLE : View.GONE);
|
||||
|
Reference in New Issue
Block a user