Bug 713922 - Don't allow empty password for master password. r=mfinkle

This commit is contained in:
Wes Johnston 2012-01-18 08:50:11 -08:00
parent 68c0d15133
commit c25815880f

View File

@ -58,6 +58,7 @@ import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.text.TextWatcher;
import android.text.TextUtils;
import android.content.DialogInterface;
import org.json.JSONArray;
@ -187,7 +188,8 @@ public class GeckoPreferences
String text1 = input1.getText().toString();
String text2 = input2.getText().toString();
dialog.getButton(DialogInterface.BUTTON_POSITIVE).setEnabled(text1.equals(text2));
boolean disabled = TextUtils.isEmpty(text1) || TextUtils.isEmpty(text2) || !text1.equals(text2);
dialog.getButton(DialogInterface.BUTTON_POSITIVE).setEnabled(!disabled);
}
public void beforeTextChanged(CharSequence s, int start, int count, int after) { }
@ -230,8 +232,8 @@ public class GeckoPreferences
}
});
dialog = builder.create();
dialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
public void onDismiss(DialogInterface dialog) {
dialog.setOnShowListener(new DialogInterface.OnShowListener() {
public void onShow(DialogInterface dialog) {
input1.setText("");
input2.setText("");
input1.requestFocus();