Added batch set to poll

pull/187/head
M66B 5 years ago
parent 1459e89ea5
commit e4adc92ddc

@ -797,6 +797,8 @@ public class FragmentFolders extends FragmentBase {
final EditText etSyncDays = view.findViewById(R.id.etSyncDays);
final EditText etKeepDays = view.findViewById(R.id.etKeepDays);
final CheckBox cbKeepAll = view.findViewById(R.id.cbKeepAll);
final CheckBox cbPollSystem = view.findViewById(R.id.cbPollSystem);
final CheckBox cbPollUser = view.findViewById(R.id.cbPollUser);
cbKeepAll.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
@ -815,6 +817,8 @@ public class FragmentFolders extends FragmentBase {
args.putString("keep", cbKeepAll.isChecked()
? Integer.toString(Integer.MAX_VALUE)
: etKeepDays.getText().toString());
args.putBoolean("system", cbPollSystem.isChecked());
args.putBoolean("user", cbPollUser.isChecked());
new SimpleTask<Void>() {
@Override
@ -822,6 +826,8 @@ public class FragmentFolders extends FragmentBase {
long account = args.getLong("account");
String sync = args.getString("sync");
String keep = args.getString("keep");
boolean system = args.getBoolean("system");
boolean user = args.getBoolean("user");
if (TextUtils.isEmpty(sync))
sync = "7";
@ -829,11 +835,30 @@ public class FragmentFolders extends FragmentBase {
keep = "30";
DB db = DB.getInstance(context);
try {
db.beginTransaction();
db.folder().setFolderProperties(
account,
Integer.parseInt(sync),
Integer.parseInt(keep));
List<EntityFolder> folders = db.folder().getFolders(account, false, true);
if (folders != null)
for (EntityFolder folder : folders)
if (folder.synchronize && !folder.poll)
if (EntityFolder.USER.equals(folder.type)
? user
: system && !EntityFolder.INBOX.equals(folder.type))
db.folder().setFolderPoll(folder.id, true);
db.setTransactionSuccessful();
} finally {
db.endTransaction();
}
ServiceSynchronize.reload(context, account, false, "Apply");
return null;
}

@ -80,5 +80,33 @@
android:text="@string/title_keep_all"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/etKeepDays" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvAdvanced"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:text="@string/title_setup_advanced"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbKeepAll" />
<CheckBox
android:id="@+id/cbPollSystem"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_poll_system"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvAdvanced" />
<CheckBox
android:id="@+id/cbPollUser"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_poll_user"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbPollSystem" />
</androidx.constraintlayout.widget.ConstraintLayout>
</eu.faircode.email.ScrollViewEx>

@ -760,6 +760,8 @@
<string name="title_keep_days">Keep messages (days)</string>
<string name="title_keep_days_remark">Old messages will be removed from the device, but will remain on the server</string>
<string name="title_keep_all">Keep all messages</string>
<string name="title_poll_system">Set system folders to periodically check for new messages</string>
<string name="title_poll_user">Set user folders to periodically check for new messages</string>
<string name="title_auto_trash">Automatically move old messages to trash</string>
<string name="title_auto_delete">Automatically permanently delete old messages</string>
<string name="title_auto_delete_hint">Old messages are messages that are no longer kept on the device</string>

Loading…
Cancel
Save