Batch folder download

This commit is contained in:
M66B 2019-10-20 16:36:33 +02:00
parent a21aa3e68f
commit d423ebfa92
3 changed files with 16 additions and 2 deletions

View File

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

View File

@ -623,6 +623,7 @@ public class FragmentFolders extends FragmentBase {
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 CheckBox cbDownload = view.findViewById(R.id.cbDownload);
final EditText etSyncDays = view.findViewById(R.id.etSyncDays);
final EditText etKeepDays = view.findViewById(R.id.etKeepDays);
final CheckBox cbKeepAll = view.findViewById(R.id.cbKeepAll);
@ -641,6 +642,7 @@ public class FragmentFolders extends FragmentBase {
public void onClick(DialogInterface dialog, int which) {
Bundle args = getArguments();
args.putBoolean("poll", cbPoll.isChecked());
args.putBoolean("download", cbDownload.isChecked());
args.putString("sync", etSyncDays.getText().toString());
args.putString("keep", cbKeepAll.isChecked()
? Integer.toString(Integer.MAX_VALUE)
@ -651,6 +653,7 @@ public class FragmentFolders extends FragmentBase {
protected Void onExecute(Context context, Bundle args) throws Throwable {
long account = args.getLong("account");
boolean poll = args.getBoolean("poll");
boolean download = args.getBoolean("download");
String sync = args.getString("sync");
String keep = args.getString("keep");
@ -663,6 +666,7 @@ public class FragmentFolders extends FragmentBase {
db.folder().setFolderProperties(
account,
poll,
download,
Integer.parseInt(sync),
Integer.parseInt(keep));

View File

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