From 1351c6f804ac2ced8c135a7f83401956c2bcb44b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ha=C3=9F?= Date: Mon, 24 Feb 2014 22:02:32 +0100 Subject: [PATCH] Replaced Toast with AppMsg in DecryptActivity --- .../keychain/ui/DecryptActivity.java | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptActivity.java index 652310cd2..9bb675db0 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptActivity.java @@ -66,6 +66,7 @@ import android.widget.Toast; import android.widget.ViewFlipper; import com.beardedhen.androidbootstrap.BootstrapButton; +import com.devspark.appmsg.AppMsg; @SuppressLint("NewApi") public class DecryptActivity extends DrawerActivity { @@ -233,7 +234,7 @@ public class DecryptActivity extends DrawerActivity { if (matcher.matches()) { data = matcher.group(1); mMessage.setText(data); - Toast.makeText(this, R.string.using_clipboard_content, Toast.LENGTH_SHORT) + AppMsg.makeText(this, R.string.using_clipboard_content, AppMsg.STYLE_INFO) .show(); } } @@ -420,17 +421,17 @@ public class DecryptActivity extends DrawerActivity { } if (mInputFilename.equals("")) { - Toast.makeText(this, R.string.no_file_selected, Toast.LENGTH_SHORT).show(); + AppMsg.makeText(this, R.string.no_file_selected, AppMsg.STYLE_ALERT).show(); return; } if (mInputFilename.startsWith("file")) { File file = new File(mInputFilename); if (!file.exists() || !file.isFile()) { - Toast.makeText( + AppMsg.makeText( this, getString(R.string.error_message, - getString(R.string.error_file_not_found)), Toast.LENGTH_SHORT) + getString(R.string.error_file_not_found)), AppMsg.STYLE_ALERT) .show(); return; } @@ -510,14 +511,14 @@ public class DecryptActivity extends DrawerActivity { inStream = getContentResolver().openInputStream(mContentUri); } catch (FileNotFoundException e) { Log.e(Constants.TAG, "File not found!", e); - Toast.makeText(this, getString(R.string.error_file_not_found, e.getMessage()), - Toast.LENGTH_SHORT).show(); + AppMsg.makeText(this, getString(R.string.error_file_not_found, e.getMessage()), + AppMsg.STYLE_ALERT).show(); } } else if (mDecryptTarget == Id.target.file) { // check if storage is ready if (!FileHelper.isStorageMounted(mInputFilename)) { - Toast.makeText(this, getString(R.string.error_external_storage_not_ready), - Toast.LENGTH_SHORT).show(); + AppMsg.makeText(this, getString(R.string.error_external_storage_not_ready), + AppMsg.STYLE_ALERT).show(); return; } @@ -525,8 +526,8 @@ public class DecryptActivity extends DrawerActivity { inStream = new BufferedInputStream(new FileInputStream(mInputFilename)); } catch (FileNotFoundException e) { Log.e(Constants.TAG, "File not found!", e); - Toast.makeText(this, getString(R.string.error_file_not_found, e.getMessage()), - Toast.LENGTH_SHORT).show(); + AppMsg.makeText(this, getString(R.string.error_file_not_found, e.getMessage()), + AppMsg.STYLE_ALERT).show(); } } else { inStream = new ByteArrayInputStream(mMessage.getText().toString().getBytes()); @@ -556,8 +557,8 @@ public class DecryptActivity extends DrawerActivity { mAssumeSymmetricEncryption = true; } } catch (Exception e) { - Toast.makeText(this, getString(R.string.error_message, e.getMessage()), - Toast.LENGTH_SHORT).show(); + AppMsg.makeText(this, getString(R.string.error_message, e.getMessage()), + AppMsg.STYLE_ALERT).show(); } } @@ -655,8 +656,8 @@ public class DecryptActivity extends DrawerActivity { mSignatureKeyId = 0; mSignatureLayout.setVisibility(View.GONE); - Toast.makeText(DecryptActivity.this, R.string.decryption_successful, - Toast.LENGTH_SHORT).show(); + AppMsg.makeText(DecryptActivity.this, R.string.decryption_successful, + AppMsg.STYLE_INFO).show(); if (mReturnResult) { Intent intent = new Intent(); intent.putExtras(returnData); @@ -713,9 +714,9 @@ public class DecryptActivity extends DrawerActivity { .getBoolean(KeychainIntentService.RESULT_SIGNATURE_UNKNOWN)) { mSignatureStatusImage.setImageResource(R.drawable.overlay_error); mLookupKey.setVisibility(View.VISIBLE); - Toast.makeText(DecryptActivity.this, + AppMsg.makeText(DecryptActivity.this, R.string.unknown_signature, - Toast.LENGTH_LONG).show(); + AppMsg.STYLE_ALERT).show(); } else { mSignatureStatusImage.setImageResource(R.drawable.overlay_error); mLookupKey.setVisibility(View.GONE);