Simplify folder apply all

This commit is contained in:
M66B 2020-08-15 20:01:00 +02:00
parent cde90153fd
commit e6f7063dd9
3 changed files with 7 additions and 35 deletions

View File

@ -291,13 +291,10 @@ 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 poll = :poll" + " SET sync_days = :sync_days, keep_days = :keep_days" +
", download = :download" +
", 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, boolean poll, boolean download, int sync_days, int keep_days); int setFolderProperties(long account, 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

@ -768,8 +768,6 @@ 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 CheckBox cbDownload = view.findViewById(R.id.cbDownload);
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);
@ -787,8 +785,6 @@ 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.putBoolean("download", cbDownload.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)
@ -798,8 +794,6 @@ 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");
boolean download = args.getBoolean("download");
String sync = args.getString("sync"); String sync = args.getString("sync");
String keep = args.getString("keep"); String keep = args.getString("keep");
@ -811,8 +805,6 @@ public class FragmentFolders extends FragmentBase {
DB db = DB.getInstance(context); DB db = DB.getInstance(context);
db.folder().setFolderProperties( db.folder().setFolderProperties(
account, account,
poll,
download,
Integer.parseInt(sync), Integer.parseInt(sync),
Integer.parseInt(keep)); Integer.parseInt(keep));

View File

@ -6,7 +6,7 @@
android:padding="24dp"> android:padding="24dp">
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<eu.faircode.email.FixedTextView <eu.faircode.email.FixedTextView
@ -24,37 +24,20 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="12dp" android:layout_marginTop="12dp"
android:text="@string/title_folder_user_only" android:text="@string/title_folder_user_only"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="italic|bold"
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" />
<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" />
<eu.faircode.email.FixedTextView <eu.faircode.email.FixedTextView
android:id="@+id/tvSyncDays" android:id="@+id/tvSyncDays"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="12dp" android:layout_marginTop="24dp"
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/cbDownload" /> app:layout_constraintTop_toBottomOf="@id/tvUser" />
<eu.faircode.email.EditTextPlain <eu.faircode.email.EditTextPlain
android:id="@+id/etSyncDays" android:id="@+id/etSyncDays"