Debug: count unread option / nav menu

pull/212/head
M66B 1 year ago
parent c3f051040e
commit fa78c436ea

File diff suppressed because it is too large Load Diff

@ -68,7 +68,7 @@ import javax.mail.internet.InternetAddress;
// https://developer.android.com/topic/libraries/architecture/room.html // https://developer.android.com/topic/libraries/architecture/room.html
@Database( @Database(
version = 267, version = 268,
entities = { entities = {
EntityIdentity.class, EntityIdentity.class,
EntityAccount.class, EntityAccount.class,
@ -2735,6 +2735,12 @@ public abstract class DB extends RoomDatabase {
logMigration(startVersion, endVersion); logMigration(startVersion, endVersion);
// Do nothing // Do nothing
} }
}).addMigrations(new Migration(267, 268) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase db) {
logMigration(startVersion, endVersion);
db.execSQL("ALTER TABLE `folder` ADD COLUMN `count_unread` INTEGER NOT NULL DEFAULT 1");
}
}).addMigrations(new Migration(998, 999) { }).addMigrations(new Migration(998, 999) {
@Override @Override
public void migrate(@NonNull SupportSQLiteDatabase db) { public void migrate(@NonNull SupportSQLiteDatabase db) {

@ -99,6 +99,7 @@ public interface DaoAccount {
" AND folder.type <> '" + EntityFolder.JUNK + "'" + " AND folder.type <> '" + EntityFolder.JUNK + "'" +
" AND folder.type <> '" + EntityFolder.DRAFTS + "'" + " AND folder.type <> '" + EntityFolder.DRAFTS + "'" +
" AND folder.type <> '" + EntityFolder.OUTBOX + "'" + " AND folder.type <> '" + EntityFolder.OUTBOX + "'" +
" AND folder.count_unread" +
" AND NOT ui_seen" + " AND NOT ui_seen" +
" AND NOT ui_hide) AS unseen" + " AND NOT ui_hide) AS unseen" +
" FROM account" + " FROM account" +

@ -330,6 +330,7 @@ public interface DaoFolder {
", color = :color" + ", color = :color" +
", unified = :unified" + ", unified = :unified" +
", navigation = :navigation" + ", navigation = :navigation" +
", count_unread = :count_unread" +
", notify = :notify" + ", notify = :notify" +
", hide = :hide" + ", hide = :hide" +
", hide_seen = :hide_seen" + ", hide_seen = :hide_seen" +
@ -345,7 +346,8 @@ public interface DaoFolder {
" WHERE id = :id") " WHERE id = :id")
int setFolderProperties( int setFolderProperties(
long id, String rename, long id, String rename,
String display, Integer color, boolean unified, boolean navigation, boolean notify, String display, Integer color, boolean unified,
boolean navigation, boolean count_unread, boolean notify,
boolean hide, boolean hide_seen, boolean hide, boolean hide_seen,
boolean synchronize, boolean poll, int poll_factor, boolean download, boolean synchronize, boolean poll, int poll_factor, boolean download,
boolean auto_classify_source, boolean auto_classify_target, boolean auto_classify_source, boolean auto_classify_target,

@ -120,6 +120,8 @@ public class EntityFolder extends EntityOrder implements Serializable {
@NonNull @NonNull
public Boolean navigation = false; public Boolean navigation = false;
@NonNull @NonNull
public Boolean count_unread = true;
@NonNull
public Boolean notify = false; public Boolean notify = false;
public Integer total; // messages on server public Integer total; // messages on server

@ -65,6 +65,7 @@ public class FragmentFolder extends FragmentBase {
private CheckBox cbHideSeen; private CheckBox cbHideSeen;
private CheckBox cbUnified; private CheckBox cbUnified;
private CheckBox cbNavigation; private CheckBox cbNavigation;
private CheckBox cbCountUnread;
private CheckBox cbNotify; private CheckBox cbNotify;
private CheckBox cbSynchronize; private CheckBox cbSynchronize;
private CheckBox cbPoll; private CheckBox cbPoll;
@ -131,6 +132,7 @@ public class FragmentFolder extends FragmentBase {
cbHideSeen = view.findViewById(R.id.cbHideSeen); cbHideSeen = view.findViewById(R.id.cbHideSeen);
cbUnified = view.findViewById(R.id.cbUnified); cbUnified = view.findViewById(R.id.cbUnified);
cbNavigation = view.findViewById(R.id.cbNavigation); cbNavigation = view.findViewById(R.id.cbNavigation);
cbCountUnread = view.findViewById(R.id.cbCountUnread);
cbNotify = view.findViewById(R.id.cbNotify); cbNotify = view.findViewById(R.id.cbNotify);
cbSynchronize = view.findViewById(R.id.cbSynchronize); cbSynchronize = view.findViewById(R.id.cbSynchronize);
cbPoll = view.findViewById(R.id.cbPoll); cbPoll = view.findViewById(R.id.cbPoll);
@ -253,6 +255,7 @@ public class FragmentFolder extends FragmentBase {
grpImap.setVisibility(imap ? View.VISIBLE : View.GONE); grpImap.setVisibility(imap ? View.VISIBLE : View.GONE);
tvParent.setText(parent); tvParent.setText(parent);
grpParent.setVisibility(parent == null ? View.GONE : View.VISIBLE); grpParent.setVisibility(parent == null ? View.GONE : View.VISIBLE);
cbCountUnread.setVisibility(BuildConfig.DEBUG ? View.VISIBLE : View.GONE);
cbAutoClassifySource.setVisibility(View.GONE); cbAutoClassifySource.setVisibility(View.GONE);
cbAutoClassifyTarget.setVisibility(View.GONE); cbAutoClassifyTarget.setVisibility(View.GONE);
tvAutoClassifyPro.setVisibility(View.GONE); tvAutoClassifyPro.setVisibility(View.GONE);
@ -316,6 +319,7 @@ public class FragmentFolder extends FragmentBase {
cbHideSeen.setChecked(folder == null ? false : folder.hide_seen); cbHideSeen.setChecked(folder == null ? false : folder.hide_seen);
cbUnified.setChecked(folder == null ? false : folder.unified); cbUnified.setChecked(folder == null ? false : folder.unified);
cbNavigation.setChecked(folder == null ? false : folder.navigation); cbNavigation.setChecked(folder == null ? false : folder.navigation);
cbCountUnread.setChecked(folder == null ? true : folder.count_unread);
cbNotify.setChecked(folder == null ? false : folder.notify); cbNotify.setChecked(folder == null ? false : folder.notify);
cbSynchronize.setChecked(folder == null || folder.synchronize); cbSynchronize.setChecked(folder == null || folder.synchronize);
cbPoll.setChecked(folder == null ? true : folder.poll); cbPoll.setChecked(folder == null ? true : folder.poll);
@ -461,6 +465,7 @@ public class FragmentFolder extends FragmentBase {
args.putBoolean("hide_seen", cbHideSeen.isChecked()); args.putBoolean("hide_seen", cbHideSeen.isChecked());
args.putBoolean("unified", cbUnified.isChecked()); args.putBoolean("unified", cbUnified.isChecked());
args.putBoolean("navigation", cbNavigation.isChecked()); args.putBoolean("navigation", cbNavigation.isChecked());
args.putBoolean("count_unread", cbCountUnread.isChecked());
args.putBoolean("notify", cbNotify.isChecked()); args.putBoolean("notify", cbNotify.isChecked());
args.putBoolean("synchronize", cbSynchronize.isChecked()); args.putBoolean("synchronize", cbSynchronize.isChecked());
args.putBoolean("poll", cbPoll.isChecked()); args.putBoolean("poll", cbPoll.isChecked());
@ -506,6 +511,7 @@ public class FragmentFolder extends FragmentBase {
boolean hide_seen = args.getBoolean("hide_seen"); boolean hide_seen = args.getBoolean("hide_seen");
boolean unified = args.getBoolean("unified"); boolean unified = args.getBoolean("unified");
boolean navigation = args.getBoolean("navigation"); boolean navigation = args.getBoolean("navigation");
boolean count_unread = args.getBoolean("count_unread");
boolean notify = args.getBoolean("notify"); boolean notify = args.getBoolean("notify");
boolean synchronize = args.getBoolean("synchronize"); boolean synchronize = args.getBoolean("synchronize");
boolean poll = args.getBoolean("poll"); boolean poll = args.getBoolean("poll");
@ -560,6 +566,8 @@ public class FragmentFolder extends FragmentBase {
return true; return true;
if (!Objects.equals(folder.navigation, navigation)) if (!Objects.equals(folder.navigation, navigation))
return true; return true;
if (!Objects.equals(folder.count_unread, count_unread))
return true;
if (!Objects.equals(folder.notify, notify)) if (!Objects.equals(folder.notify, notify))
return true; return true;
if (!Objects.equals(folder.hide, hide)) if (!Objects.equals(folder.hide, hide))
@ -616,6 +624,7 @@ public class FragmentFolder extends FragmentBase {
create.type = EntityFolder.USER; create.type = EntityFolder.USER;
create.unified = unified; create.unified = unified;
create.navigation = navigation; create.navigation = navigation;
create.count_unread = count_unread;
create.notify = notify; create.notify = notify;
create.hide = hide; create.hide = hide;
create.hide_seen = hide; create.hide_seen = hide;
@ -645,7 +654,8 @@ public class FragmentFolder extends FragmentBase {
Log.i("Updating folder=" + folder.name); Log.i("Updating folder=" + folder.name);
db.folder().setFolderProperties(id, db.folder().setFolderProperties(id,
folder.name.equals(name) ? null : name, folder.name.equals(name) ? null : name,
display, color, unified, navigation, notify, display, color, unified,
navigation, count_unread, notify,
hide, hide_seen, hide, hide_seen,
synchronize, poll, poll_factor, download, synchronize, poll, poll_factor, download,
auto_classify_source, auto_classify_target, auto_classify_source, auto_classify_target,

@ -148,6 +148,15 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbUnified" /> app:layout_constraintTop_toBottomOf="@id/cbUnified" />
<CheckBox
android:id="@+id/cbCountUnread"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_count_unread"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbNavigation" />
<CheckBox <CheckBox
android:id="@+id/cbNotify" android:id="@+id/cbNotify"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -155,7 +164,7 @@
android:layout_marginTop="12dp" android:layout_marginTop="12dp"
android:text="@string/title_notify_folder" android:text="@string/title_notify_folder"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbNavigation" /> app:layout_constraintTop_toBottomOf="@id/cbCountUnread" />
<CheckBox <CheckBox
android:id="@+id/cbSynchronize" android:id="@+id/cbSynchronize"

@ -1250,6 +1250,7 @@
<string name="title_poll_folder">Check periodically instead of continuous synchronize</string> <string name="title_poll_folder">Check periodically instead of continuous synchronize</string>
<string name="title_poll_folder_remark">Most email servers allow push messages for a handful of folders only!</string> <string name="title_poll_folder_remark">Most email servers allow push messages for a handful of folders only!</string>
<string name="title_download_folder">Automatically download message texts and attachments</string> <string name="title_download_folder">Automatically download message texts and attachments</string>
<string name="title_count_unread" translatable="false">Count unread messages</string>
<string name="title_notify_folder">Notify on new messages</string> <string name="title_notify_folder">Notify on new messages</string>
<string name="title_auto_classify_source">Classify new messages in this folder</string> <string name="title_auto_classify_source">Classify new messages in this folder</string>
<string name="title_auto_classify_target">Automatically move classified messages to this folder</string> <string name="title_auto_classify_target">Automatically move classified messages to this folder</string>

Loading…
Cancel
Save