diff options
author | Thialfihar <thialfihar@gmail.com> | 2010-06-06 11:42:41 +0000 |
---|---|---|
committer | Thialfihar <thialfihar@gmail.com> | 2010-06-06 11:42:41 +0000 |
commit | a0ab2402144dd5913d6b8f6588b4dea392b45572 (patch) | |
tree | 371f04646dacd72d33ec0d3a63f3b6a7081fce71 | |
parent | 26a500956f0beb4adc4b617876b9baa280382fdf (diff) | |
download | open-keychain-a0ab2402144dd5913d6b8f6588b4dea392b45572.tar.gz open-keychain-a0ab2402144dd5913d6b8f6588b4dea392b45572.tar.bz2 open-keychain-a0ab2402144dd5913d6b8f6588b4dea392b45572.zip |
some Activity Intent filter cleanup, pass messages via Strings rather than ByteArrays, avoid some encoding issues
-rw-r--r-- | AndroidManifest.xml | 2 | ||||
-rw-r--r-- | src/org/thialfihar/android/apg/DecryptActivity.java | 7 | ||||
-rw-r--r-- | src/org/thialfihar/android/apg/EncryptActivity.java | 8 |
3 files changed, 7 insertions, 10 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index d79421e44..48883cde8 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -81,7 +81,6 @@ <intent-filter> <action android:name="org.thialfihar.android.apg.intent.SELECT_PUBLIC_KEYS" /> <category android:name="android.intent.category.DEFAULT"/> - <data android:mimeType="text/*"/> </intent-filter> <intent-filter> @@ -103,7 +102,6 @@ <intent-filter> <action android:name="org.thialfihar.android.apg.intent.SELECT_SECRET_KEY" /> <category android:name="android.intent.category.DEFAULT"/> - <data android:mimeType="text/*"/> </intent-filter> <intent-filter> diff --git a/src/org/thialfihar/android/apg/DecryptActivity.java b/src/org/thialfihar/android/apg/DecryptActivity.java index 42c4d0b9c..85be8c80b 100644 --- a/src/org/thialfihar/android/apg/DecryptActivity.java +++ b/src/org/thialfihar/android/apg/DecryptActivity.java @@ -503,8 +503,8 @@ public class DecryptActivity extends BaseActivity { out.close(); if (mDecryptTarget == Id.target.message) { - data.putByteArray(Apg.EXTRA_DECRYPTED_MESSAGE, - ((ByteArrayOutputStream) out).toByteArray()); + data.putString(Apg.EXTRA_DECRYPTED_MESSAGE, + new String(((ByteArrayOutputStream) out).toByteArray())); } } catch (PGPException e) { error = "" + e; @@ -546,8 +546,7 @@ public class DecryptActivity extends BaseActivity { Toast.makeText(this, R.string.decryptionSuccessful, Toast.LENGTH_SHORT).show(); switch (mDecryptTarget) { case Id.target.message: { - String decryptedMessage = - new String(data.getByteArray(Apg.EXTRA_DECRYPTED_MESSAGE)); + String decryptedMessage = data.getString(Apg.EXTRA_DECRYPTED_MESSAGE); mMessage.setText(decryptedMessage); mMessage.setHorizontallyScrolling(false); mReplyButton.setVisibility(View.VISIBLE); diff --git a/src/org/thialfihar/android/apg/EncryptActivity.java b/src/org/thialfihar/android/apg/EncryptActivity.java index da74e9a89..cdc80e156 100644 --- a/src/org/thialfihar/android/apg/EncryptActivity.java +++ b/src/org/thialfihar/android/apg/EncryptActivity.java @@ -620,8 +620,8 @@ public class EncryptActivity extends BaseActivity { out.close(); if (mEncryptTarget != Id.target.file) { - data.putByteArray(Apg.EXTRA_ENCRYPTED_MESSAGE, - ((ByteArrayOutputStream)out).toByteArray()); + data.putString(Apg.EXTRA_ENCRYPTED_MESSAGE, + new String(((ByteArrayOutputStream)out).toByteArray())); } } catch (IOException e) { error = "" + e; @@ -770,7 +770,7 @@ public class EncryptActivity extends BaseActivity { } switch (mEncryptTarget) { case Id.target.clipboard: { - String message = new String(data.getByteArray(Apg.EXTRA_ENCRYPTED_MESSAGE)); + String message = data.getString(Apg.EXTRA_ENCRYPTED_MESSAGE); ClipboardManager clip = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE); clip.setText(message); Toast.makeText(this, R.string.encryptionToClipboardSuccessful, @@ -787,7 +787,7 @@ public class EncryptActivity extends BaseActivity { return; } - String message = new String(data.getByteArray(Apg.EXTRA_ENCRYPTED_MESSAGE)); + String message = data.getString(Apg.EXTRA_ENCRYPTED_MESSAGE); Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType("text/plain; charset=utf-8"); emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, message); |