From 1f36238a1b8cbaaf3f2b1d03eb0c9f97e64889ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ha=C3=9F?= Date: Sun, 23 Feb 2014 23:35:11 +0100 Subject: [PATCH 1/4] Replaced Toast with AppMsg in EncryptActivity --- .../keychain/ui/EncryptActivity.java | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java index 85bfba224..6db4aae90 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java @@ -63,6 +63,7 @@ import android.widget.Toast; import android.widget.ViewFlipper; import com.beardedhen.androidbootstrap.BootstrapButton; +import com.devspark.appmsg.AppMsg; public class EncryptActivity extends DrawerActivity { @@ -215,7 +216,8 @@ public class EncryptActivity extends DrawerActivity { // encrypt file based on Uri // get file path from uri - String path = FileHelper.getPath(this, uri); + //String path = FileHelper.getPath(this, uri); + String path = null; if (path != null) { mInputFilename = path; @@ -415,17 +417,17 @@ public class EncryptActivity extends DrawerActivity { mOutputFilename = guessOutputFilename(mInputFilename); 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("content")) { 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; } @@ -438,13 +440,13 @@ public class EncryptActivity extends DrawerActivity { String passPhrase = mPassPhrase.getText().toString(); String passPhraseAgain = mPassPhraseAgain.getText().toString(); if (!passPhrase.equals(passPhraseAgain)) { - Toast.makeText(this, R.string.passphrases_do_not_match, Toast.LENGTH_SHORT).show(); + AppMsg.makeText(this, R.string.passphrases_do_not_match, AppMsg.STYLE_ALERT).show(); return; } gotPassPhrase = (passPhrase.length() != 0); if (!gotPassPhrase) { - Toast.makeText(this, R.string.passphrase_must_not_be_empty, Toast.LENGTH_SHORT) + AppMsg.makeText(this, R.string.passphrase_must_not_be_empty, AppMsg.STYLE_ALERT) .show(); return; } @@ -452,13 +454,13 @@ public class EncryptActivity extends DrawerActivity { boolean encryptIt = (mEncryptionKeyIds != null && mEncryptionKeyIds.length > 0); // for now require at least one form of encryption for files if (!encryptIt && mEncryptTarget == Id.target.file) { - Toast.makeText(this, R.string.select_encryption_key, Toast.LENGTH_SHORT).show(); + AppMsg.makeText(this, R.string.select_encryption_key, AppMsg.STYLE_ALERT).show(); return; } if (!encryptIt && mSecretKeyId == 0) { - Toast.makeText(this, R.string.select_encryption_or_signature_key, - Toast.LENGTH_SHORT).show(); + AppMsg.makeText(this, R.string.select_encryption_or_signature_key, + AppMsg.STYLE_ALERT).show(); return; } @@ -618,8 +620,8 @@ public class EncryptActivity extends DrawerActivity { output = data.getString(KeychainIntentService.RESULT_ENCRYPTED_STRING); Log.d(Constants.TAG, "output: " + output); ClipboardReflection.copyToClipboard(EncryptActivity.this, output); - Toast.makeText(EncryptActivity.this, - R.string.encryption_to_clipboard_successful, Toast.LENGTH_SHORT) + AppMsg.makeText(EncryptActivity.this, + R.string.encryption_to_clipboard_successful, AppMsg.STYLE_INFO) .show(); break; @@ -640,8 +642,8 @@ public class EncryptActivity extends DrawerActivity { break; case Id.target.file: - Toast.makeText(EncryptActivity.this, R.string.encryption_successful, - Toast.LENGTH_SHORT).show(); + AppMsg.makeText(EncryptActivity.this, R.string.encryption_successful, + AppMsg.STYLE_INFO).show(); if (mDeleteAfter.isChecked()) { // Create and show dialog to delete original file From e936a4762b4c6ed8153d216ab4655e251c4366f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ha=C3=9F?= Date: Sun, 23 Feb 2014 23:50:55 +0100 Subject: [PATCH 2/4] Replaced Toast with AppMsg in EncryptActivity --- .../keychain/ui/EncryptActivity.java | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java index 6db4aae90..85bfba224 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java @@ -63,7 +63,6 @@ import android.widget.Toast; import android.widget.ViewFlipper; import com.beardedhen.androidbootstrap.BootstrapButton; -import com.devspark.appmsg.AppMsg; public class EncryptActivity extends DrawerActivity { @@ -216,8 +215,7 @@ public class EncryptActivity extends DrawerActivity { // encrypt file based on Uri // get file path from uri - //String path = FileHelper.getPath(this, uri); - String path = null; + String path = FileHelper.getPath(this, uri); if (path != null) { mInputFilename = path; @@ -417,17 +415,17 @@ public class EncryptActivity extends DrawerActivity { mOutputFilename = guessOutputFilename(mInputFilename); if (mInputFilename.equals("")) { - AppMsg.makeText(this, R.string.no_file_selected, AppMsg.STYLE_ALERT).show(); + Toast.makeText(this, R.string.no_file_selected, Toast.LENGTH_SHORT).show(); return; } if (!mInputFilename.startsWith("content")) { File file = new File(mInputFilename); if (!file.exists() || !file.isFile()) { - AppMsg.makeText( + Toast.makeText( this, getString(R.string.error_message, - getString(R.string.error_file_not_found)), AppMsg.STYLE_ALERT) + getString(R.string.error_file_not_found)), Toast.LENGTH_SHORT) .show(); return; } @@ -440,13 +438,13 @@ public class EncryptActivity extends DrawerActivity { String passPhrase = mPassPhrase.getText().toString(); String passPhraseAgain = mPassPhraseAgain.getText().toString(); if (!passPhrase.equals(passPhraseAgain)) { - AppMsg.makeText(this, R.string.passphrases_do_not_match, AppMsg.STYLE_ALERT).show(); + Toast.makeText(this, R.string.passphrases_do_not_match, Toast.LENGTH_SHORT).show(); return; } gotPassPhrase = (passPhrase.length() != 0); if (!gotPassPhrase) { - AppMsg.makeText(this, R.string.passphrase_must_not_be_empty, AppMsg.STYLE_ALERT) + Toast.makeText(this, R.string.passphrase_must_not_be_empty, Toast.LENGTH_SHORT) .show(); return; } @@ -454,13 +452,13 @@ public class EncryptActivity extends DrawerActivity { boolean encryptIt = (mEncryptionKeyIds != null && mEncryptionKeyIds.length > 0); // for now require at least one form of encryption for files if (!encryptIt && mEncryptTarget == Id.target.file) { - AppMsg.makeText(this, R.string.select_encryption_key, AppMsg.STYLE_ALERT).show(); + Toast.makeText(this, R.string.select_encryption_key, Toast.LENGTH_SHORT).show(); return; } if (!encryptIt && mSecretKeyId == 0) { - AppMsg.makeText(this, R.string.select_encryption_or_signature_key, - AppMsg.STYLE_ALERT).show(); + Toast.makeText(this, R.string.select_encryption_or_signature_key, + Toast.LENGTH_SHORT).show(); return; } @@ -620,8 +618,8 @@ public class EncryptActivity extends DrawerActivity { output = data.getString(KeychainIntentService.RESULT_ENCRYPTED_STRING); Log.d(Constants.TAG, "output: " + output); ClipboardReflection.copyToClipboard(EncryptActivity.this, output); - AppMsg.makeText(EncryptActivity.this, - R.string.encryption_to_clipboard_successful, AppMsg.STYLE_INFO) + Toast.makeText(EncryptActivity.this, + R.string.encryption_to_clipboard_successful, Toast.LENGTH_SHORT) .show(); break; @@ -642,8 +640,8 @@ public class EncryptActivity extends DrawerActivity { break; case Id.target.file: - AppMsg.makeText(EncryptActivity.this, R.string.encryption_successful, - AppMsg.STYLE_INFO).show(); + Toast.makeText(EncryptActivity.this, R.string.encryption_successful, + Toast.LENGTH_SHORT).show(); if (mDeleteAfter.isChecked()) { // Create and show dialog to delete original file From 09e220eddd96be0995e300c92e6e1f1638ed9bb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ha=C3=9F?= Date: Sun, 23 Feb 2014 23:56:10 +0100 Subject: [PATCH 3/4] Revert "Replaced Toast with AppMsg in EncryptActivity" This reverts commit e936a4762b4c6ed8153d216ab4655e251c4366f3. --- .../keychain/ui/EncryptActivity.java | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java index 85bfba224..6db4aae90 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java @@ -63,6 +63,7 @@ import android.widget.Toast; import android.widget.ViewFlipper; import com.beardedhen.androidbootstrap.BootstrapButton; +import com.devspark.appmsg.AppMsg; public class EncryptActivity extends DrawerActivity { @@ -215,7 +216,8 @@ public class EncryptActivity extends DrawerActivity { // encrypt file based on Uri // get file path from uri - String path = FileHelper.getPath(this, uri); + //String path = FileHelper.getPath(this, uri); + String path = null; if (path != null) { mInputFilename = path; @@ -415,17 +417,17 @@ public class EncryptActivity extends DrawerActivity { mOutputFilename = guessOutputFilename(mInputFilename); 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("content")) { 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; } @@ -438,13 +440,13 @@ public class EncryptActivity extends DrawerActivity { String passPhrase = mPassPhrase.getText().toString(); String passPhraseAgain = mPassPhraseAgain.getText().toString(); if (!passPhrase.equals(passPhraseAgain)) { - Toast.makeText(this, R.string.passphrases_do_not_match, Toast.LENGTH_SHORT).show(); + AppMsg.makeText(this, R.string.passphrases_do_not_match, AppMsg.STYLE_ALERT).show(); return; } gotPassPhrase = (passPhrase.length() != 0); if (!gotPassPhrase) { - Toast.makeText(this, R.string.passphrase_must_not_be_empty, Toast.LENGTH_SHORT) + AppMsg.makeText(this, R.string.passphrase_must_not_be_empty, AppMsg.STYLE_ALERT) .show(); return; } @@ -452,13 +454,13 @@ public class EncryptActivity extends DrawerActivity { boolean encryptIt = (mEncryptionKeyIds != null && mEncryptionKeyIds.length > 0); // for now require at least one form of encryption for files if (!encryptIt && mEncryptTarget == Id.target.file) { - Toast.makeText(this, R.string.select_encryption_key, Toast.LENGTH_SHORT).show(); + AppMsg.makeText(this, R.string.select_encryption_key, AppMsg.STYLE_ALERT).show(); return; } if (!encryptIt && mSecretKeyId == 0) { - Toast.makeText(this, R.string.select_encryption_or_signature_key, - Toast.LENGTH_SHORT).show(); + AppMsg.makeText(this, R.string.select_encryption_or_signature_key, + AppMsg.STYLE_ALERT).show(); return; } @@ -618,8 +620,8 @@ public class EncryptActivity extends DrawerActivity { output = data.getString(KeychainIntentService.RESULT_ENCRYPTED_STRING); Log.d(Constants.TAG, "output: " + output); ClipboardReflection.copyToClipboard(EncryptActivity.this, output); - Toast.makeText(EncryptActivity.this, - R.string.encryption_to_clipboard_successful, Toast.LENGTH_SHORT) + AppMsg.makeText(EncryptActivity.this, + R.string.encryption_to_clipboard_successful, AppMsg.STYLE_INFO) .show(); break; @@ -640,8 +642,8 @@ public class EncryptActivity extends DrawerActivity { break; case Id.target.file: - Toast.makeText(EncryptActivity.this, R.string.encryption_successful, - Toast.LENGTH_SHORT).show(); + AppMsg.makeText(EncryptActivity.this, R.string.encryption_successful, + AppMsg.STYLE_INFO).show(); if (mDeleteAfter.isChecked()) { // Create and show dialog to delete original file From 947b9902e5c394ef8c149c39c35fc31ca0ac80e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ha=C3=9F?= Date: Sun, 23 Feb 2014 23:59:55 +0100 Subject: [PATCH 4/4] remove debug stuff --- .../org/sufficientlysecure/keychain/ui/EncryptActivity.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java index 6db4aae90..9da6c1b9f 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java @@ -216,8 +216,7 @@ public class EncryptActivity extends DrawerActivity { // encrypt file based on Uri // get file path from uri - //String path = FileHelper.getPath(this, uri); - String path = null; + String path = FileHelper.getPath(this, uri); if (path != null) { mInputFilename = path;