Added message more menu dividers

pull/204/head
M66B 3 years ago
parent 3704f10f55
commit 4fd89178cd

@ -122,6 +122,7 @@ import androidx.core.content.FileProvider;
import androidx.core.content.pm.ShortcutInfoCompat;
import androidx.core.content.pm.ShortcutManagerCompat;
import androidx.core.graphics.ColorUtils;
import androidx.core.view.MenuCompat;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
@ -4531,18 +4532,14 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
.setEnabled(message.uid == null || !message.folderReadOnly)
.setVisible(message.accountProtocol == EntityAccount.TYPE_IMAP);
popupMenu.getMenu().findItem(R.id.menu_resync)
.setEnabled(message.uid != null)
.setVisible(message.accountProtocol == EntityAccount.TYPE_IMAP);
popupMenu.getMenu().findItem(R.id.menu_search_in_text).setEnabled(message.content && !full);
popupMenu.getMenu().findItem(R.id.menu_create_rule).setVisible(!message.folderReadOnly);
popupMenu.getMenu().findItem(R.id.menu_manage_keywords)
.setEnabled(message.uid != null && !message.folderReadOnly)
.setVisible(message.accountProtocol == EntityAccount.TYPE_IMAP);
popupMenu.getMenu().findItem(R.id.menu_search_in_text).setEnabled(message.content && !full);
popupMenu.getMenu().findItem(R.id.menu_share).setEnabled(message.content);
popupMenu.getMenu().findItem(R.id.menu_pin).setVisible(pin);
popupMenu.getMenu().findItem(R.id.menu_event).setEnabled(message.content);
@ -4562,8 +4559,14 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
popupMenu.getMenu().findItem(R.id.menu_raw_save).setVisible(message.accountProtocol == EntityAccount.TYPE_IMAP);
popupMenu.getMenu().findItem(R.id.menu_raw_send).setVisible(message.accountProtocol == EntityAccount.TYPE_IMAP);
popupMenu.getMenu().findItem(R.id.menu_resync)
.setEnabled(message.uid != null)
.setVisible(message.accountProtocol == EntityAccount.TYPE_IMAP);
popupMenu.insertIcons(context);
MenuCompat.setGroupDividerEnabled(popupMenu.getMenu(), true);
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem target) {
@ -4603,21 +4606,18 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
} else if (itemId == R.id.menu_delete) {
onActionDelete(message);
return true;
} else if (itemId == R.id.menu_resync) {
onMenuResync(message);
return true;
} else if (itemId == R.id.menu_edit_notes) {
onMenuNotes(message);
return true;
} else if (itemId == R.id.menu_search_in_text) {
onSearchText(message);
return true;
} else if (itemId == R.id.menu_create_rule) {
onMenuCreateRule(message);
return true;
} else if (itemId == R.id.menu_manage_keywords) {
onMenuManageKeywords(message);
return true;
} else if (itemId == R.id.menu_search_in_text) {
onSearchText(message);
return true;
} else if (itemId == R.id.menu_event) {
if (ActivityBilling.isPro(context))
onMenuShare(message, true);
@ -4648,6 +4648,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
} else if (itemId == R.id.menu_raw_send_thread) {
onMenuRawSend(message, true);
return true;
} else if (itemId == R.id.menu_resync) {
onMenuResync(message);
return true;
} else if (itemId == R.id.menu_log) {
onMenuLog(message);
return true;
@ -7236,15 +7239,16 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
final View dview = LayoutInflater.from(context).inflate(R.layout.dialog_buttons, null);
final CheckBox cbSeen = dview.findViewById(R.id.cbSeen);
final CheckBox cbHide = dview.findViewById(R.id.cbHide);
final CheckBox cbJunk = dview.findViewById(R.id.cbJunk);
final CheckBox cbTrash = dview.findViewById(R.id.cbTrash);
final CheckBox cbArchive = dview.findViewById(R.id.cbArchive);
final CheckBox cbMove = dview.findViewById(R.id.cbMove);
final CheckBox cbCopy = dview.findViewById(R.id.cbCopy);
final CheckBox cbKeywords = dview.findViewById(R.id.cbKeywords);
final CheckBox cbNotes = dview.findViewById(R.id.cbNotes);
final CheckBox cbSeen = dview.findViewById(R.id.cbSeen);
final CheckBox cbHide = dview.findViewById(R.id.cbHide);
final CheckBox cbRule = dview.findViewById(R.id.cbRule);
final CheckBox cbKeywords = dview.findViewById(R.id.cbKeywords);
final CheckBox cbSearch = dview.findViewById(R.id.cbSearch);
final CheckBox cbSearchText = dview.findViewById(R.id.cbSearchText);
final CheckBox cbTranslate = dview.findViewById(R.id.cbTranslate);
@ -7254,20 +7258,20 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
final CheckBox cbPrint = dview.findViewById(R.id.cbPrint);
final CheckBox cbHeaders = dview.findViewById(R.id.cbHeaders);
final CheckBox cbUnsubscribe = dview.findViewById(R.id.cbUnsubscribe);
final CheckBox cbRule = dview.findViewById(R.id.cbRule);
cbTranslate.setVisibility(DeepL.isAvailable(context) ? View.VISIBLE : View.GONE);
cbPin.setVisibility(Shortcuts.can(context) ? View.VISIBLE : View.GONE);
cbSeen.setChecked(prefs.getBoolean("button_seen", false));
cbHide.setChecked(prefs.getBoolean("button_hide", false));
cbJunk.setChecked(prefs.getBoolean("button_junk", true));
cbTrash.setChecked(prefs.getBoolean("button_trash", true));
cbArchive.setChecked(prefs.getBoolean("button_archive", true));
cbMove.setChecked(prefs.getBoolean("button_move", true));
cbCopy.setChecked(prefs.getBoolean("button_copy", false));
cbKeywords.setChecked(prefs.getBoolean("button_keywords", false));
cbNotes.setChecked(prefs.getBoolean("button_notes", false));
cbSeen.setChecked(prefs.getBoolean("button_seen", false));
cbHide.setChecked(prefs.getBoolean("button_hide", false));
cbRule.setChecked(prefs.getBoolean("button_rule", false));
cbKeywords.setChecked(prefs.getBoolean("button_keywords", false));
cbSearch.setChecked(prefs.getBoolean("button_search", false));
cbSearchText.setChecked(prefs.getBoolean("button_search_text", false));
cbTranslate.setChecked(prefs.getBoolean("button_translate", false));
@ -7277,7 +7281,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
cbPrint.setChecked(prefs.getBoolean("button_print", false));
cbHeaders.setChecked(prefs.getBoolean("button_headers", false));
cbUnsubscribe.setChecked(prefs.getBoolean("button_unsubscribe", true));
cbRule.setChecked(prefs.getBoolean("button_rule", false));
return new AlertDialog.Builder(getContext())
.setView(dview)
@ -7285,15 +7288,16 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
@Override
public void onClick(DialogInterface dialog, int which) {
SharedPreferences.Editor editor = prefs.edit();
editor.putBoolean("button_seen", cbSeen.isChecked());
editor.putBoolean("button_hide", cbHide.isChecked());
editor.putBoolean("button_junk", cbJunk.isChecked());
editor.putBoolean("button_trash", cbTrash.isChecked());
editor.putBoolean("button_archive", cbArchive.isChecked());
editor.putBoolean("button_move", cbMove.isChecked());
editor.putBoolean("button_copy", cbCopy.isChecked());
editor.putBoolean("button_keywords", cbKeywords.isChecked());
editor.putBoolean("button_notes", cbNotes.isChecked());
editor.putBoolean("button_seen", cbSeen.isChecked());
editor.putBoolean("button_hide", cbHide.isChecked());
editor.putBoolean("button_rule", cbRule.isChecked());
editor.putBoolean("button_keywords", cbKeywords.isChecked());
editor.putBoolean("button_search", cbSearch.isChecked());
editor.putBoolean("button_search_text", cbSearchText.isChecked());
editor.putBoolean("button_translate", cbTranslate.isChecked());
@ -7303,7 +7307,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
editor.putBoolean("button_print", cbPrint.isChecked());
editor.putBoolean("button_headers", cbHeaders.isChecked());
editor.putBoolean("button_unsubscribe", cbUnsubscribe.isChecked());
editor.putBoolean("button_rule", cbRule.isChecked());
editor.apply();
sendResult(Activity.RESULT_OK);
}

@ -31,6 +31,32 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvTitle" />
<CheckBox
android:id="@+id/cbSeen"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:drawableEnd="@drawable/twotone_mail_24"
android:drawablePadding="6dp"
android:text="@string/title_toggle_seen"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvHint" />
<CheckBox
android:id="@+id/cbHide"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:drawableEnd="@drawable/twotone_visibility_off_24"
android:drawablePadding="6dp"
android:text="@string/title_toggle_hide"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbSeen" />
<CheckBox
android:id="@+id/cbJunk"
android:layout_width="0dp"
@ -42,7 +68,7 @@
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvHint" />
app:layout_constraintTop_toBottomOf="@id/cbHide" />
<CheckBox
android:id="@+id/cbTrash"
@ -96,19 +122,6 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbMove" />
<CheckBox
android:id="@+id/cbKeywords"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:drawableEnd="@drawable/twotone_label_important_24"
android:drawablePadding="6dp"
android:text="@string/title_keywords_btn"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbCopy" />
<CheckBox
android:id="@+id/cbNotes"
android:layout_width="0dp"
@ -120,33 +133,33 @@
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbKeywords" />
app:layout_constraintTop_toBottomOf="@id/cbCopy" />
<CheckBox
android:id="@+id/cbSeen"
android:id="@+id/cbRule"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:drawableEnd="@drawable/twotone_mail_24"
android:drawableEnd="@drawable/twotone_filter_alt_24"
android:drawablePadding="6dp"
android:text="@string/title_toggle_seen"
android:text="@string/title_message_rule"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbNotes" />
<CheckBox
android:id="@+id/cbHide"
android:id="@+id/cbKeywords"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:drawableEnd="@drawable/twotone_visibility_off_24"
android:drawableEnd="@drawable/twotone_label_important_24"
android:drawablePadding="6dp"
android:text="@string/title_toggle_hide"
android:text="@string/title_keywords_btn"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbSeen" />
app:layout_constraintTop_toBottomOf="@id/cbRule" />
<CheckBox
android:id="@+id/cbSearch"
@ -159,7 +172,7 @@
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbHide" />
app:layout_constraintTop_toBottomOf="@id/cbKeywords" />
<CheckBox
android:id="@+id/cbSearchText"
@ -264,18 +277,5 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbHeaders" />
<CheckBox
android:id="@+id/cbRule"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:drawableEnd="@drawable/twotone_filter_alt_24"
android:drawablePadding="6dp"
android:text="@string/title_message_rule"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbUnsubscribe" />
</androidx.constraintlayout.widget.ConstraintLayout>
</eu.faircode.email.ScrollViewEx>

@ -5,140 +5,148 @@
android:icon="@drawable/twotone_smart_button_24"
android:title="@string/title_configure_buttons" />
<item
android:id="@+id/menu_unseen"
android:title="@string/title_unseen" />
<item
android:id="@+id/menu_snooze"
android:icon="@drawable/twotone_timelapse_24"
android:title="@string/title_snooze" />
<item
android:id="@+id/menu_hide"
android:title="@string/title_hide" />
<item
android:id="@+id/menu_flag_color"
android:icon="@drawable/twotone_auto_awesome_24"
android:title="@string/title_flag_color" />
<item
android:id="@+id/menu_set_importance"
android:icon="@drawable/baseline_arrow_upward_24"
android:title="@string/title_set_importance">
<menu>
<item
android:id="@+id/menu_set_importance_high"
android:icon="@drawable/baseline_arrow_upward_24"
android:title="@string/title_importance_high" />
<item
android:id="@+id/menu_set_importance_normal"
android:icon="@drawable/twotone_horizontal_rule_24"
android:title="@string/title_importance_normal" />
<item
android:id="@+id/menu_set_importance_low"
android:icon="@drawable/baseline_arrow_downward_24"
android:title="@string/title_importance_low" />
</menu>
</item>
<item
android:id="@+id/menu_move_to"
android:icon="@drawable/twotone_drive_file_move_24"
android:title="@string/title_move_to" />
<item
android:id="@+id/menu_copy_to"
android:icon="@drawable/twotone_file_copy_24"
android:title="@string/title_copy_to" />
<item
android:id="@+id/menu_delete"
android:icon="@drawable/twotone_delete_forever_24"
android:title="@string/title_delete_permanently" />
<item
android:id="@+id/menu_resync"
android:icon="@drawable/twotone_sync_24"
android:title="@string/title_resync" />
<item
android:id="@+id/menu_edit_notes"
android:icon="@drawable/twotone_sticky_note_2_24"
android:title="@string/title_edit_notes" />
<item
android:id="@+id/menu_search_in_text"
android:icon="@drawable/twotone_search_24"
android:title="@string/title_search_in_text" />
<item
android:id="@+id/menu_create_rule"
android:icon="@drawable/twotone_filter_alt_24"
android:title="@string/title_create_rule" />
<item
android:id="@+id/menu_manage_keywords"
android:icon="@drawable/twotone_label_important_24"
android:title="@string/title_manage_keywords" />
<item
android:id="@+id/menu_event"
android:icon="@drawable/twotone_event_24"
android:title="@string/title_event" />
<item
android:id="@+id/menu_share"
android:icon="@drawable/twotone_share_24"
android:title="@string/title_share" />
<item
android:id="@+id/menu_pin"
android:icon="@drawable/twotone_push_pin_24"
android:title="@string/title_pin" />
<item
android:id="@+id/menu_print"
android:icon="@drawable/twotone_print_24"
android:title="@string/title_print" />
<item
android:id="@+id/menu_show_headers"
android:checkable="true"
android:icon="@drawable/baseline_code_24"
android:title="@string/title_show_headers" />
<item
android:id="@+id/menu_share_as_html"
android:icon="@drawable/twotone_source_24"
android:title="@string/title_share_as_html" />
<item
android:id="@+id/menu_raw_save"
android:enabled="false"
android:icon="@drawable/twotone_save_24"
android:title="@string/title_raw_save" />
<item
android:id="@+id/menu_raw_send"
android:icon="@drawable/twotone_attachment_24"
android:title="@string/title_raw_send">
<menu>
<item
android:id="@+id/menu_raw_send_message"
android:enabled="false"
android:title="@string/title_raw_send_message" />
<item
android:id="@+id/menu_raw_send_thread"
android:enabled="false"
android:title="@string/title_raw_send_thread" />
</menu>
</item>
<item
android:id="@+id/menu_log"
android:icon="@drawable/twotone_dns_24"
android:title="@string/title_log" />
<group android:id="@+id/group_operations">
<item
android:id="@+id/menu_unseen"
android:title="@string/title_unseen" />
<item
android:id="@+id/menu_snooze"
android:icon="@drawable/twotone_timelapse_24"
android:title="@string/title_snooze" />
<item
android:id="@+id/menu_hide"
android:title="@string/title_hide" />
<item
android:id="@+id/menu_flag_color"
android:icon="@drawable/twotone_auto_awesome_24"
android:title="@string/title_flag_color" />
<item
android:id="@+id/menu_set_importance"
android:icon="@drawable/baseline_arrow_upward_24"
android:title="@string/title_set_importance">
<menu>
<item
android:id="@+id/menu_set_importance_high"
android:icon="@drawable/baseline_arrow_upward_24"
android:title="@string/title_importance_high" />
<item
android:id="@+id/menu_set_importance_normal"
android:icon="@drawable/twotone_horizontal_rule_24"
android:title="@string/title_importance_normal" />
<item
android:id="@+id/menu_set_importance_low"
android:icon="@drawable/baseline_arrow_downward_24"
android:title="@string/title_importance_low" />
</menu>
</item>
<item
android:id="@+id/menu_move_to"
android:icon="@drawable/twotone_drive_file_move_24"
android:title="@string/title_move_to" />
<item
android:id="@+id/menu_copy_to"
android:icon="@drawable/twotone_file_copy_24"
android:title="@string/title_copy_to" />
<item
android:id="@+id/menu_delete"
android:icon="@drawable/twotone_delete_forever_24"
android:title="@string/title_delete_permanently" />
</group>
<group android:id="@+id/group_properties">
<item
android:id="@+id/menu_edit_notes"
android:icon="@drawable/twotone_sticky_note_2_24"
android:title="@string/title_edit_notes" />
<item
android:id="@+id/menu_create_rule"
android:icon="@drawable/twotone_filter_alt_24"
android:title="@string/title_create_rule" />
<item
android:id="@+id/menu_manage_keywords"
android:icon="@drawable/twotone_label_important_24"
android:title="@string/title_manage_keywords" />
<item
android:id="@+id/menu_search_in_text"
android:icon="@drawable/twotone_search_24"
android:title="@string/title_search_in_text" />
</group>
<group android:id="@+id/group_sharing">
<item
android:id="@+id/menu_event"
android:icon="@drawable/twotone_event_24"
android:title="@string/title_event" />
<item
android:id="@+id/menu_share"
android:icon="@drawable/twotone_share_24"
android:title="@string/title_share" />
<item
android:id="@+id/menu_pin"
android:icon="@drawable/twotone_push_pin_24"
android:title="@string/title_pin" />
<item
android:id="@+id/menu_print"
android:icon="@drawable/twotone_print_24"
android:title="@string/title_print" />
</group>
<group android:id="@+id/group_advanced">
<item
android:id="@+id/menu_show_headers"
android:checkable="true"
android:icon="@drawable/baseline_code_24"
android:title="@string/title_show_headers" />
<item
android:id="@+id/menu_share_as_html"
android:icon="@drawable/twotone_source_24"
android:title="@string/title_share_as_html" />
<item
android:id="@+id/menu_raw_save"
android:enabled="false"
android:icon="@drawable/twotone_save_24"
android:title="@string/title_raw_save" />
<item
android:id="@+id/menu_raw_send"
android:icon="@drawable/twotone_attachment_24"
android:title="@string/title_raw_send">
<menu>
<item
android:id="@+id/menu_raw_send_message"
android:enabled="false"
android:title="@string/title_raw_send_message" />
<item
android:id="@+id/menu_raw_send_thread"
android:enabled="false"
android:title="@string/title_raw_send_thread" />
</menu>
</item>
<item
android:id="@+id/menu_resync"
android:icon="@drawable/twotone_sync_24"
android:title="@string/title_resync" />
<item
android:id="@+id/menu_log"
android:icon="@drawable/twotone_dns_24"
android:title="@string/title_log" />
</group>
</menu>

Loading…
Cancel
Save