restructure conversation menu

we don’t want 'manage accounts' and 'settings' to show up when within a conversation.
we also move out disable notifications and add to favorites into an overflow overflow
to make the menu shorter (after adding 'Search messages' it became very crowded)
This commit is contained in:
Daniel Gultsch 2020-09-01 16:50:25 +02:00
parent 73dac680e5
commit 27c89e487a
6 changed files with 49 additions and 41 deletions

View File

@ -380,8 +380,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
@Override @Override
public boolean onCreateOptionsMenu(Menu menu) { public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_conversations, menu); getMenuInflater().inflate(R.menu.activity_conversations, menu);
AccountUtils.showHideMenuItems(menu); final MenuItem qrCodeScanMenuItem = menu.findItem(R.id.action_scan_qr_code);
MenuItem qrCodeScanMenuItem = menu.findItem(R.id.action_scan_qr_code);
if (qrCodeScanMenuItem != null) { if (qrCodeScanMenuItem != null) {
if (isCameraFeatureAvailable()) { if (isCameraFeatureAvailable()) {
Fragment fragment = getFragmentManager().findFragmentById(R.id.main_fragment); Fragment fragment = getFragmentManager().findFragmentById(R.id.main_fragment);

View File

@ -64,6 +64,7 @@ import eu.siacs.conversations.ui.util.PendingActionHelper;
import eu.siacs.conversations.ui.util.PendingItem; import eu.siacs.conversations.ui.util.PendingItem;
import eu.siacs.conversations.ui.util.ScrollState; import eu.siacs.conversations.ui.util.ScrollState;
import eu.siacs.conversations.ui.util.StyledAttributes; import eu.siacs.conversations.ui.util.StyledAttributes;
import eu.siacs.conversations.utils.AccountUtils;
import eu.siacs.conversations.utils.ThemeHelper; import eu.siacs.conversations.utils.ThemeHelper;
import static android.support.v7.widget.helper.ItemTouchHelper.LEFT; import static android.support.v7.widget.helper.ItemTouchHelper.LEFT;
@ -284,6 +285,7 @@ public class ConversationsOverviewFragment extends XmppFragment {
@Override @Override
public void onCreateOptionsMenu(Menu menu, MenuInflater menuInflater) { public void onCreateOptionsMenu(Menu menu, MenuInflater menuInflater) {
menuInflater.inflate(R.menu.fragment_conversations_overview, menu); menuInflater.inflate(R.menu.fragment_conversations_overview, menu);
AccountUtils.showHideMenuItems(menu);
} }
@Override @Override

View File

@ -1,15 +1,8 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android" <menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_scan_qr_code"
android:icon="?attr/icon_scan_qr_code"
android:orderInCategory="10"
android:title="@string/scan_qr_code"
android:visible="@bool/show_qr_code_scan"
app:showAsAction="always"/>
<item <item
android:icon="?attr/icon_search" android:icon="?attr/icon_search"
android:orderInCategory="11" android:orderInCategory="5"
android:title="@string/search_messages" android:title="@string/search_messages"
android:visible="@bool/show_combined_search_options" android:visible="@bool/show_combined_search_options"
app:showAsAction="always"> app:showAsAction="always">
@ -23,19 +16,10 @@
</menu> </menu>
</item> </item>
<item <item
android:id="@+id/action_accounts" android:id="@+id/action_scan_qr_code"
android:orderInCategory="90" android:icon="?attr/icon_scan_qr_code"
android:title="@string/action_accounts" android:orderInCategory="10"
app:showAsAction="never" /> android:title="@string/scan_qr_code"
<item android:visible="@bool/show_qr_code_scan"
android:id="@+id/action_account" app:showAsAction="always" />
android:orderInCategory="90"
android:title="@string/action_account"
app:showAsAction="never" />
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:title="@string/action_settings"
app:showAsAction="never" />
</menu> </menu>

View File

@ -116,20 +116,27 @@
android:title="@string/action_end_conversation" android:title="@string/action_end_conversation"
app:showAsAction="never" /> app:showAsAction="never" />
<item <item
android:id="@+id/action_mute"
android:orderInCategory="70" android:orderInCategory="70"
android:title="@string/more_options">
<menu>
<item
android:id="@+id/action_mute"
android:orderInCategory="71"
android:title="@string/disable_notifications" android:title="@string/disable_notifications"
app:showAsAction="never" /> app:showAsAction="never" />
<item <item
android:id="@+id/action_unmute" android:id="@+id/action_unmute"
android:orderInCategory="71" android:orderInCategory="72"
android:title="@string/enable_notifications" android:title="@string/enable_notifications"
app:showAsAction="never" /> app:showAsAction="never" />
<item <item
android:id="@+id/action_toggle_pinned" android:id="@+id/action_toggle_pinned"
android:orderInCategory="72" android:orderInCategory="73"
android:title="@string/add_to_favorites" android:title="@string/add_to_favorites"
app:showAsAction="never" /> app:showAsAction="never" />
</menu>
</item>
</menu> </menu>

View File

@ -31,8 +31,23 @@
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<item <item
android:id="@+id/action_search" android:id="@+id/action_search"
android:orderInCategory="10"
android:title="@string/search_messages" android:title="@string/search_messages"
android:visible="@bool/show_individual_search_options" android:visible="@bool/show_individual_search_options"
android:orderInCategory="50" app:showAsAction="never" />
app:showAsAction="never"/> <item
android:id="@+id/action_accounts"
android:orderInCategory="90"
android:title="@string/action_accounts"
app:showAsAction="never" />
<item
android:id="@+id/action_account"
android:orderInCategory="90"
android:title="@string/action_account"
app:showAsAction="never" />
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:title="@string/action_settings"
app:showAsAction="never" />
</menu> </menu>

View File

@ -948,4 +948,5 @@
<item quantity="other">Some messages could not be delivered</item> <item quantity="other">Some messages could not be delivered</item>
</plurals> </plurals>
<string name="failed_deliveries">Failed deliveries</string> <string name="failed_deliveries">Failed deliveries</string>
<string name="more_options">More options</string>
</resources> </resources>