// @Override
  protected void onBindDialogView(View view) {
    PasswordPreference preference = ((PasswordPreference) getPreference());
    password1 = (EditText) view.findViewById(R.id.password1);
    password2 = (EditText) view.findViewById(R.id.password2);
    protect = (CheckBox) view.findViewById(R.id.performProtection);
    change = (CheckBox) view.findViewById(R.id.changePassword);
    password2Wrapper = (TextInputLayout) view.findViewById(R.id.password2Wrapper);
    String warning =
        ContribFeature.SECURITY_QUESTION.hasAccess()
            ? getContext().getString(R.string.warning_password_contrib)
            : (getContext().getString(R.string.warning_password_no_contrib)
                + " "
                + ContribFeature.SECURITY_QUESTION.buildRequiresString(getContext()));
    ((TextView) view.findViewById(R.id.password_warning)).setText(warning);
    main = (LinearLayout) view.findViewById(R.id.layoutMain);
    edit = (LinearLayout) view.findViewById(R.id.layoutPasswordEdit);
    boolProtectOrig = preference.getValue();
    boolProtect = boolProtectOrig;
    protect.setChecked(boolProtect);
    if (boolProtect) {
      main.setVisibility(View.VISIBLE);
      view.findViewById(R.id.layoutChangePasswordCheckBox).setVisibility(View.VISIBLE);
      edit.setVisibility(View.GONE);
    }

    password1.addTextChangedListener(this);
    password2.addTextChangedListener(this);
    protect.setOnCheckedChangeListener(this);
    change.setOnCheckedChangeListener(this);
    super.onBindDialogView(view);
  }
 public static AlertDialog passwordDialog(final Activity ctx) {
   final String securityQuestion = MyApplication.PrefKey.SECURITY_QUESTION.getString("");
   Context wrappedCtx = wrapContext2(ctx);
   LayoutInflater li = LayoutInflater.from(wrappedCtx);
   View view = li.inflate(R.layout.password_check, null);
   view.findViewById(R.id.password).setTag(Boolean.valueOf(false));
   AlertDialog.Builder builder =
       new AlertDialog.Builder(wrappedCtx)
           .setTitle(R.string.password_prompt)
           .setView(view)
           .setOnCancelListener(
               new DialogInterface.OnCancelListener() {
                 @Override
                 public void onCancel(DialogInterface dialog) {
                   ctx.moveTaskToBack(true);
                 }
               });
   if (ContribFeature.SECURITY_QUESTION.hasAccess() && !securityQuestion.equals("")) {
     builder.setNegativeButton(
         R.string.password_lost,
         new DialogInterface.OnClickListener() {
           public void onClick(DialogInterface dialog, int id) {}
         });
   }
   builder.setPositiveButton(
       android.R.string.ok,
       new DialogInterface.OnClickListener() {
         public void onClick(DialogInterface dialog, int id) {}
       });
   return builder.create();
 }