mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
re-organize menu and add pencil icon
This commit is contained in:
+9
-16
@@ -23,11 +23,10 @@ public class ConversationAdaptiveActionsToolbar extends Toolbar {
|
||||
private static final int ACTION_VIEW_WIDTH_DP = 48;
|
||||
private static final int OVERFLOW_VIEW_WIDTH_DP = 36;
|
||||
|
||||
private static final int ID_NEVER_SHOW_AS_ACTION_1 = R.id.menu_context_reply_privately;
|
||||
private static final int ID_NEVER_SHOW_AS_ACTION_2 = R.id.menu_add_to_home_screen;
|
||||
private static final int ID_NEVER_SHOW_AS_ACTION_3 = R.id.menu_context_save_attachment;
|
||||
private static final int ID_NEVER_SHOW_AS_ACTION_4 = R.id.menu_resend;
|
||||
private static final int ID_ALWAYS_SHOW_AS_ACTION = R.id.menu_context_forward;
|
||||
private static final int ID_ACTION_1 = R.id.menu_context_edit;
|
||||
private static final int ID_ACTION_2 = R.id.menu_context_copy;
|
||||
private static final int ID_ACTION_3 = R.id.menu_context_share;
|
||||
private static final int ID_ACTION_4 = R.id.menu_context_forward;
|
||||
|
||||
private final int maxShown;
|
||||
|
||||
@@ -74,21 +73,15 @@ public class ConversationAdaptiveActionsToolbar extends Toolbar {
|
||||
|
||||
nItemsToShow = Math.min(maxToShow, widthAllowed / ViewUtil.dpToPx(ACTION_VIEW_WIDTH_DP));
|
||||
|
||||
menu.findItem(ID_ALWAYS_SHOW_AS_ACTION).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||
nItemsToShow--;
|
||||
|
||||
for (int i = 0; i < menu.size(); i++) {
|
||||
MenuItem item = menu.getItem(i);
|
||||
|
||||
boolean neverShowAsAction = item.getItemId() == ID_NEVER_SHOW_AS_ACTION_1
|
||||
|| item.getItemId() == ID_NEVER_SHOW_AS_ACTION_2
|
||||
|| item.getItemId() == ID_NEVER_SHOW_AS_ACTION_3
|
||||
|| item.getItemId() == ID_NEVER_SHOW_AS_ACTION_4;
|
||||
boolean alwaysShowAsAction = item.getItemId() == ID_ALWAYS_SHOW_AS_ACTION;
|
||||
boolean showAsAction = item.getItemId() == ID_ACTION_1
|
||||
|| item.getItemId() == ID_ACTION_2
|
||||
|| item.getItemId() == ID_ACTION_3
|
||||
|| item.getItemId() == ID_ACTION_4;
|
||||
|
||||
if (alwaysShowAsAction) continue;
|
||||
|
||||
if (item.isVisible() && nItemsToShow > 0 && !neverShowAsAction) {
|
||||
if (showAsAction && item.isVisible() && nItemsToShow > 0) {
|
||||
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||
nItemsToShow--;
|
||||
} else {
|
||||
|
||||
@@ -1,58 +1,59 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<item android:title="@string/menu_reply"
|
||||
android:id="@+id/menu_context_reply"
|
||||
android:icon="?menu_reply_icon"
|
||||
app:showAsAction="always" />
|
||||
<item android:title="@string/edit_message"
|
||||
android:id="@+id/menu_context_edit"
|
||||
android:icon="@drawable/ic_create_white_24dp"
|
||||
app:showAsAction="ifRoom" />
|
||||
|
||||
<item android:title="@string/menu_message_details"
|
||||
android:id="@+id/menu_context_details"
|
||||
android:icon="?menu_info_icon"
|
||||
app:showAsAction="always" />
|
||||
<item android:title="@string/menu_copy_text_to_clipboard"
|
||||
android:id="@+id/menu_context_copy"
|
||||
android:icon="?menu_copy_icon"
|
||||
app:showAsAction="ifRoom" />
|
||||
|
||||
<item android:title="@string/menu_delete_messages"
|
||||
android:id="@+id/menu_context_delete_message"
|
||||
android:icon="?menu_trash_icon"
|
||||
app:showAsAction="always" />
|
||||
|
||||
<item android:title="@string/menu_share"
|
||||
<item android:title="@string/menu_share"
|
||||
android:id="@+id/menu_context_share"
|
||||
android:icon="@drawable/ic_share_white_24dp"
|
||||
app:showAsAction="always" />
|
||||
app:showAsAction="ifRoom" />
|
||||
|
||||
<item android:title="@string/add_to_home_screen"
|
||||
<item android:title="@string/menu_forward"
|
||||
android:id="@+id/menu_context_forward"
|
||||
android:icon="?menu_forward_icon"
|
||||
app:showAsAction="ifRoom" />
|
||||
|
||||
<item android:title="@string/menu_delete_messages"
|
||||
android:id="@+id/menu_context_delete_message"
|
||||
android:icon="?menu_trash_icon"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item android:title="@string/menu_message_details"
|
||||
android:id="@+id/menu_context_details"
|
||||
android:icon="?menu_info_icon"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item android:title="@string/add_to_home_screen"
|
||||
android:id="@+id/menu_add_to_home_screen"
|
||||
android:visible="false"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item android:title="@string/menu_copy_text_to_clipboard"
|
||||
android:id="@+id/menu_context_copy"
|
||||
android:icon="?menu_copy_icon"
|
||||
app:showAsAction="always" />
|
||||
|
||||
<item android:title="@string/menu_forward"
|
||||
android:id="@+id/menu_context_forward"
|
||||
android:icon="?menu_forward_icon"
|
||||
app:showAsAction="always" />
|
||||
|
||||
<item android:title="@string/menu_export_attachments"
|
||||
<item android:title="@string/menu_export_attachments"
|
||||
android:id="@+id/menu_context_save_attachment"
|
||||
android:visible="false"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item android:title="@string/reply_privately"
|
||||
<item android:title="@string/menu_reply"
|
||||
android:id="@+id/menu_context_reply"
|
||||
android:icon="?menu_reply_icon"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item android:title="@string/reply_privately"
|
||||
android:id="@+id/menu_context_reply_privately"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item android:title="@string/edit_message"
|
||||
android:id="@+id/menu_context_edit"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item android:title="@string/resend"
|
||||
<item android:title="@string/resend"
|
||||
android:id="@+id/menu_resend"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<!-- The `showAsAction` behaviors are managed by
|
||||
ConversationAdaptiveActionsToolbar. The `app:showAsAction`
|
||||
values set here don't actually make a difference.-->
|
||||
<!-- The `showAsAction` behaviors are managed by
|
||||
ConversationAdaptiveActionsToolbar. The `app:showAsAction`
|
||||
values set here don't actually make a difference.-->
|
||||
</menu>
|
||||
|
||||
Reference in New Issue
Block a user