aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/ui/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/pixart/messenger/ui/util')
-rw-r--r--src/main/java/de/pixart/messenger/ui/util/ConversationMenuConfigurator.java6
-rw-r--r--src/main/java/de/pixart/messenger/ui/util/EditMessageActionModeCallback.java9
2 files changed, 12 insertions, 3 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/util/ConversationMenuConfigurator.java b/src/main/java/de/pixart/messenger/ui/util/ConversationMenuConfigurator.java
index eb7217b95..03f7638e3 100644
--- a/src/main/java/de/pixart/messenger/ui/util/ConversationMenuConfigurator.java
+++ b/src/main/java/de/pixart/messenger/ui/util/ConversationMenuConfigurator.java
@@ -40,6 +40,7 @@ import de.pixart.messenger.R;
import de.pixart.messenger.crypto.OmemoSetting;
import de.pixart.messenger.crypto.axolotl.AxolotlService;
import de.pixart.messenger.entities.Conversation;
+import de.pixart.messenger.entities.Conversational;
import de.pixart.messenger.entities.Message;
public class ConversationMenuConfigurator {
@@ -71,6 +72,11 @@ public class ConversationMenuConfigurator {
public static void configureEncryptionMenu(@NonNull Conversation conversation, Menu menu) {
final MenuItem menuSecure = menu.findItem(R.id.action_security);
+ final boolean participating = conversation.getMode() == Conversational.MODE_SINGLE || conversation.getMucOptions().participating();
+ if (!participating) {
+ menuSecure.setVisible(false);
+ return;
+ }
final MenuItem none = menu.findItem(R.id.encryption_choice_none);
final MenuItem otr = menu.findItem(R.id.encryption_choice_otr);
final MenuItem pgp = menu.findItem(R.id.encryption_choice_pgp);
diff --git a/src/main/java/de/pixart/messenger/ui/util/EditMessageActionModeCallback.java b/src/main/java/de/pixart/messenger/ui/util/EditMessageActionModeCallback.java
index d7e2ca347..cb50e4164 100644
--- a/src/main/java/de/pixart/messenger/ui/util/EditMessageActionModeCallback.java
+++ b/src/main/java/de/pixart/messenger/ui/util/EditMessageActionModeCallback.java
@@ -55,7 +55,10 @@ public class EditMessageActionModeCallback implements ActionMode.Callback {
MenuInflater inflater = mode.getMenuInflater();
inflater.inflate(R.menu.edit_message_actions, menu);
MenuItem pasteAsQuote = menu.findItem(R.id.paste_as_quote);
- pasteAsQuote.setVisible(clipboardManager.hasPrimaryClip() && clipboardManager.getPrimaryClipDescription().hasMimeType("text/plain"));
+ ClipData primaryClip = clipboardManager.getPrimaryClip();
+ if (primaryClip != null && primaryClip.getItemCount() >= 0) {
+ pasteAsQuote.setVisible(primaryClip.getDescription().getMimeType(0).startsWith("text/") && primaryClip.getItemAt(0).getText() != null);
+ }
return true;
}
@@ -67,8 +70,8 @@ public class EditMessageActionModeCallback implements ActionMode.Callback {
@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
if (item.getItemId() == R.id.paste_as_quote) {
- ClipData primaryClip = clipboardManager.getPrimaryClip();
- if (primaryClip.getItemCount() >= 1) {
+ final ClipData primaryClip = clipboardManager.getPrimaryClip();
+ if (primaryClip != null && primaryClip.getItemCount() >= 1) {
editMessage.insertAsQuote(primaryClip.getItemAt(0).getText().toString());
return true;
}