Revert "Avoid using Toasts in PassphraseChangeActivity"

This reverts commit 30a0981d4cb4671825ef54f4e6259797884c017f.

// FREEBIE
This commit is contained in:
Moxie Marlinspike 2016-03-10 09:55:19 -08:00
parent 021942fd43
commit 95b57e22f8

View File

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