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
@Database(
version = 267,
version = 268,
entities = {
EntityIdentity.class,
EntityAccount.class,
@ -2735,6 +2735,12 @@ public abstract class DB extends RoomDatabase {
logMigration(startVersion, endVersion);
// 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) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase db) {

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

@ -330,6 +330,7 @@ public interface DaoFolder {
", color = :color" +
", unified = :unified" +
", navigation = :navigation" +
", count_unread = :count_unread" +
", notify = :notify" +
", hide = :hide" +
", hide_seen = :hide_seen" +
@ -345,7 +346,8 @@ public interface DaoFolder {
" WHERE id = :id")
int setFolderProperties(
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 synchronize, boolean poll, int poll_factor, boolean download,
boolean auto_classify_source, boolean auto_classify_target,

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

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

@ -148,6 +148,15 @@
app:layout_constraintStart_toStartOf="parent"
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
android:id="@+id/cbNotify"
android:layout_width="wrap_content"
@ -155,7 +164,7 @@
android:layout_marginTop="12dp"
android:text="@string/title_notify_folder"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbNavigation" />
app:layout_constraintTop_toBottomOf="@id/cbCountUnread" />
<CheckBox
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_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_count_unread" translatable="false">Count unread 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_target">Automatically move classified messages to this folder</string>

Loading…
Cancel
Save