some Activity Intent filter cleanup, pass messages via Strings rather than ByteArrays, avoid some encoding issues

This commit is contained in:
Thialfihar 2010-06-06 11:42:41 +00:00
parent 26a500956f
commit a0ab240214
3 changed files with 7 additions and 10 deletions

View File

@ -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>

View File

@ -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);

View File

@ -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);