1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2025-03-13 07:33:33 +00:00

Added options to disable unsubscribe/rule buttons

This commit is contained in:
M66B 2020-06-26 17:53:42 +02:00
parent d1a1ba8279
commit 090e9a60cc
4 changed files with 26 additions and 5 deletions

2
FAQ.md
View file

@ -2624,7 +2624,7 @@ Reformatting and displaying such messages will take too long. You can try to use
<a name="faq125"></a>
**(125) What are the current experimental features?**
* Showing an icon button to create a rule for a message
* ...
<br />

View file

@ -1555,7 +1555,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
message.uid == null || message.accountProtocol == EntityAccount.TYPE_POP);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean experiments = prefs.getBoolean("experiments", false);
boolean expand_all = prefs.getBoolean("expand_all", false);
boolean expand_one = prefs.getBoolean("expand_one", true);
boolean tools = prefs.getBoolean("message_tools", true);
@ -1563,13 +1562,15 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
boolean button_trash = prefs.getBoolean("button_trash", true);
boolean button_archive = prefs.getBoolean("button_archive", true);
boolean button_move = prefs.getBoolean("button_move", true);
boolean button_unsubscribe = prefs.getBoolean("button_unsubscribe", true);
boolean button_rule = prefs.getBoolean("button_rule", false);
ibTrash.setTag(delete);
ibUndo.setVisibility(outbox ? View.VISIBLE : View.GONE);
ibRule.setVisibility(tools && experiments && !outbox &&
ibRule.setVisibility(tools && button_rule && !outbox &&
message.accountProtocol == EntityAccount.TYPE_IMAP ? View.VISIBLE : View.GONE);
ibUnsubscribe.setVisibility(!tools || message.unsubscribe == null ? View.GONE : View.VISIBLE);
ibUnsubscribe.setVisibility(tools && button_unsubscribe && message.unsubscribe != null ? View.VISIBLE : View.GONE);
ibAnswer.setVisibility(!tools || outbox || (!expand_all && expand_one) ? View.GONE : View.VISIBLE);
ibLabels.setVisibility(tools && labels_header && labels && !outbox ? View.VISIBLE : View.GONE);
ibMove.setVisibility(tools && button_move && move ? View.VISIBLE : View.GONE);
@ -1577,7 +1578,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibTrash.setVisibility(outbox || (tools && button_trash && trash) ? View.VISIBLE : View.GONE);
ibJunk.setVisibility(tools && button_junk && junk ? View.VISIBLE : View.GONE);
ibInbox.setVisibility(tools && inbox ? View.VISIBLE : View.GONE);
ibMore.setVisibility(!tools || outbox ? View.GONE : View.VISIBLE);
ibMore.setVisibility(tools && !outbox ? View.VISIBLE : View.GONE);
ibTools.setImageLevel(tools ? 0 : 1);
ibTools.setVisibility(outbox ? View.GONE : View.VISIBLE);
@ -3765,6 +3766,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
boolean button_trash = prefs.getBoolean("button_trash", true);
boolean button_archive = prefs.getBoolean("button_archive", true);
boolean button_move = prefs.getBoolean("button_move", true);
boolean button_unsubscribe = prefs.getBoolean("button_unsubscribe", true);
boolean button_rule = prefs.getBoolean("button_rule", false);
PopupMenuLifecycle popupMenu = new PopupMenuLifecycle(context, powner, ibMore);
popupMenu.inflate(R.menu.popup_message_more);
@ -3773,6 +3776,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
popupMenu.getMenu().findItem(R.id.menu_button_trash).setChecked(button_trash);
popupMenu.getMenu().findItem(R.id.menu_button_archive).setChecked(button_archive);
popupMenu.getMenu().findItem(R.id.menu_button_move).setChecked(button_move);
popupMenu.getMenu().findItem(R.id.menu_button_unsubscribe).setChecked(button_unsubscribe);
popupMenu.getMenu().findItem(R.id.menu_button_rule).setChecked(button_rule);
popupMenu.getMenu().findItem(R.id.menu_unseen).setTitle(message.ui_seen ? R.string.title_unseen : R.string.title_seen);
popupMenu.getMenu().findItem(R.id.menu_unseen).setEnabled(
@ -3838,6 +3843,12 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
case R.id.menu_button_move:
onMenuButton(message, "move", target.isChecked());
return true;
case R.id.menu_button_unsubscribe:
onMenuButton(message, "unsubscribe", target.isChecked());
return true;
case R.id.menu_button_rule:
onMenuButton(message, "rule", target.isChecked());
return true;
case R.id.menu_unseen:
onMenuUnseen(message);
return true;

View file

@ -20,6 +20,14 @@
android:id="@+id/menu_button_move"
android:checkable="true"
android:title="@string/title_move" />
<item
android:id="@+id/menu_button_unsubscribe"
android:checkable="true"
android:title="@string/title_unsubscribe" />
<item
android:id="@+id/menu_button_rule"
android:checkable="true"
android:title="@string/title_message_rule" />
</menu>
</item>

View file

@ -761,6 +761,8 @@
<string name="title_more">More</string>
<string name="title_spam">Spam</string>
<string name="title_move">Move</string>
<string name="title_unsubscribe">Unsubscribe</string>
<string name="title_message_rule">Create rule</string>
<string name="title_no_junk">Not spam</string>
<string name="title_move_to">Move to &#8230;</string>
<string name="title_move_to_folder">Move to &#8230;</string>