Added setting to disable send pending icon/button

pull/197/head
M66B 4 years ago
parent eb56f52803
commit 3fee21e446

@ -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();

@ -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",

@ -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);

@ -207,6 +207,18 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSendDelayed" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swSendPending"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_send_pending"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/spSendDelayed"
app:switchPadding="12dp" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvCaptionMessage"
android:layout_width="0dp"
@ -217,7 +229,7 @@
android:textAppearance="@style/TextAppearance.AppCompat.Large"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/spSendDelayed" />
app:layout_constraintTop_toBottomOf="@+id/swSendPending" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvComposeFont"

@ -334,6 +334,7 @@
<string name="title_advanced_send_reminders">Show reminders</string>
<string name="title_advanced_lookup_mx">Check recipient email addresses before sending</string>
<string name="title_advanced_send_delayed">Delay sending messages</string>
<string name="title_advanced_send_pending">Show non-obtrusive send delayed icon</string>
<string name="title_advanced_metered">Use metered connections</string>
<string name="title_advanced_download">Automatically download messages and attachments on a metered connection up to</string>

Loading…
Cancel
Save