EditPinPreferencepublic class EditPinPreference extends android.preference.EditTextPreference Class similar to the com.android.settings.EditPinPreference
class, with a couple of modifications, including a different layout
for the dialog. |
Fields Summary |
---|
private boolean | shouldHideButtons | private OnPinEnteredListener | mPinListener |
Methods Summary |
---|
protected void | onBindDialogView(android.view.View view)
super.onBindDialogView(view);
// If the layout does not contain an edittext, hide the buttons.
shouldHideButtons = (view.findViewById(android.R.id.edit) == null);
| protected android.view.View | onCreateDialogView()Overridden to setup the correct dialog layout, as well as setting up
other properties for the pin / puk entry field.
// set the dialog layout
setDialogLayoutResource(R.layout.pref_dialog_editpin);
View dialog = super.onCreateDialogView();
// set the transformation method and the key listener to ensure
// correct input and presentation of the pin / puk.
final EditText textfield = getEditText();
textfield.setTransformationMethod(PasswordTransformationMethod.getInstance());
textfield.setKeyListener(DigitsKeyListener.getInstance());
return dialog;
| protected void | onDialogClosed(boolean positiveResult)
super.onDialogClosed(positiveResult);
if (mPinListener != null) {
mPinListener.onPinEntered(this, positiveResult);
}
| protected void | onPrepareDialogBuilder(AlertDialog.Builder builder)
super.onPrepareDialogBuilder(builder);
// hide the buttons if we need to.
if (shouldHideButtons) {
builder.setPositiveButton(null, this);
builder.setNegativeButton(null, this);
}
| public void | setOnPinEnteredListener(com.android.phone.EditPinPreference$OnPinEnteredListener listener)
mPinListener = listener;
| public void | showPinDialog()Externally visible method to bring up the dialog to
for multi-step / multi-dialog requests (like changing
the SIM pin).
showDialog(null);
|
|