Added setting to disable send pending icon/button

This commit is contained in:
M66B
2021-03-31 21:10:57 +02:00
parent eb56f52803
commit 3fee21e446
5 changed files with 42 additions and 23 deletions

View File

@@ -3692,6 +3692,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
boolean hints = (viewType == AdapterMessage.ViewType.UNIFIED || viewType == AdapterMessage.ViewType.FOLDER);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
boolean send_pending = prefs.getBoolean("send_pending", true);
grpHintSupport.setVisibility(prefs.getBoolean("app_support", false) || !hints ? View.GONE : View.VISIBLE);
grpHintSwipe.setVisibility(prefs.getBoolean("message_swipe", false) || !hints ? View.GONE : View.VISIBLE);
grpHintSelect.setVisibility(prefs.getBoolean("message_select", false) || !hints ? View.GONE : View.VISIBLE);
@@ -3743,16 +3744,6 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
updateState(folders);
}
});
db.message().liveOutboxPending().observe(getViewLifecycleOwner(), new Observer<Integer>() {
@Override
public void onChanged(Integer pending) {
if (pending != null && pending > 10)
tvOutboxCount.setText("+");
else
tvOutboxCount.setText(pending == null || pending == 0 ? null : NF.format(pending));
grpOutbox.setVisibility(pending == null || pending == 0 ? View.GONE : View.VISIBLE);
}
});
break;
case FOLDER:
@@ -3766,16 +3757,6 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
updateState(folders);
}
});
db.message().liveOutboxPending().observe(getViewLifecycleOwner(), new Observer<Integer>() {
@Override
public void onChanged(Integer pending) {
if (pending != null && pending > 10)
tvOutboxCount.setText("+");
else
tvOutboxCount.setText(pending == null || pending == 0 ? null : NF.format(pending));
grpOutbox.setVisibility(pending == null || pending == 0 ? View.GONE : View.VISIBLE);
}
});
break;
case THREAD:
@@ -3816,6 +3797,19 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
break;
}
if (send_pending &&
(viewType == AdapterMessage.ViewType.UNIFIED || viewType == AdapterMessage.ViewType.FOLDER))
db.message().liveOutboxPending().observe(getViewLifecycleOwner(), new Observer<Integer>() {
@Override
public void onChanged(Integer pending) {
if (pending != null && pending > 10)
tvOutboxCount.setText("+");
else
tvOutboxCount.setText(pending == null || pending == 0 ? null : NF.format(pending));
grpOutbox.setVisibility(pending == null || pending == 0 ? View.GONE : View.VISIBLE);
}
});
if (!checkReporting())
if (!checkReview())
checkFingerprint();

View File

@@ -84,6 +84,7 @@ public class FragmentOptions extends FragmentBase {
static String[] OPTIONS_RESTART = new String[]{
"first", "app_support", "notify_archive", "message_swipe", "message_select", "folder_actions", "folder_sync",
"subscriptions",
"send_pending",
"portrait2", "landscape", "landscape3", "startup", "cards", "beige", "shadow_unread",
"indentation", "date", "threading", "threading_unread",
"highlight_unread", "highlight_color", "color_stripe",

View File

@@ -50,6 +50,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
private Button btnLocalContacts;
private SwitchCompat swSendReminders;
private Spinner spSendDelayed;
private SwitchCompat swSendPending;
private Spinner spComposeFont;
private SwitchCompat swPrefixOnce;
@@ -77,7 +78,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
private final static String[] RESET_OPTIONS = new String[]{
"keyboard", "keyboard_no_fullscreen",
"suggest_names", "suggest_sent", "suggested_received", "suggest_frequently",
"send_reminders", "send_delayed",
"send_reminders", "send_delayed", "send_pending",
"compose_font", "prefix_once", "separate_reply", "extended_reply", "write_below", "quote_reply", "quote_limit", "resize_reply",
"signature_location", "signature_reply", "signature_forward",
"discard_delete",
@@ -104,8 +105,9 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
btnLocalContacts = view.findViewById(R.id.btnLocalContacts);
swSendReminders = view.findViewById(R.id.swSendReminders);
spSendDelayed = view.findViewById(R.id.spSendDelayed);
spComposeFont = view.findViewById(R.id.spComposeFont);
swSendPending = view.findViewById(R.id.swSendPending);
spComposeFont = view.findViewById(R.id.spComposeFont);
swPrefixOnce = view.findViewById(R.id.swPrefixOnce);
swSeparateReply = view.findViewById(R.id.swSeparateReply);
swExtendedReply = view.findViewById(R.id.swExtendedReply);
@@ -206,6 +208,13 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
}
});
swSendPending.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("send_pending", checked).apply();
}
});
spComposeFont.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) {
@@ -434,6 +443,8 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
break;
}
swSendPending.setChecked(prefs.getBoolean("send_pending", true));
boolean monospaced = prefs.getBoolean("monospaced", false);
String compose_font = prefs.getString("compose_font", monospaced ? "monospace" : "sans-serif");
String[] fontNameValues = getResources().getStringArray(R.array.fontNameValues);