replace toasts in PassphraseChangeActivity with errors

Closes #5347
// FREEBIE
master
Christian Ascheberg 2016-03-16 14:48:14 +01:00 committed by Moxie Marlinspike
parent 8c36e20681
commit cc1bfec08a
1 changed files with 8 additions and 11 deletions

View File

@ -16,16 +16,15 @@
*/
package org.thoughtcrime.securesms;
import android.os.AsyncTask;
import android.content.Context;
import android.util.Log;
import android.os.AsyncTask;
import android.os.Bundle;
import android.text.Editable;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import org.thoughtcrime.securesms.crypto.InvalidPassphraseException;
import org.thoughtcrime.securesms.crypto.MasterSecret;
@ -101,15 +100,13 @@ public class PassphraseChangeActivity extends PassphraseActivity {
}
if (!passphrase.equals(passphraseRepeat)) {
Toast.makeText(getApplicationContext(),
R.string.PassphraseChangeActivity_passphrases_dont_match_exclamation,
Toast.LENGTH_SHORT).show();
this.newPassphrase.setText("");
this.repeatPassphrase.setText("");
this.newPassphrase.setError(getString(R.string.PassphraseChangeActivity_passphrases_dont_match_exclamation));
this.newPassphrase.requestFocus();
} else if (passphrase.equals("")) {
Toast.makeText(getApplicationContext(),
R.string.PassphraseChangeActivity_enter_new_passphrase_exclamation,
Toast.LENGTH_SHORT).show();
this.newPassphrase.setError(getString(R.string.PassphraseChangeActivity_enter_new_passphrase_exclamation));
this.newPassphrase.requestFocus();
} else {
new ChangePassphraseTask(this).execute(original, passphrase);
}
@ -160,9 +157,9 @@ public class PassphraseChangeActivity extends PassphraseActivity {
if (masterSecret != null) {
setMasterSecret(masterSecret);
} else {
Toast.makeText(context, R.string.PassphraseChangeActivity_incorrect_old_passphrase_exclamation,
Toast.LENGTH_LONG).show();
originalPassphrase.setText("");
originalPassphrase.setError(getString(R.string.PassphraseChangeActivity_incorrect_old_passphrase_exclamation));
originalPassphrase.requestFocus();
}
}
}