mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-04 16:25:05 -05:00
Fix share to encrypt text
This commit is contained in:
parent
7d41800e57
commit
d73ea5f612
@ -452,27 +452,11 @@ public class EncryptFileActivity extends DrawerActivity implements EncryptActivi
|
|||||||
* Android's Action
|
* Android's Action
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// When sending to OpenKeychain Encrypt via share menu
|
||||||
if (Intent.ACTION_SEND.equals(action) && type != null) {
|
if (Intent.ACTION_SEND.equals(action) && type != null) {
|
||||||
// When sending to OpenKeychain Encrypt via share menu
|
// Files via content provider, override uri and action
|
||||||
/* if ("text/plain".equals(type)) {
|
uris.clear();
|
||||||
// TODO handle, maybe forward to "encrypt text" activity?
|
uris.add(intent.<Uri>getParcelableExtra(Intent.EXTRA_STREAM));
|
||||||
|
|
||||||
Plain text
|
|
||||||
String sharedText = intent.getStringExtra(Intent.EXTRA_TEXT);
|
|
||||||
if (sharedText != null) {
|
|
||||||
// handle like normal text encryption, override action and extras to later
|
|
||||||
// executeServiceMethod ACTION_ENCRYPT_TEXT in main actions
|
|
||||||
extras.putString(EXTRA_TEXT, sharedText);
|
|
||||||
extras.putBoolean(EXTRA_ASCII_ARMOR, true);
|
|
||||||
action = ACTION_ENCRYPT_TEXT;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else */
|
|
||||||
{
|
|
||||||
// Files via content provider, override uri and action
|
|
||||||
uris.clear();
|
|
||||||
uris.add(intent.<Uri>getParcelableExtra(Intent.EXTRA_STREAM));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Intent.ACTION_SEND_MULTIPLE.equals(action) && type != null) {
|
if (Intent.ACTION_SEND_MULTIPLE.equals(action) && type != null) {
|
||||||
|
@ -409,16 +409,29 @@ public class EncryptTextActivity extends DrawerActivity implements EncryptActivi
|
|||||||
private void handleActions(Intent intent) {
|
private void handleActions(Intent intent) {
|
||||||
String action = intent.getAction();
|
String action = intent.getAction();
|
||||||
Bundle extras = intent.getExtras();
|
Bundle extras = intent.getExtras();
|
||||||
// Should always be text/plain
|
String type = intent.getType();
|
||||||
// String type = intent.getType();
|
|
||||||
ArrayList<Uri> uris = new ArrayList<Uri>();
|
|
||||||
|
|
||||||
if (extras == null) {
|
if (extras == null) {
|
||||||
extras = new Bundle();
|
extras = new Bundle();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (intent.getData() != null) {
|
/*
|
||||||
uris.add(intent.getData());
|
* Android's Action
|
||||||
|
*/
|
||||||
|
|
||||||
|
// When sending to OpenKeychain Encrypt via share menu
|
||||||
|
if (Intent.ACTION_SEND.equals(action) && type != null) {
|
||||||
|
// When sending to OpenKeychain Encrypt via share menu
|
||||||
|
if ("text/plain".equals(type)) {
|
||||||
|
String sharedText = intent.getStringExtra(Intent.EXTRA_TEXT);
|
||||||
|
if (sharedText != null) {
|
||||||
|
// handle like normal text encryption, override action and extras to later
|
||||||
|
// executeServiceMethod ACTION_ENCRYPT_TEXT in main actions
|
||||||
|
extras.putString(EXTRA_TEXT, sharedText);
|
||||||
|
action = ACTION_ENCRYPT_TEXT;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String textData = extras.getString(EXTRA_TEXT);
|
String textData = extras.getString(EXTRA_TEXT);
|
||||||
|
Loading…
Reference in New Issue
Block a user