Remove unused import, make some fields final, and simplify an if statement
This commit is contained in:
parent
b75fdd0026
commit
e8c1247d62
1 changed files with 4 additions and 9 deletions
|
@ -30,7 +30,6 @@ import android.preference.DialogPreference;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.InputType;
|
import android.text.InputType;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
import android.text.method.PasswordTransformationMethod;
|
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
|
@ -67,7 +66,7 @@ public class CredentialsPreference extends DialogPreference
|
||||||
boolean testEncryptionChange(byte[] newKey);
|
boolean testEncryptionChange(byte[] newKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<String> entries;
|
private final List<String> entries;
|
||||||
private static final List<AuthMethod> entryValues = Arrays.asList(
|
private static final List<AuthMethod> entryValues = Arrays.asList(
|
||||||
AuthMethod.NONE,
|
AuthMethod.NONE,
|
||||||
AuthMethod.PASSWORD,
|
AuthMethod.PASSWORD,
|
||||||
|
@ -77,7 +76,7 @@ public class CredentialsPreference extends DialogPreference
|
||||||
|
|
||||||
private int minLength = 0;
|
private int minLength = 0;
|
||||||
|
|
||||||
private Settings settings;
|
private final Settings settings;
|
||||||
private AuthMethod value = AuthMethod.NONE;
|
private AuthMethod value = AuthMethod.NONE;
|
||||||
private EncryptionChangeCallback encryptionChangeCallback = null;
|
private EncryptionChangeCallback encryptionChangeCallback = null;
|
||||||
|
|
||||||
|
@ -230,14 +229,10 @@ public class CredentialsPreference extends DialogPreference
|
||||||
|
|
||||||
if (password.length() >= minLength) {
|
if (password.length() >= minLength) {
|
||||||
toShortWarning.setVisibility(View.GONE);
|
toShortWarning.setVisibility(View.GONE);
|
||||||
|
|
||||||
String confirm = passwordConfirm.getEditableText().toString();
|
String confirm = passwordConfirm.getEditableText().toString();
|
||||||
|
|
||||||
if (!password.isEmpty() && !confirm.isEmpty() && password.equals(confirm)) {
|
boolean canSave = !password.isEmpty() && !confirm.isEmpty() && password.equals(confirm);
|
||||||
btnSave.setEnabled(true);
|
btnSave.setEnabled(canSave);
|
||||||
} else {
|
|
||||||
btnSave.setEnabled(false);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
toShortWarning.setVisibility(View.VISIBLE);
|
toShortWarning.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue