some small bugfixes

This commit is contained in:
Thialfihar 2010-06-02 19:30:27 +00:00
parent 9ad474e95b
commit 2f04e7ee05
2 changed files with 5 additions and 5 deletions

View File

@ -188,7 +188,7 @@ public class DecryptActivity extends BaseActivity {
mMessage.setText(data);
}
mSubject = extras.getString(Intent.EXTRA_SUBJECT);
if (mSubject.startsWith("Fwd: ")) {
if (mSubject != null && mSubject.startsWith("Fwd: ")) {
mSubject = mSubject.substring(5);
}
} else if (Apg.Intent.DECRYPT.equals(mIntent.getAction())) {
@ -247,8 +247,6 @@ public class DecryptActivity extends BaseActivity {
}
}
}
mReplyTo = extras.getString(Apg.EXTRA_REPLY_TO);
mSubject = extras.getString(Apg.EXTRA_SUBJECT);
mReturnResult = true;
}

View File

@ -364,7 +364,8 @@ public class EncryptActivity extends BaseActivity {
mEncryptButton.setText(R.string.btn_encrypt);
}
if (mMessage.getText().length() > 0 &&
if (mReturnResult &&
mMessage.getText().length() > 0 &&
((mEncryptionKeyIds != null &&
mEncryptionKeyIds.length > 0) ||
getSecretKeyId() != 0)) {
@ -760,9 +761,9 @@ public class EncryptActivity extends BaseActivity {
getString(R.string.errorMessage, error), Toast.LENGTH_SHORT).show();
return;
}
String message = Strings.fromUTF8ByteArray(data.getByteArray(Apg.EXTRA_ENCRYPTED_MESSAGE));
switch (mEncryptTarget) {
case Id.target.clipboard: {
String message = new String(data.getByteArray(Apg.EXTRA_ENCRYPTED_MESSAGE));
ClipboardManager clip = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
clip.setText(message);
Toast.makeText(this, R.string.encryptionToClipboardSuccessful,
@ -779,6 +780,7 @@ public class EncryptActivity extends BaseActivity {
return;
}
String message = new String(data.getByteArray(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);