FileDocCategorySizeDatePackage
EditPinPreference.javaAPI DocAndroid 1.5 API3604Wed May 06 22:42:46 BST 2009com.android.phone

EditPinPreference

public 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
Constructors Summary
public EditPinPreference(android.content.Context context, android.util.AttributeSet attrs)

        super(context, attrs);
    
public EditPinPreference(android.content.Context context, android.util.AttributeSet attrs, int defStyle)

        super(context, attrs, defStyle);
    
Methods Summary
protected voidonBindDialogView(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.ViewonCreateDialogView()
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 voidonDialogClosed(boolean positiveResult)

        super.onDialogClosed(positiveResult);
        if (mPinListener != null) {
            mPinListener.onPinEntered(this, positiveResult);
        }
    
protected voidonPrepareDialogBuilder(AlertDialog.Builder builder)

        super.onPrepareDialogBuilder(builder);
        
        // hide the buttons if we need to.
        if (shouldHideButtons) {
            builder.setPositiveButton(null, this);
            builder.setNegativeButton(null, this);
        }
    
public voidsetOnPinEnteredListener(com.android.phone.EditPinPreference$OnPinEnteredListener listener)

        mPinListener = listener;
    
public voidshowPinDialog()
Externally visible method to bring up the dialog to for multi-step / multi-dialog requests (like changing the SIM pin).

        showDialog(null);