diff --git a/app/src/main/java/eu/faircode/email/DaoFolder.java b/app/src/main/java/eu/faircode/email/DaoFolder.java index b465452b..bcb54ebb 100644 --- a/app/src/main/java/eu/faircode/email/DaoFolder.java +++ b/app/src/main/java/eu/faircode/email/DaoFolder.java @@ -90,10 +90,6 @@ public interface DaoFolder { " WHERE account = :account AND type = :type") EntityFolder getFolderByType(long account, String type); - @Query("SELECT COUNT(folder.id) FROM folder" + - " WHERE account = :account AND `synchronize`") - int getFolderSyncCount(long account); - // For debug/crash info @Query("SELECT folder.* FROM folder" + " JOIN account ON account.id = folder.account" + diff --git a/app/src/main/java/eu/faircode/email/FragmentFolder.java b/app/src/main/java/eu/faircode/email/FragmentFolder.java index 6644aa1e..7c7e1d64 100644 --- a/app/src/main/java/eu/faircode/email/FragmentFolder.java +++ b/app/src/main/java/eu/faircode/email/FragmentFolder.java @@ -62,8 +62,6 @@ public class FragmentFolder extends FragmentEx { private long id = -1; private long account = -1; - private static final int MAX_FOLDER_SYNC = 25; - @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -320,6 +318,7 @@ public class FragmentFolder extends FragmentEx { etDisplay.setHint(folder == null ? null : folder.name); cbHide.setChecked(folder == null ? false : folder.hide); cbUnified.setChecked(folder == null ? false : folder.unified); + cbSynchronize.setChecked(folder == null || folder.synchronize); etAfter.setText(Integer.toString(folder == null ? EntityFolder.DEFAULT_USER_SYNC : folder.after)); } @@ -327,26 +326,8 @@ public class FragmentFolder extends FragmentEx { pbWait.setVisibility(View.GONE); Helper.setViewsEnabled(view, true); etRename.setEnabled(folder == null || EntityFolder.USER.equals(folder.type)); - cbSynchronize.setEnabled(false); btnSave.setEnabled(true); ibDelete.setVisibility(folder == null || !EntityFolder.USER.equals(folder.type) ? View.GONE : View.VISIBLE); - - Bundle args = new Bundle(); - args.putLong("account", folder == null ? account : folder.account); - - new SimpleTask() { - @Override - protected Integer onLoad(Context context, Bundle args) { - long account = args.getLong("account"); - return DB.getInstance(context).folder().getFolderSyncCount(account); - } - - @Override - protected void onLoaded(Bundle args, Integer count) { - cbSynchronize.setChecked((folder == null || folder.synchronize) && count < MAX_FOLDER_SYNC); - cbSynchronize.setEnabled(count < MAX_FOLDER_SYNC); - } - }.load(FragmentFolder.this, args); } }); }