Added auto seen option for POP3 accounts

This commit is contained in:
M66B 2020-08-14 18:36:09 +02:00
parent e0da326bcb
commit 765a17b5f5
4 changed files with 29 additions and 13 deletions

View File

@ -3430,9 +3430,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
boolean expanded = !properties.getValue("expanded", message.id);
// Prevent flicker
if (expanded &&
(message.accountProtocol != EntityAccount.TYPE_IMAP ||
(message.accountAutoSeen && !message.folderReadOnly))) {
if (expanded && message.accountAutoSeen && !message.folderReadOnly) {
message.unseen = 0;
message.ui_seen = true;
message.visible_unseen = 0;

View File

@ -1602,9 +1602,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
@Override
public void setExpanded(TupleMessageEx message, boolean value) {
// Prevent flicker
if (value &&
(message.accountProtocol != EntityAccount.TYPE_IMAP ||
(message.accountAutoSeen && !message.ui_seen && !message.folderReadOnly))) {
if (value && message.accountAutoSeen && !message.folderReadOnly) {
message.unseen = 0;
message.ui_seen = true;
message.visible_unseen = 0;
@ -4742,7 +4740,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
db.message().setMessageUnsnoozed(message.id, false);
if (account.protocol != EntityAccount.TYPE_IMAP) {
if (!message.ui_seen)
if (!message.ui_seen && account.auto_seen)
EntityOperation.queue(context, message, EntityOperation.SEEN, true);
} else {
if (!message.content)

View File

@ -80,10 +80,11 @@ public class FragmentPop extends FragmentBase {
private TextView tvColorPro;
private CheckBox cbSynchronize;
private CheckBox cbNotify;
private TextView tvNotifyPro;
private CheckBox cbOnDemand;
private CheckBox cbPrimary;
private CheckBox cbNotify;
private TextView tvNotifyPro;
private CheckBox cbAutoSeen;
private CheckBox cbLeaveServer;
private CheckBox cbLeaveDeleted;
private CheckBox cbLeaveDevice;
@ -143,6 +144,7 @@ public class FragmentPop extends FragmentBase {
cbPrimary = view.findViewById(R.id.cbPrimary);
cbNotify = view.findViewById(R.id.cbNotify);
tvNotifyPro = view.findViewById(R.id.tvNotifyPro);
cbAutoSeen = view.findViewById(R.id.cbAutoSeen);
cbLeaveServer = view.findViewById(R.id.cbLeaveServer);
cbLeaveDeleted = view.findViewById(R.id.cbLeaveDeleted);
cbLeaveDevice = view.findViewById(R.id.cbLeaveDevice);
@ -259,6 +261,8 @@ public class FragmentPop extends FragmentBase {
args.putBoolean("ondemand", cbOnDemand.isChecked());
args.putBoolean("primary", cbPrimary.isChecked());
args.putBoolean("notify", cbNotify.isChecked());
args.putBoolean("auto_seen", cbAutoSeen.isChecked());
args.putBoolean("leave_server", cbLeaveServer.isChecked());
args.putBoolean("leave_deleted", cbLeaveDeleted.isChecked());
args.putBoolean("leave_device", cbLeaveDevice.isChecked());
@ -303,6 +307,7 @@ public class FragmentPop extends FragmentBase {
boolean ondemand = args.getBoolean("ondemand");
boolean primary = args.getBoolean("primary");
boolean notify = args.getBoolean("notify");
boolean auto_seen = args.getBoolean("auto_seen");
boolean leave_server = args.getBoolean("leave_server");
boolean leave_deleted = args.getBoolean("leave_deleted");
boolean leave_device = args.getBoolean("leave_device");
@ -398,6 +403,7 @@ public class FragmentPop extends FragmentBase {
account.ondemand = ondemand;
account.primary = (account.synchronize && primary);
account.notify = notify;
account.auto_seen = auto_seen;
account.leave_on_server = leave_server;
account.leave_deleted = leave_deleted;
account.leave_on_device = leave_device;
@ -574,21 +580,26 @@ public class FragmentPop extends FragmentBase {
etName.setText(account == null ? null : account.name);
btnColor.setColor(account == null ? null : account.color);
cbSynchronize.setChecked(account == null ? true : account.synchronize);
cbOnDemand.setChecked(account == null ? false : account.ondemand);
cbPrimary.setChecked(account == null ? false : account.primary);
boolean pro = ActivityBilling.isPro(getContext());
cbNotify.setChecked(account != null && account.notify && pro);
cbNotify.setEnabled(pro);
cbSynchronize.setChecked(account == null ? true : account.synchronize);
cbOnDemand.setChecked(account == null ? false : account.ondemand);
cbPrimary.setChecked(account == null ? false : account.primary);
cbAutoSeen.setChecked(account == null ? true : account.auto_seen);
cbLeaveServer.setChecked(account == null ? true : account.leave_on_server);
cbLeaveDeleted.setChecked(account == null ? true : account.leave_deleted);
cbLeaveDevice.setChecked(account == null ? false : account.leave_on_device);
if (account != null && account.max_messages == null)
etMax.setText(null);
else
etMax.setText(Integer.toString(account == null
? EntityAccount.DEFAULT_MAX_MESSAGES : account.max_messages));
etInterval.setText(account == null ? "" : Long.toString(account.poll_interval));
List<EntityFolder> folders = getSwipeActions();

View File

@ -299,6 +299,15 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbNotify" />
<CheckBox
android:id="@+id/cbAutoSeen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_expand_read"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvNotifyPro" />
<CheckBox
android:id="@+id/cbLeaveServer"
android:layout_width="wrap_content"
@ -306,7 +315,7 @@
android:layout_marginTop="12dp"
android:text="@string/title_leave_on_server"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvNotifyPro" />
app:layout_constraintTop_toBottomOf="@id/cbAutoSeen" />
<CheckBox
android:id="@+id/cbLeaveDeleted"