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); int sync_days, int keep_days, boolean auto_delete);
@Query("UPDATE folder" + @Query("UPDATE folder" +
" SET `sync_days` = :sync_days" + " SET poll = :poll" +
", `keep_days` = :keep_days" + ", sync_days = :sync_days" +
", keep_days = :keep_days" +
" WHERE account = :account" + " WHERE account = :account" +
" AND type = '" + EntityFolder.USER + "'") " 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") @Query("UPDATE folder SET keywords = :keywords WHERE id = :id")
int setFolderKeywords(long id, String keywords); int setFolderKeywords(long id, String keywords);

View File

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

View File

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