1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-30 19:56:10 +00:00

Added batch folder poll

This commit is contained in:
M66B 2019-10-19 20:22:47 +02:00
parent c59f57b6a8
commit 713978a2ae
3 changed files with 21 additions and 5 deletions

View file

@ -264,11 +264,12 @@ public interface DaoFolder {
int sync_days, int keep_days, boolean auto_delete);
@Query("UPDATE folder" +
" SET `sync_days` = :sync_days" +
", `keep_days` = :keep_days" +
" SET poll = :poll" +
", sync_days = :sync_days" +
", keep_days = :keep_days" +
" WHERE account = :account" +
" AND type = '" + EntityFolder.USER + "'")
int setFolderProperties(long account, int sync_days, int keep_days);
int setFolderProperties(long account, boolean poll, int sync_days, int keep_days);
@Query("UPDATE folder SET keywords = :keywords WHERE id = :id")
int setFolderKeywords(long id, String keywords);

View file

@ -622,6 +622,7 @@ public class FragmentFolders extends FragmentBase {
@Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
View view = LayoutInflater.from(getContext()).inflate(R.layout.dialog_folder_all, null);
final CheckBox cbPoll = view.findViewById(R.id.cbPoll);
final EditText etSyncDays = view.findViewById(R.id.etSyncDays);
final EditText etKeepDays = view.findViewById(R.id.etKeepDays);
final CheckBox cbKeepAll = view.findViewById(R.id.cbKeepAll);
@ -639,6 +640,7 @@ public class FragmentFolders extends FragmentBase {
@Override
public void onClick(DialogInterface dialog, int which) {
Bundle args = getArguments();
args.putBoolean("poll", cbPoll.isChecked());
args.putString("sync", etSyncDays.getText().toString());
args.putString("keep", cbKeepAll.isChecked()
? Integer.toString(Integer.MAX_VALUE)
@ -648,6 +650,7 @@ public class FragmentFolders extends FragmentBase {
@Override
protected Void onExecute(Context context, Bundle args) throws Throwable {
long account = args.getLong("account");
boolean poll = args.getBoolean("poll");
String sync = args.getString("sync");
String keep = args.getString("keep");
@ -658,7 +661,10 @@ public class FragmentFolders extends FragmentBase {
DB db = DB.getInstance(context);
db.folder().setFolderProperties(
account, Integer.parseInt(sync), Integer.parseInt(keep));
account,
poll,
Integer.parseInt(sync),
Integer.parseInt(keep));
return null;
}

View file

@ -25,6 +25,15 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvCaption" />
<CheckBox
android:id="@+id/cbPoll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_poll_folder"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvUser" />
<TextView
android:id="@+id/tvSyncDays"
android:layout_width="wrap_content"
@ -33,7 +42,7 @@
android:text="@string/title_sync_days"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvUser" />
app:layout_constraintTop_toBottomOf="@id/cbPoll" />
<EditText
android:id="@+id/etSyncDays"