Fix for 1785342: The old PIN is required after entering New PIN
State of dialogs was not properly maintained across pause/resume.
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.settings;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.preference.EditTextPreference;
|
||||
import android.text.method.DigitsKeyListener;
|
||||
@@ -24,15 +25,11 @@ import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* TODO: Add a soft dialpad for PIN entry.
|
||||
*/
|
||||
class EditPinPreference extends EditTextPreference {
|
||||
|
||||
private boolean mDialogOpen;
|
||||
|
||||
interface OnPinEnteredListener {
|
||||
void onPinEntered(EditPinPreference preference, boolean positiveResult);
|
||||
}
|
||||
@@ -50,13 +47,13 @@ class EditPinPreference extends EditTextPreference {
|
||||
public void setOnPinEnteredListener(OnPinEnteredListener listener) {
|
||||
mPinListener = listener;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onBindDialogView(View view) {
|
||||
super.onBindDialogView(view);
|
||||
|
||||
|
||||
final EditText editText = (EditText) view.findViewById(android.R.id.edit);
|
||||
|
||||
|
||||
if (editText != null) {
|
||||
editText.setSingleLine(true);
|
||||
editText.setTransformationMethod(PasswordTransformationMethod.getInstance());
|
||||
@@ -65,20 +62,22 @@ class EditPinPreference extends EditTextPreference {
|
||||
}
|
||||
|
||||
public boolean isDialogOpen() {
|
||||
return mDialogOpen;
|
||||
Dialog dialog = getDialog();
|
||||
return dialog != null && dialog.isShowing();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onDialogClosed(boolean positiveResult) {
|
||||
super.onDialogClosed(positiveResult);
|
||||
mDialogOpen = false;
|
||||
if (mPinListener != null) {
|
||||
mPinListener.onPinEntered(this, positiveResult);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void showPinDialog() {
|
||||
mDialogOpen = true;
|
||||
showDialog(null);
|
||||
Dialog dialog = getDialog();
|
||||
if (dialog == null || !dialog.isShowing()) {
|
||||
showDialog(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user