some Activity Intent filter cleanup, pass messages via Strings rather than ByteArrays, avoid some encoding issues
This commit is contained in:
@@ -81,7 +81,6 @@
|
|||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="org.thialfihar.android.apg.intent.SELECT_PUBLIC_KEYS" />
|
<action android:name="org.thialfihar.android.apg.intent.SELECT_PUBLIC_KEYS" />
|
||||||
<category android:name="android.intent.category.DEFAULT"/>
|
<category android:name="android.intent.category.DEFAULT"/>
|
||||||
<data android:mimeType="text/*"/>
|
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
@@ -103,7 +102,6 @@
|
|||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="org.thialfihar.android.apg.intent.SELECT_SECRET_KEY" />
|
<action android:name="org.thialfihar.android.apg.intent.SELECT_SECRET_KEY" />
|
||||||
<category android:name="android.intent.category.DEFAULT"/>
|
<category android:name="android.intent.category.DEFAULT"/>
|
||||||
<data android:mimeType="text/*"/>
|
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
|
|||||||
@@ -503,8 +503,8 @@ public class DecryptActivity extends BaseActivity {
|
|||||||
|
|
||||||
out.close();
|
out.close();
|
||||||
if (mDecryptTarget == Id.target.message) {
|
if (mDecryptTarget == Id.target.message) {
|
||||||
data.putByteArray(Apg.EXTRA_DECRYPTED_MESSAGE,
|
data.putString(Apg.EXTRA_DECRYPTED_MESSAGE,
|
||||||
((ByteArrayOutputStream) out).toByteArray());
|
new String(((ByteArrayOutputStream) out).toByteArray()));
|
||||||
}
|
}
|
||||||
} catch (PGPException e) {
|
} catch (PGPException e) {
|
||||||
error = "" + e;
|
error = "" + e;
|
||||||
@@ -546,8 +546,7 @@ public class DecryptActivity extends BaseActivity {
|
|||||||
Toast.makeText(this, R.string.decryptionSuccessful, Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, R.string.decryptionSuccessful, Toast.LENGTH_SHORT).show();
|
||||||
switch (mDecryptTarget) {
|
switch (mDecryptTarget) {
|
||||||
case Id.target.message: {
|
case Id.target.message: {
|
||||||
String decryptedMessage =
|
String decryptedMessage = data.getString(Apg.EXTRA_DECRYPTED_MESSAGE);
|
||||||
new String(data.getByteArray(Apg.EXTRA_DECRYPTED_MESSAGE));
|
|
||||||
mMessage.setText(decryptedMessage);
|
mMessage.setText(decryptedMessage);
|
||||||
mMessage.setHorizontallyScrolling(false);
|
mMessage.setHorizontallyScrolling(false);
|
||||||
mReplyButton.setVisibility(View.VISIBLE);
|
mReplyButton.setVisibility(View.VISIBLE);
|
||||||
|
|||||||
@@ -620,8 +620,8 @@ public class EncryptActivity extends BaseActivity {
|
|||||||
|
|
||||||
out.close();
|
out.close();
|
||||||
if (mEncryptTarget != Id.target.file) {
|
if (mEncryptTarget != Id.target.file) {
|
||||||
data.putByteArray(Apg.EXTRA_ENCRYPTED_MESSAGE,
|
data.putString(Apg.EXTRA_ENCRYPTED_MESSAGE,
|
||||||
((ByteArrayOutputStream)out).toByteArray());
|
new String(((ByteArrayOutputStream)out).toByteArray()));
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
error = "" + e;
|
error = "" + e;
|
||||||
@@ -770,7 +770,7 @@ public class EncryptActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
switch (mEncryptTarget) {
|
switch (mEncryptTarget) {
|
||||||
case Id.target.clipboard: {
|
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);
|
ClipboardManager clip = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
|
||||||
clip.setText(message);
|
clip.setText(message);
|
||||||
Toast.makeText(this, R.string.encryptionToClipboardSuccessful,
|
Toast.makeText(this, R.string.encryptionToClipboardSuccessful,
|
||||||
@@ -787,7 +787,7 @@ public class EncryptActivity extends BaseActivity {
|
|||||||
return;
|
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);
|
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
|
||||||
emailIntent.setType("text/plain; charset=utf-8");
|
emailIntent.setType("text/plain; charset=utf-8");
|
||||||
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, message);
|
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, message);
|
||||||
|
|||||||
Reference in New Issue
Block a user