mirror of
https://github.com/deltachat/deltachat-android.git
synced 2025-10-06 03:49:58 +02:00
Merge pull request #1674 from deltachat/tweak-menu
tweak chat-action-bar menu
This commit is contained in:
commit
c7c30bbb16
3 changed files with 4 additions and 14 deletions
|
@ -1,10 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?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">
|
<menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
<item android:title="@string/menu_resend"
|
|
||||||
android:id="@+id/menu_context_resend"
|
|
||||||
android:visible="false"
|
|
||||||
app:showAsAction="never" />
|
|
||||||
|
|
||||||
<item android:title="@string/menu_reply"
|
<item android:title="@string/menu_reply"
|
||||||
android:id="@+id/menu_context_reply"
|
android:id="@+id/menu_context_reply"
|
||||||
android:icon="?menu_reply_icon"
|
android:icon="?menu_reply_icon"
|
||||||
|
@ -38,5 +33,5 @@
|
||||||
|
|
||||||
<item android:title="@string/reply_privately"
|
<item android:title="@string/reply_privately"
|
||||||
android:id="@+id/menu_context_reply_privately"
|
android:id="@+id/menu_context_reply_privately"
|
||||||
app:showAsAction="collapseActionView" />
|
app:showAsAction="never" />
|
||||||
</menu>
|
</menu>
|
||||||
|
|
|
@ -473,9 +473,6 @@ public class ConversationFragment extends Fragment
|
||||||
getActivity().overridePendingTransition(R.anim.slide_from_right, R.anim.fade_scale_out);
|
getActivity().overridePendingTransition(R.anim.slide_from_right, R.anim.fade_scale_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleResendMessage(final DcMsg message) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressLint("RestrictedApi")
|
@SuppressLint("RestrictedApi")
|
||||||
private void handleReplyMessage(final DcMsg message) {
|
private void handleReplyMessage(final DcMsg message) {
|
||||||
if (getActivity() != null) {
|
if (getActivity() != null) {
|
||||||
|
@ -784,6 +781,7 @@ public class ConversationFragment extends Fragment
|
||||||
setCorrectMenuVisibility(menu);
|
setCorrectMenuVisibility(menu);
|
||||||
ConversationAdaptiveActionsToolbar.adjustMenuActions(menu, 10, requireActivity().getWindow().getDecorView().getMeasuredWidth());
|
ConversationAdaptiveActionsToolbar.adjustMenuActions(menu, 10, requireActivity().getWindow().getDecorView().getMeasuredWidth());
|
||||||
actionMode.setTitle(String.valueOf(getListAdapter().getSelectedItems().size()));
|
actionMode.setTitle(String.valueOf(getListAdapter().getSelectedItems().size()));
|
||||||
|
actionMode.setTitleOptionalHint(false); // the title represents important information, also indicating implicitly, more items can be selected
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(messageRecord.isSetupMessage()) {
|
else if(messageRecord.isSetupMessage()) {
|
||||||
|
@ -928,10 +926,6 @@ public class ConversationFragment extends Fragment
|
||||||
handleForwardMessage(getListAdapter().getSelectedItems());
|
handleForwardMessage(getListAdapter().getSelectedItems());
|
||||||
actionMode.finish();
|
actionMode.finish();
|
||||||
return true;
|
return true;
|
||||||
case R.id.menu_context_resend:
|
|
||||||
handleResendMessage(getSelectedMessageRecord());
|
|
||||||
actionMode.finish();
|
|
||||||
return true;
|
|
||||||
case R.id.menu_context_save_attachment:
|
case R.id.menu_context_save_attachment:
|
||||||
handleSaveAttachment(getSelectedMessageRecord());
|
handleSaveAttachment(getSelectedMessageRecord());
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -19,6 +19,7 @@ import org.thoughtcrime.securesms.util.ViewUtil;
|
||||||
public class ConversationAdaptiveActionsToolbar extends Toolbar {
|
public class ConversationAdaptiveActionsToolbar extends Toolbar {
|
||||||
|
|
||||||
private static final int NAVIGATION_DP = 56;
|
private static final int NAVIGATION_DP = 56;
|
||||||
|
private static final int TITLE_DP = 48; // estimated, only a number (if >1 items are selected there is more room anyway as there are fewer options)
|
||||||
private static final int ACTION_VIEW_WIDTH_DP = 48;
|
private static final int ACTION_VIEW_WIDTH_DP = 48;
|
||||||
private static final int OVERFLOW_VIEW_WIDTH_DP = 36;
|
private static final int OVERFLOW_VIEW_WIDTH_DP = 36;
|
||||||
|
|
||||||
|
@ -61,7 +62,7 @@ public class ConversationAdaptiveActionsToolbar extends Toolbar {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int widthAllowed = toolbarWidthPx - ViewUtil.dpToPx(NAVIGATION_DP);
|
int widthAllowed = toolbarWidthPx - ViewUtil.dpToPx(NAVIGATION_DP + TITLE_DP);
|
||||||
int nItemsToShow = Math.min(maxToShow, widthAllowed / ViewUtil.dpToPx(ACTION_VIEW_WIDTH_DP));
|
int nItemsToShow = Math.min(maxToShow, widthAllowed / ViewUtil.dpToPx(ACTION_VIEW_WIDTH_DP));
|
||||||
|
|
||||||
if (nItemsToShow < menuSize) {
|
if (nItemsToShow < menuSize) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue