mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-15 20:29:52 +01:00
Merge branch '159-improve-setup-errors' into 'master'
Show setup page error messages by the relevant text box Closes #159 See merge request !3
This commit is contained in:
@@ -66,7 +66,6 @@ OnEditorActionListener {
|
|||||||
private EditText nicknameEntry = null;
|
private EditText nicknameEntry = null;
|
||||||
private EditText passwordEntry = null, passwordConfirmation = null;
|
private EditText passwordEntry = null, passwordConfirmation = null;
|
||||||
private StrengthMeter strengthMeter = null;
|
private StrengthMeter strengthMeter = null;
|
||||||
private TextView feedback = null;
|
|
||||||
private Button createAccountButton = null;
|
private Button createAccountButton = null;
|
||||||
private ProgressBar progress = null;
|
private ProgressBar progress = null;
|
||||||
|
|
||||||
@@ -154,12 +153,6 @@ OnEditorActionListener {
|
|||||||
strengthMeter.setVisibility(INVISIBLE);
|
strengthMeter.setVisibility(INVISIBLE);
|
||||||
layout.addView(strengthMeter);
|
layout.addView(strengthMeter);
|
||||||
|
|
||||||
feedback = new TextView(this);
|
|
||||||
feedback.setGravity(CENTER);
|
|
||||||
feedback.setPadding(0, pad, 0, pad);
|
|
||||||
feedback.setText("");
|
|
||||||
layout.addView(feedback);
|
|
||||||
|
|
||||||
createAccountButton = new Button(this);
|
createAccountButton = new Button(this);
|
||||||
createAccountButton.setLayoutParams(WRAP_WRAP);
|
createAccountButton.setLayoutParams(WRAP_WRAP);
|
||||||
createAccountButton.setText(R.string.create_account_button);
|
createAccountButton.setText(R.string.create_account_button);
|
||||||
@@ -192,19 +185,12 @@ OnEditorActionListener {
|
|||||||
boolean passwordsMatch = firstPassword.equals(secondPassword);
|
boolean passwordsMatch = firstPassword.equals(secondPassword);
|
||||||
float strength = strengthEstimator.estimateStrength(firstPassword);
|
float strength = strengthEstimator.estimateStrength(firstPassword);
|
||||||
strengthMeter.setStrength(strength);
|
strengthMeter.setStrength(strength);
|
||||||
if (nicknameLength > MAX_AUTHOR_NAME_LENGTH) {
|
if (nicknameLength > MAX_AUTHOR_NAME_LENGTH)
|
||||||
feedback.setText(R.string.name_too_long);
|
nicknameEntry.setError(getString(R.string.name_too_long));
|
||||||
} else if (firstPassword.length() == 0) {
|
if (firstPassword.length() > 0 && strength < PasswordStrengthEstimator.WEAK)
|
||||||
feedback.setText("");
|
passwordEntry.setError(getString(R.string.password_too_weak));
|
||||||
} else if (secondPassword.length() == 0 || passwordsMatch) {
|
if (secondPassword.length() > 0 && !passwordsMatch)
|
||||||
if (strength < PasswordStrengthEstimator.WEAK)
|
passwordConfirmation.setError(getString(R.string.passwords_do_not_match));
|
||||||
feedback.setText(R.string.password_too_weak);
|
|
||||||
else feedback.setText("");
|
|
||||||
} else if (!passwordsMatch) {
|
|
||||||
feedback.setText(R.string.passwords_do_not_match);
|
|
||||||
} else {
|
|
||||||
feedback.setText("");
|
|
||||||
}
|
|
||||||
createAccountButton.setEnabled(nicknameLength > 0
|
createAccountButton.setEnabled(nicknameLength > 0
|
||||||
&& nicknameLength <= MAX_AUTHOR_NAME_LENGTH
|
&& nicknameLength <= MAX_AUTHOR_NAME_LENGTH
|
||||||
&& passwordsMatch && strength >= WEAK);
|
&& passwordsMatch && strength >= WEAK);
|
||||||
@@ -219,7 +205,6 @@ OnEditorActionListener {
|
|||||||
|
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
// Replace the feedback text and button with a progress bar
|
// Replace the feedback text and button with a progress bar
|
||||||
feedback.setVisibility(GONE);
|
|
||||||
createAccountButton.setVisibility(GONE);
|
createAccountButton.setVisibility(GONE);
|
||||||
progress.setVisibility(VISIBLE);
|
progress.setVisibility(VISIBLE);
|
||||||
final String nickname = nicknameEntry.getText().toString();
|
final String nickname = nicknameEntry.getText().toString();
|
||||||
|
|||||||
Reference in New Issue
Block a user