Prevent flicker on marking expanded message read

This commit is contained in:
M66B 2019-09-29 13:42:25 +02:00
parent e95228ee47
commit a685da21a9
3 changed files with 21 additions and 6 deletions

View File

@ -42,7 +42,8 @@ public interface DaoMessage {
String is_outbox = "folder.type = '" + EntityFolder.OUTBOX + "'"; String is_outbox = "folder.type = '" + EntityFolder.OUTBOX + "'";
@Query("SELECT message.*" + @Query("SELECT message.*" +
", account.pop AS accountPop, account.name AS accountName, IFNULL(identity.color, account.color) AS accountColor, account.notify AS accountNotify" + ", account.pop AS accountPop, account.name AS accountName, IFNULL(identity.color, account.color) AS accountColor" +
", account.notify AS accountNotify, account.auto_seen AS accountAutoSeen" +
", folder.name AS folderName, folder.display AS folderDisplay, folder.type AS folderType, folder.read_only AS folderReadOnly" + ", folder.name AS folderName, folder.display AS folderDisplay, folder.type AS folderType, folder.read_only AS folderReadOnly" +
", identity.name AS identityName, identity.email AS identityEmail, identity.synchronize AS identitySynchronize" + ", identity.name AS identityName, identity.email AS identityEmail, identity.synchronize AS identitySynchronize" +
", '[' || group_concat(message.`from`, ',') || ']' AS senders" + ", '[' || group_concat(message.`from`, ',') || ']' AS senders" +
@ -90,7 +91,8 @@ public interface DaoMessage {
boolean debug); boolean debug);
@Query("SELECT message.*" + @Query("SELECT message.*" +
", account.pop AS accountPop, account.name AS accountName, IFNULL(identity.color, account.color) AS accountColor, account.notify AS accountNotify" + ", account.pop AS accountPop, account.name AS accountName, IFNULL(identity.color, account.color) AS accountColor" +
", account.notify AS accountNotify, account.auto_seen AS accountAutoSeen" +
", folder.name AS folderName, folder.display AS folderDisplay, folder.type AS folderType, folder.read_only AS folderReadOnly" + ", folder.name AS folderName, folder.display AS folderDisplay, folder.type AS folderType, folder.read_only AS folderReadOnly" +
", identity.name AS identityName, identity.email AS identityEmail, identity.synchronize AS identitySynchronize" + ", identity.name AS identityName, identity.email AS identityEmail, identity.synchronize AS identitySynchronize" +
", '[' || group_concat(message.`from`, ',') || ']' AS senders" + ", '[' || group_concat(message.`from`, ',') || ']' AS senders" +
@ -132,7 +134,8 @@ public interface DaoMessage {
boolean debug); boolean debug);
@Query("SELECT message.*" + @Query("SELECT message.*" +
", account.pop AS accountPop, account.name AS accountName, IFNULL(identity.color, account.color) AS accountColor, account.notify AS accountNotify" + ", account.pop AS accountPop, account.name AS accountName, IFNULL(identity.color, account.color) AS accountColor" +
", account.notify AS accountNotify, account.auto_seen AS accountAutoSeen" +
", folder.name AS folderName, folder.display AS folderDisplay, folder.type AS folderType, folder.read_only AS folderReadOnly" + ", folder.name AS folderName, folder.display AS folderDisplay, folder.type AS folderType, folder.read_only AS folderReadOnly" +
", identity.name AS identityName, identity.email AS identityEmail, identity.synchronize AS identitySynchronize" + ", identity.name AS identityName, identity.email AS identityEmail, identity.synchronize AS identitySynchronize" +
", message.`from` AS senders" + ", message.`from` AS senders" +
@ -231,7 +234,8 @@ public interface DaoMessage {
int countMessageByMsgId(long folder, String msgid); int countMessageByMsgId(long folder, String msgid);
@Query("SELECT message.*" + @Query("SELECT message.*" +
", account.pop AS accountPop, account.name AS accountName, identity.color AS accountColor, account.notify AS accountNotify" + ", account.pop AS accountPop, account.name AS accountName, identity.color AS accountColor" +
", account.notify AS accountNotify, account.auto_seen AS accountAutoSeen" +
", folder.name AS folderName, folder.display AS folderDisplay, folder.type AS folderType, folder.read_only AS folderReadOnly" + ", folder.name AS folderName, folder.display AS folderDisplay, folder.type AS folderType, folder.read_only AS folderReadOnly" +
", identity.name AS identityName, identity.email AS identityEmail, identity.synchronize AS identitySynchronize" + ", identity.name AS identityName, identity.email AS identityEmail, identity.synchronize AS identitySynchronize" +
", message.`from` AS senders" + ", message.`from` AS senders" +
@ -263,7 +267,8 @@ public interface DaoMessage {
TupleMessageStats getUnseenWidget(); TupleMessageStats getUnseenWidget();
@Query("SELECT message.*" + @Query("SELECT message.*" +
", account.pop AS accountPop, account.name AS accountName, IFNULL(identity.color, account.color) AS accountColor, account.notify AS accountNotify" + ", account.pop AS accountPop, account.name AS accountName, IFNULL(identity.color, account.color) AS accountColor" +
", account.notify AS accountNotify, account.auto_seen AS accountAutoSeen" +
", folder.name AS folderName, folder.display AS folderDisplay, folder.type AS folderType, folder.read_only AS folderReadOnly" + ", folder.name AS folderName, folder.display AS folderDisplay, folder.type AS folderType, folder.read_only AS folderReadOnly" +
", identity.name AS identityName, identity.email AS identityEmail, identity.synchronize AS identitySynchronize" + ", identity.name AS identityName, identity.email AS identityEmail, identity.synchronize AS identitySynchronize" +
", message.`from` AS senders" + ", message.`from` AS senders" +

View File

@ -3099,8 +3099,16 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
expand = messages.get(0); expand = messages.get(0);
if (expand != null && if (expand != null &&
(expand.content || unmetered || (expand.size != null && expand.size < download))) (expand.content || unmetered || (expand.size != null && expand.size < download))) {
// Prevent flicker
if (expand.accountPop ||
(expand.accountAutoSeen && !expand.ui_seen && !expand.folderReadOnly)) {
expand.unseen = 0;
expand.ui_seen = true;
}
iProperties.setValue("expanded", expand.id, true); iProperties.setValue("expanded", expand.id, true);
}
} }
} else { } else {
if (autoCloseCount > 0 && (autoclose || onclose != null)) { if (autoCloseCount > 0 && (autoclose || onclose != null)) {

View File

@ -30,6 +30,7 @@ public class TupleMessageEx extends EntityMessage {
public String accountName; public String accountName;
public Integer accountColor; public Integer accountColor;
public boolean accountNotify; public boolean accountNotify;
public boolean accountAutoSeen;
public String folderName; public String folderName;
public String folderDisplay; public String folderDisplay;
public String folderType; public String folderType;
@ -57,6 +58,7 @@ public class TupleMessageEx extends EntityMessage {
Objects.equals(this.accountName, other.accountName) && Objects.equals(this.accountName, other.accountName) &&
Objects.equals(this.accountColor, other.accountColor) && Objects.equals(this.accountColor, other.accountColor) &&
this.accountNotify == other.accountNotify && this.accountNotify == other.accountNotify &&
this.accountAutoSeen == other.accountAutoSeen &&
this.folderName.equals(other.folderName) && this.folderName.equals(other.folderName) &&
Objects.equals(this.folderDisplay, other.folderDisplay) && Objects.equals(this.folderDisplay, other.folderDisplay) &&
this.folderType.equals(other.folderType) && this.folderType.equals(other.folderType) &&