Classification requires download

This commit is contained in:
M66B
2021-01-16 15:09:12 +01:00
parent 2a6bfda7b8
commit bc2c89d339
3 changed files with 33 additions and 11 deletions

View File

@@ -6478,16 +6478,35 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
DB db = DB.getInstance(context);
EntityFolder inbox = db.folder().getFolderByType(account, EntityFolder.INBOX);
if (inbox == null)
return null;
EntityFolder junk = db.folder().getFolderByType(account, EntityFolder.JUNK);
if (inbox != null && junk != null) {
if (junk == null)
return null;
try {
db.beginTransaction();
db.folder().setFolderDownload(
inbox.id, inbox.download || filter);
db.folder().setFolderAutoClassify(
inbox.id, inbox.auto_classify_source || filter, inbox.auto_classify_target);
db.folder().setFolderDownload(
junk.id, junk.download || filter);
db.folder().setFolderAutoClassify(
junk.id, junk.auto_classify_source || filter, filter);
prefs.edit().putBoolean("classification", true).apply();
db.setTransactionSuccessful();
} finally {
db.endTransaction();
}
prefs.edit().putBoolean("classification", true).apply();
return null;
}
@@ -6531,8 +6550,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
return false;
return (classification &&
inbox.auto_classify_source &&
junk.auto_classify_source && junk.auto_classify_target);
inbox.download && inbox.auto_classify_source &&
junk.download && junk.auto_classify_source && junk.auto_classify_target);
}
@Override