From e612506be34a4983dd870ef96f2ee1f1dc0fab25 Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Sat, 31 Aug 2019 15:50:13 +0200 Subject: when sharing text from PAM to PAM use quotes --- src/main/java/de/pixart/messenger/ui/ConversationsActivity.java | 6 +++--- src/main/java/de/pixart/messenger/ui/ShareWithActivity.java | 6 +++++- src/main/java/de/pixart/messenger/ui/util/ShareUtil.java | 3 +++ 3 files changed, 11 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java b/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java index d391f34d3..8270d4e1a 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java @@ -102,7 +102,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio public static final String ACTION_VIEW_CONVERSATION = "de.pixart.messenger.VIEW"; public static final String EXTRA_CONVERSATION = "conversationUuid"; public static final String EXTRA_DOWNLOAD_UUID = "de.pixart.messenger.download_uuid"; - public static final String EXTRA_AS_QUOTE = "as_quote"; + public static final String EXTRA_AS_QUOTE = "de.pixart.messenger.as_quote"; public static final String EXTRA_NICK = "nick"; public static final String EXTRA_IS_PRIVATE_MESSAGE = "pm"; public static final String EXTRA_DO_NOT_APPEND = "do_not_append"; @@ -144,7 +144,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio @Override protected void refreshUiReal() { invalidateActionBarTitle(); - for(@IdRes int id : FRAGMENT_ID_NOTIFICATION_ORDER) { + for (@IdRes int id : FRAGMENT_ID_NOTIFICATION_ORDER) { refreshFragment(id); } } @@ -325,7 +325,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio } private boolean processViewIntent(Intent intent) { - Log.d(Config.LOGTAG,"process view intent"); + Log.d(Config.LOGTAG, "process view intent"); String uuid = intent.getStringExtra(EXTRA_CONVERSATION); Conversation conversation = uuid != null ? xmppConnectionService.findConversationByUuid(uuid) : null; if (conversation == null) { diff --git a/src/main/java/de/pixart/messenger/ui/ShareWithActivity.java b/src/main/java/de/pixart/messenger/ui/ShareWithActivity.java index ade413771..63c0dc323 100644 --- a/src/main/java/de/pixart/messenger/ui/ShareWithActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ShareWithActivity.java @@ -116,6 +116,7 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer if (Intent.ACTION_SEND.equals(action)) { final String text = intent.getStringExtra(Intent.EXTRA_TEXT); final Uri uri = intent.getParcelableExtra(Intent.EXTRA_STREAM); + final boolean asQuote = intent.getBooleanExtra(ConversationsActivity.EXTRA_AS_QUOTE, false); if (data != null && "geo".equals(data.getScheme())) { this.share.uris.clear(); this.share.uris.add(data); @@ -124,6 +125,7 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer this.share.uris.add(uri); } else { this.share.text = text; + this.share.asQuote = asQuote; } } else if (Intent.ACTION_SEND_MULTIPLE.equals(action)) { final ArrayList uris = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM); @@ -176,6 +178,7 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer } else if (share.text != null) { intent.setAction(ConversationsActivity.ACTION_VIEW_CONVERSATION); intent.putExtra(Intent.EXTRA_TEXT, share.text); + intent.putExtra(ConversationsActivity.EXTRA_AS_QUOTE, share.asQuote); } startActivity(intent); finish(); @@ -188,9 +191,10 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer } private class Share { + ArrayList uris = new ArrayList<>(); public String account; public String contact; public String text; - ArrayList uris = new ArrayList<>(); + public boolean asQuote = false; } } \ No newline at end of file diff --git a/src/main/java/de/pixart/messenger/ui/util/ShareUtil.java b/src/main/java/de/pixart/messenger/ui/util/ShareUtil.java index 1f53a4c72..0b491e8ab 100644 --- a/src/main/java/de/pixart/messenger/ui/util/ShareUtil.java +++ b/src/main/java/de/pixart/messenger/ui/util/ShareUtil.java @@ -39,6 +39,7 @@ import de.pixart.messenger.R; import de.pixart.messenger.entities.DownloadableFile; import de.pixart.messenger.entities.Message; import de.pixart.messenger.persistance.FileBackend; +import de.pixart.messenger.ui.ConversationsActivity; import de.pixart.messenger.ui.XmppActivity; import de.pixart.messenger.utils.Patterns; import de.pixart.messenger.utils.XmppUri; @@ -52,9 +53,11 @@ public class ShareUtil { if (message.isGeoUri()) { shareIntent.putExtra(Intent.EXTRA_TEXT, message.getBody()); shareIntent.setType("text/plain"); + shareIntent.putExtra(ConversationsActivity.EXTRA_AS_QUOTE, true); } else if (!message.isFileOrImage()) { shareIntent.putExtra(Intent.EXTRA_TEXT, message.getMergedBody().toString()); shareIntent.setType("text/plain"); + shareIntent.putExtra(ConversationsActivity.EXTRA_AS_QUOTE, true); } else { final DownloadableFile file = activity.xmppConnectionService.getFileBackend().getFile(message); try { -- cgit v1.2.3