Browse Source

Removed limit of 25 folders to synchronize

main
M66B 6 years ago
parent
commit
4fb2e7dbc2
2 changed files with 1 additions and 24 deletions
  1. +0
    -4
      app/src/main/java/eu/faircode/email/DaoFolder.java
  2. +1
    -20
      app/src/main/java/eu/faircode/email/FragmentFolder.java

+ 0
- 4
app/src/main/java/eu/faircode/email/DaoFolder.java View File

@ -90,10 +90,6 @@ public interface DaoFolder {
" WHERE account = :account AND type = :type") " WHERE account = :account AND type = :type")
EntityFolder getFolderByType(long account, String 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 // For debug/crash info
@Query("SELECT folder.* FROM folder" + @Query("SELECT folder.* FROM folder" +
" JOIN account ON account.id = folder.account" + " JOIN account ON account.id = folder.account" +


+ 1
- 20
app/src/main/java/eu/faircode/email/FragmentFolder.java View File

@ -62,8 +62,6 @@ public class FragmentFolder extends FragmentEx {
private long id = -1; private long id = -1;
private long account = -1; private long account = -1;
private static final int MAX_FOLDER_SYNC = 25;
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -320,6 +318,7 @@ public class FragmentFolder extends FragmentEx {
etDisplay.setHint(folder == null ? null : folder.name); etDisplay.setHint(folder == null ? null : folder.name);
cbHide.setChecked(folder == null ? false : folder.hide); cbHide.setChecked(folder == null ? false : folder.hide);
cbUnified.setChecked(folder == null ? false : folder.unified); 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)); 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); pbWait.setVisibility(View.GONE);
Helper.setViewsEnabled(view, true); Helper.setViewsEnabled(view, true);
etRename.setEnabled(folder == null || EntityFolder.USER.equals(folder.type)); etRename.setEnabled(folder == null || EntityFolder.USER.equals(folder.type));
cbSynchronize.setEnabled(false);
btnSave.setEnabled(true); btnSave.setEnabled(true);
ibDelete.setVisibility(folder == null || !EntityFolder.USER.equals(folder.type) ? View.GONE : View.VISIBLE); 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<Integer>() {
@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);
} }
}); });
} }


Loading…
Cancel
Save