Added option to disable quick actions

pull/211/head
M66B 2 years ago
parent aa519d0b6c
commit bfed7f9a53

@ -360,6 +360,7 @@ public class FragmentMessages extends FragmentBase
private boolean quick_scroll;
private boolean addresses;
private boolean swipe_reply;
private boolean quick_actions;
private int colorPrimary;
private int colorAccent;
@ -503,6 +504,7 @@ public class FragmentMessages extends FragmentBase
quick_scroll = prefs.getBoolean("quick_scroll", true);
addresses = prefs.getBoolean("addresses", false);
swipe_reply = prefs.getBoolean("swipe_reply", false);
quick_actions = prefs.getBoolean("quick_actions", true);
colorPrimary = Helper.resolveColor(getContext(), R.attr.colorPrimary);
colorAccent = Helper.resolveColor(getContext(), R.attr.colorAccent);
@ -6275,137 +6277,139 @@ public class FragmentMessages extends FragmentBase
tvSelectedCount.setCompoundDrawablesRelative(null, null, null, null);
tvSelectedCount.setVisibility(View.VISIBLE);
Bundle args = new Bundle();
args.putLongArray("ids", selection);
args.putBoolean("threading", threading);
if (quick_actions) {
Bundle args = new Bundle();
args.putLongArray("ids", selection);
args.putBoolean("threading", threading);
new SimpleTask<MoreResult>() {
@Override
protected MoreResult onExecute(Context context, Bundle args) {
long[] ids = args.getLongArray("ids");
boolean threading = args.getBoolean("threading");
return MoreResult.get(context, ids, threading, true);
}
new SimpleTask<MoreResult>() {
@Override
protected MoreResult onExecute(Context context, Bundle args) {
long[] ids = args.getLongArray("ids");
boolean threading = args.getBoolean("threading");
return MoreResult.get(context, ids, threading, true);
}
@Override
protected void onExecuted(Bundle args, MoreResult result) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean more_seen = prefs.getBoolean("more_seen", true);
boolean more_unseen = prefs.getBoolean("more_unseen", false);
boolean more_snooze = prefs.getBoolean("more_snooze", false);
boolean more_hide = prefs.getBoolean("more_hide", false);
boolean more_flag = prefs.getBoolean("more_flag", false);
boolean more_flag_color = prefs.getBoolean("more_flag_color", false);
boolean more_importance_high = prefs.getBoolean("more_importance_high", false);
boolean more_importance_normal = prefs.getBoolean("more_importance_normal", false);
boolean more_importance_low = prefs.getBoolean("more_importance_low", false);
boolean more_inbox = prefs.getBoolean("more_inbox", true);
boolean more_archive = prefs.getBoolean("more_archive", true);
boolean more_junk = prefs.getBoolean("more_junk", true);
boolean more_trash = prefs.getBoolean("more_trash", true);
boolean more_delete = prefs.getBoolean("more_delete", false);
boolean more_move = prefs.getBoolean("more_move", true);
boolean inTrash = EntityFolder.TRASH.equals(type);
boolean inJunk = EntityFolder.JUNK.equals(type);
int count = 0;
boolean move = (more_move && count < MAX_QUICK_ACTIONS && result.canMove());
if (move)
count++;
@Override
protected void onExecuted(Bundle args, MoreResult result) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean more_seen = prefs.getBoolean("more_seen", true);
boolean more_unseen = prefs.getBoolean("more_unseen", false);
boolean more_snooze = prefs.getBoolean("more_snooze", false);
boolean more_hide = prefs.getBoolean("more_hide", false);
boolean more_flag = prefs.getBoolean("more_flag", false);
boolean more_flag_color = prefs.getBoolean("more_flag_color", false);
boolean more_importance_high = prefs.getBoolean("more_importance_high", false);
boolean more_importance_normal = prefs.getBoolean("more_importance_normal", false);
boolean more_importance_low = prefs.getBoolean("more_importance_low", false);
boolean more_inbox = prefs.getBoolean("more_inbox", true);
boolean more_archive = prefs.getBoolean("more_archive", true);
boolean more_junk = prefs.getBoolean("more_junk", true);
boolean more_trash = prefs.getBoolean("more_trash", true);
boolean more_delete = prefs.getBoolean("more_delete", false);
boolean more_move = prefs.getBoolean("more_move", true);
boolean inTrash = EntityFolder.TRASH.equals(type);
boolean inJunk = EntityFolder.JUNK.equals(type);
int count = 0;
boolean move = (more_move && count < MAX_QUICK_ACTIONS && result.canMove());
if (move)
count++;
boolean delete = (more_delete && count < MAX_QUICK_ACTIONS && result.canDelete());
if (delete)
count++;
boolean delete = (more_delete && count < MAX_QUICK_ACTIONS && result.canDelete());
if (delete)
count++;
boolean trash = (more_trash && count < MAX_QUICK_ACTIONS && result.canTrash());
if (trash)
count++;
boolean trash = (more_trash && count < MAX_QUICK_ACTIONS && result.canTrash());
if (trash)
count++;
if (!delete && !trash && (inTrash || inJunk) &&
more_trash && count < MAX_QUICK_ACTIONS && result.canDelete()) {
delete = true;
count++;
}
if (!delete && !trash && (inTrash || inJunk) &&
more_trash && count < MAX_QUICK_ACTIONS && result.canDelete()) {
delete = true;
count++;
}
boolean junk = (more_junk && count < MAX_QUICK_ACTIONS && result.canJunk());
if (junk)
count++;
boolean junk = (more_junk && count < MAX_QUICK_ACTIONS && result.canJunk());
if (junk)
count++;
boolean archive = (more_archive && count < MAX_QUICK_ACTIONS && result.canArchive());
if (archive)
count++;
boolean archive = (more_archive && count < MAX_QUICK_ACTIONS && result.canArchive());
if (archive)
count++;
boolean inbox = ((more_inbox || (more_junk && inJunk)) && count < MAX_QUICK_ACTIONS && result.canInbox());
if (inbox)
count++;
boolean inbox = ((more_inbox || (more_junk && inJunk)) && count < MAX_QUICK_ACTIONS && result.canInbox());
if (inbox)
count++;
boolean importance_high = (more_importance_high && count < MAX_QUICK_ACTIONS &&
!EntityMessage.PRIORITIY_HIGH.equals(result.importance));
if (importance_high)
count++;
boolean importance_high = (more_importance_high && count < MAX_QUICK_ACTIONS &&
!EntityMessage.PRIORITIY_HIGH.equals(result.importance));
if (importance_high)
count++;
boolean importance_normal = (more_importance_normal && count < MAX_QUICK_ACTIONS &&
!EntityMessage.PRIORITIY_NORMAL.equals(result.importance));
if (importance_normal)
count++;
boolean importance_normal = (more_importance_normal && count < MAX_QUICK_ACTIONS &&
!EntityMessage.PRIORITIY_NORMAL.equals(result.importance));
if (importance_normal)
count++;
boolean importance_low = (more_importance_low && count < MAX_QUICK_ACTIONS &&
!EntityMessage.PRIORITIY_LOW.equals(result.importance));
if (importance_low)
count++;
boolean importance_low = (more_importance_low && count < MAX_QUICK_ACTIONS &&
!EntityMessage.PRIORITIY_LOW.equals(result.importance));
if (importance_low)
count++;
boolean flag = (more_flag && count < MAX_QUICK_ACTIONS && result.unflagged);
if (flag)
count++;
boolean flag = (more_flag && count < MAX_QUICK_ACTIONS && result.unflagged);
if (flag)
count++;
boolean flag_color = (more_flag_color && count < MAX_QUICK_ACTIONS && (result.unflagged || result.flagged));
if (flag_color)
count++;
boolean flag_color = (more_flag_color && count < MAX_QUICK_ACTIONS && (result.unflagged || result.flagged));
if (flag_color)
count++;
boolean hide = (more_hide && count < MAX_QUICK_ACTIONS && result.visible);
if (hide)
count++;
boolean hide = (more_hide && count < MAX_QUICK_ACTIONS && result.visible);
if (hide)
count++;
boolean snooze = (more_snooze && count < MAX_QUICK_ACTIONS);
if (snooze)
count++;
boolean snooze = (more_snooze && count < MAX_QUICK_ACTIONS);
if (snooze)
count++;
boolean unseen = (more_unseen && count < MAX_QUICK_ACTIONS && result.seen);
if (unseen)
count++;
boolean unseen = (more_unseen && count < MAX_QUICK_ACTIONS && result.seen);
if (unseen)
count++;
boolean seen = (more_seen && count < MAX_QUICK_ACTIONS && result.unseen);
if (seen)
count++;
boolean seen = (more_seen && count < MAX_QUICK_ACTIONS && result.unseen);
if (seen)
count++;
ibInbox.setImageResource(inJunk ? R.drawable.twotone_report_off_24 : R.drawable.twotone_inbox_24);
ibBatchSeen.setVisibility(seen ? View.VISIBLE : View.GONE);
ibBatchUnseen.setVisibility(unseen ? View.VISIBLE : View.GONE);
ibBatchSnooze.setVisibility(snooze ? View.VISIBLE : View.GONE);
ibBatchHide.setVisibility(hide ? View.VISIBLE : View.GONE);
ibBatchFlag.setVisibility(flag ? View.VISIBLE : View.GONE);
ibBatchFlagColor.setVisibility(flag_color ? View.VISIBLE : View.GONE);
ibLowImportance.setVisibility(importance_low ? View.VISIBLE : View.GONE);
ibNormalImportance.setVisibility(importance_normal ? View.VISIBLE : View.GONE);
ibHighImportance.setVisibility(importance_high ? View.VISIBLE : View.GONE);
ibInbox.setVisibility(inbox ? View.VISIBLE : View.GONE);
ibArchive.setVisibility(archive ? View.VISIBLE : View.GONE);
ibJunk.setVisibility(junk ? View.VISIBLE : View.GONE);
ibTrash.setVisibility(trash ? View.VISIBLE : View.GONE);
ibDelete.setVisibility(delete ? View.VISIBLE : View.GONE);
ibMove.setVisibility(move ? View.VISIBLE : View.GONE);
cardMore.setTag(fabMore.isOrWillBeShown() ? result : null);
cardMore.setVisibility(fabMore.isOrWillBeShown() ? View.VISIBLE : View.GONE);
}
ibInbox.setImageResource(inJunk ? R.drawable.twotone_report_off_24 : R.drawable.twotone_inbox_24);
ibBatchSeen.setVisibility(seen ? View.VISIBLE : View.GONE);
ibBatchUnseen.setVisibility(unseen ? View.VISIBLE : View.GONE);
ibBatchSnooze.setVisibility(snooze ? View.VISIBLE : View.GONE);
ibBatchHide.setVisibility(hide ? View.VISIBLE : View.GONE);
ibBatchFlag.setVisibility(flag ? View.VISIBLE : View.GONE);
ibBatchFlagColor.setVisibility(flag_color ? View.VISIBLE : View.GONE);
ibLowImportance.setVisibility(importance_low ? View.VISIBLE : View.GONE);
ibNormalImportance.setVisibility(importance_normal ? View.VISIBLE : View.GONE);
ibHighImportance.setVisibility(importance_high ? View.VISIBLE : View.GONE);
ibInbox.setVisibility(inbox ? View.VISIBLE : View.GONE);
ibArchive.setVisibility(archive ? View.VISIBLE : View.GONE);
ibJunk.setVisibility(junk ? View.VISIBLE : View.GONE);
ibTrash.setVisibility(trash ? View.VISIBLE : View.GONE);
ibDelete.setVisibility(delete ? View.VISIBLE : View.GONE);
ibMove.setVisibility(move ? View.VISIBLE : View.GONE);
cardMore.setTag(fabMore.isOrWillBeShown() ? result : null);
cardMore.setVisibility(fabMore.isOrWillBeShown() ? View.VISIBLE : View.GONE);
}
@Override
protected void onException(Bundle args, Throwable ex) {
Log.unexpectedError(getParentFragmentManager(), ex);
}
}.serial().setId("messages:" + FragmentMessages.this.hashCode()).execute(this, args, "quickactions");
@Override
protected void onException(Bundle args, Throwable ex) {
Log.unexpectedError(getParentFragmentManager(), ex);
}
}.serial().setId("messages:" + FragmentMessages.this.hashCode()).execute(this, args, "quickactions");
}
} else {
fabMore.hide();
tvSelectedCount.setVisibility(View.GONE);

@ -149,7 +149,7 @@ public class FragmentOptions extends FragmentBase {
"autoscroll", "swipenav", "reversed", "swipe_close", "swipe_move", "autoexpand", "autoclose", "onclose",
"swipe_reply",
"language_detection",
"quick_filter", "quick_scroll",
"quick_filter", "quick_scroll", "quick_actions",
"experiments", "debug", "log_level", "test1", "test2", "test3", "test4", "test5",
"webview_legacy", "browser_zoom", "fake_dark",
"show_recent",

@ -72,6 +72,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
private SwitchCompat swAutoScroll;
private SwitchCompat swQuickFilter;
private SwitchCompat swQuickScroll;
private SwitchCompat swQuickActions;
private Button btnSwipes;
private SeekBar sbSwipeSensitivity;
private SwitchCompat swFolderNav;
@ -107,7 +108,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
private final static String[] RESET_OPTIONS = new String[]{
"restore_on_launch", "sync_on_launch", "double_back", "conversation_actions", "conversation_actions_replies", "language_detection",
"photo_picker", "default_snooze",
"pull", "autoscroll", "quick_filter", "quick_scroll", "swipe_sensitivity", "foldernav",
"pull", "autoscroll", "quick_filter", "quick_scroll", "quick_actions", "swipe_sensitivity", "foldernav",
"doubletap", "swipenav", "volumenav", "reversed", "swipe_close", "swipe_move",
"autoexpand", "expand_first", "expand_all", "expand_one", "collapse_multiple",
"autoclose", "onclose", "autoclose_unseen", "collapse_marked",
@ -140,6 +141,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
swAutoScroll = view.findViewById(R.id.swAutoScroll);
swQuickFilter = view.findViewById(R.id.swQuickFilter);
swQuickScroll = view.findViewById(R.id.swQuickScroll);
swQuickActions = view.findViewById(R.id.swQuickActions);
btnSwipes = view.findViewById(R.id.btnSwipes);
sbSwipeSensitivity = view.findViewById(R.id.sbSwipeSensitivity);
swFolderNav = view.findViewById(R.id.swFolderNav);
@ -289,6 +291,13 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
}
});
swQuickActions.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("quick_actions", checked).apply();
}
});
btnSwipes.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@ -574,6 +583,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
swAutoScroll.setChecked(prefs.getBoolean("autoscroll", false));
swQuickFilter.setChecked(prefs.getBoolean("quick_filter", false));
swQuickScroll.setChecked(prefs.getBoolean("quick_scroll", true));
swQuickActions.setChecked(prefs.getBoolean("quick_actions", true));
int swipe_sensitivity = prefs.getInt("swipe_sensitivity", DEFAULT_SWIPE_SENSITIVITY);
sbSwipeSensitivity.setProgress(swipe_sensitivity);

@ -296,6 +296,18 @@
app:layout_constraintTop_toBottomOf="@id/swQuickFilter"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swQuickActions"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:enabled="true"
android:text="@string/title_advanced_quick_actions"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swQuickScroll"
app:switchPadding="12dp" />
<Button
android:id="@+id/btnSwipes"
style="?android:attr/buttonStyleSmall"
@ -307,7 +319,7 @@
android:tag="disable"
android:text="@string/title_advanced_swipe_actions"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swQuickScroll" />
app:layout_constraintTop_toBottomOf="@id/swQuickActions" />
<TextView
android:id="@+id/tvSwipeSensitivity"

@ -639,6 +639,7 @@
<string name="title_advanced_undo">Undo timeout</string>
<string name="title_advanced_quick_filter">Show non-obtrusive quick filter icons</string>
<string name="title_advanced_quick_scroll">Show non-obtrusive quick scroll up/down icons</string>
<string name="title_advanced_quick_actions">Show quick actions when messages are selected</string>
<string name="title_advanced_folder_nav">Always go back to the folder list from a message list</string>
<string name="title_advanced_autoread">Automatically mark messages read on moving messages</string>
<string name="title_advanced_star_snoozed">Automatically add star on snoozing messages</string>

Loading…
Cancel
Save