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
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_conversations, menu);
AccountUtils.showHideMenuItems(menu);
MenuItem qrCodeScanMenuItem = menu.findItem(R.id.action_scan_qr_code);
final MenuItem qrCodeScanMenuItem = menu.findItem(R.id.action_scan_qr_code);
if (qrCodeScanMenuItem != null) {
if (isCameraFeatureAvailable()) {
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.ScrollState;
import eu.siacs.conversations.ui.util.StyledAttributes;
import eu.siacs.conversations.utils.AccountUtils;
import eu.siacs.conversations.utils.ThemeHelper;
import static android.support.v7.widget.helper.ItemTouchHelper.LEFT;
@ -284,6 +285,7 @@ public class ConversationsOverviewFragment extends XmppFragment {
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater menuInflater) {
menuInflater.inflate(R.menu.fragment_conversations_overview, menu);
AccountUtils.showHideMenuItems(menu);
}
@Override

View File

@ -1,15 +1,8 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
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
android:icon="?attr/icon_search"
android:orderInCategory="11"
android:orderInCategory="5"
android:title="@string/search_messages"
android:visible="@bool/show_combined_search_options"
app:showAsAction="always">
@ -23,19 +16,10 @@
</menu>
</item>
<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" />
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" />
</menu>

View File

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

View File

@ -31,8 +31,23 @@
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_search"
android:orderInCategory="10"
android:title="@string/search_messages"
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>

View File

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