From ab5c57736ab465d784bc8e0b04c0d530dfde9314 Mon Sep 17 00:00:00 2001 From: bjoern Date: Wed, 27 Oct 2021 10:42:53 +0200 Subject: [PATCH] re-add "Add Attachment" menu entry (#2094) it was removed to have some less menu entries, however, on recent discussions, it turns out clearer and clearte that this will break some workflows (writing text first, then adding attachment). i just had a look at other "large" messengers - all of them support "write text, then add attachment" - as well as our iOS and Desktop apps. also, this order seems to be pretty normal when it comes to "E-Mail". all in all, i think, we should not sacrify this workflow just to save one menu entry. at some point, maybe we want to have the "Attach" button always visible left of the input bar as most other messengers do (as well as iOS and Desktop), however, this is a larger thing and also has its drawbacks on smaller screens. so, just leave things as is seems not to be the worse idea here. the "View Profile" menu entry, however stays, removed, so, there is some cleanup. --- res/menu/conversation.xml | 3 +++ src/org/thoughtcrime/securesms/ConversationActivity.java | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/res/menu/conversation.xml b/res/menu/conversation.xml index 15c4bcdf0..7e01c4416 100644 --- a/res/menu/conversation.xml +++ b/res/menu/conversation.xml @@ -39,4 +39,7 @@ android:icon="@drawable/ic_map_white_24dp" app:showAsAction="ifRoom" /> + + diff --git a/src/org/thoughtcrime/securesms/ConversationActivity.java b/src/org/thoughtcrime/securesms/ConversationActivity.java index 3a97bbc53..5915e86d0 100644 --- a/src/org/thoughtcrime/securesms/ConversationActivity.java +++ b/src/org/thoughtcrime/securesms/ConversationActivity.java @@ -515,6 +515,13 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity Log.e(TAG, "cannot set up in-chat-search: ", e); } + if (!dcChat.canSend()) { + MenuItem attachItem = menu.findItem(R.id.menu_add_attachment); + if (attachItem!=null) { + attachItem.setVisible(false); + } + } + super.onPrepareOptionsMenu(menu); return true; } @@ -523,6 +530,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity public boolean onOptionsItemSelected(MenuItem item) { super.onOptionsItemSelected(item); switch (item.getItemId()) { + case R.id.menu_add_attachment: handleAddAttachment(); return true; case R.id.menu_leave: handleLeaveGroup(); return true; case R.id.menu_archive_chat: handleArchiveChat(); return true; case R.id.menu_delete_chat: handleDeleteChat(); return true;