catch ACTION_SEND intent to decrypt, allowing k9mail's "Forward (alternate)" feature to send to APG

This commit is contained in:
Thialfihar 2010-05-18 15:02:57 +00:00
parent 51866bb2b2
commit 508d7ac197
2 changed files with 19 additions and 0 deletions

View File

@ -83,6 +83,12 @@
<data android:mimeType="text/*"/> <data android:mimeType="text/*"/>
</intent-filter> </intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="text/*"/>
</intent-filter>
<intent-filter> <intent-filter>
<action android:name="org.thialfihar.android.apg.intent.DECRYPT" /> <action android:name="org.thialfihar.android.apg.intent.DECRYPT" />
<action android:name="org.thialfihar.android.apg.intent.DECRYPT_FILE" /> <action android:name="org.thialfihar.android.apg.intent.DECRYPT_FILE" />

View File

@ -177,6 +177,19 @@ public class DecryptActivity extends BaseActivity {
} catch (IOException e) { } catch (IOException e) {
// ignore, then // ignore, then
} }
} else if (intent.getAction() != null && intent.getAction().equals(Intent.ACTION_SEND)) {
Bundle extras = intent.getExtras();
if (extras == null) {
extras = new Bundle();
}
String data = extras.getString(Intent.EXTRA_TEXT);
if (data != null) {
mMessage.setText(data);
}
mSubject = extras.getString(Intent.EXTRA_SUBJECT);
if (mSubject.startsWith("Fwd: ")) {
mSubject = mSubject.substring(5);
}
} else if (intent.getAction() != null && intent.getAction().equals(Apg.Intent.DECRYPT)) { } else if (intent.getAction() != null && intent.getAction().equals(Apg.Intent.DECRYPT)) {
Bundle extras = intent.getExtras(); Bundle extras = intent.getExtras();
if (extras == null) { if (extras == null) {