mirror of https://github.com/M66B/FairEmail.git
Simplification
This commit is contained in:
parent
abc7889d1e
commit
d8350e99d3
|
@ -8584,40 +8584,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
gotoPos = pos;
|
||||
}
|
||||
|
||||
private static void quickSort(TupleMessageEx message, int low, int high) {
|
||||
if (low < high) {
|
||||
int pi = quickPartition(message, low, high);
|
||||
quickSort(message, low, pi - 1);
|
||||
quickSort(message, pi + 1, high);
|
||||
}
|
||||
}
|
||||
|
||||
private static int quickPartition(TupleMessageEx message, int low, int high) {
|
||||
long pivot = message.group_received[high];
|
||||
int i = (low - 1);
|
||||
for (int j = low; j <= high; j++)
|
||||
if (message.group_received[j] < pivot) {
|
||||
i++;
|
||||
quickSwap(message, i, j);
|
||||
}
|
||||
quickSwap(message, i + 1, high);
|
||||
return (i + 1);
|
||||
}
|
||||
|
||||
private static void quickSwap(TupleMessageEx message, int i, int j) {
|
||||
long received = message.group_received[i];
|
||||
message.group_received[i] = message.group_received[j];
|
||||
message.group_received[j] = received;
|
||||
|
||||
Address sender = message.senders[i];
|
||||
message.senders[i] = message.senders[j];
|
||||
message.senders[j] = sender;
|
||||
|
||||
Address recipient = message.recipients[i];
|
||||
message.recipients[i] = message.recipients[j];
|
||||
message.recipients[j] = recipient;
|
||||
}
|
||||
|
||||
void submitList(PagedList<TupleMessageEx> list) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
TupleMessageEx message = list.get(i);
|
||||
|
@ -8628,10 +8594,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
addExtra(message.senders, message.extra);
|
||||
message.resolveLabelColors(context);
|
||||
message.resolveKeywordColors(context);
|
||||
if (message.group_received != null && message.group_received.length > 1 &&
|
||||
message.senders != null && message.senders.length == message.group_received.length &&
|
||||
message.recipients != null && message.recipients.length == message.group_received.length)
|
||||
quickSort(message, 0, message.group_received.length - 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -51,9 +51,8 @@ public interface DaoMessage {
|
|||
", account.notify AS accountNotify, account.summary AS accountSummary, account.leave_deleted AS accountLeaveDeleted, account.auto_seen AS accountAutoSeen" +
|
||||
", folder.name AS folderName, folder.color AS folderColor, folder.display AS folderDisplay, folder.type AS folderType, NULL AS folderInheritedType, folder.unified AS folderUnified, folder.read_only AS folderReadOnly" +
|
||||
", IFNULL(identity.display, identity.name) AS identityName, identity.email AS identityEmail, identity.color AS identityColor, identity.synchronize AS identitySynchronize" +
|
||||
", '[' || group_concat(message.`from`, ',') || ']' AS senders" +
|
||||
", '[' || group_concat(message.`to`, ',') || ']' AS recipients" +
|
||||
", group_concat(message.received, ',') AS group_received" +
|
||||
", '[' || (SELECT group_concat(`from`, ',') FROM (SELECT DISTINCT `from` FROM message m0 WHERE m0.thread = message.thread ORDER BY m0.received LIMIT 3)) || ']' AS senders" +
|
||||
", '[' || (SELECT group_concat(`to`, ',') FROM (SELECT DISTINCT `to` FROM message m0 WHERE m0.thread = message.thread ORDER BY m0.received LIMIT 3)) || ']' AS recipients" +
|
||||
", COUNT(message.id) AS count" +
|
||||
", SUM(1 - message.ui_seen) AS unseen" +
|
||||
", SUM(1 - message.ui_flagged) AS unflagged" +
|
||||
|
@ -130,9 +129,8 @@ public interface DaoMessage {
|
|||
", account.notify AS accountNotify, account.summary AS accountSummary, account.leave_deleted AS accountLeaveDeleted, account.auto_seen AS accountAutoSeen" +
|
||||
", folder.name AS folderName, folder.color AS folderColor, folder.display AS folderDisplay, folder.type AS folderType, f.inherited_type AS folderInheritedType, folder.unified AS folderUnified, folder.read_only AS folderReadOnly" +
|
||||
", IFNULL(identity.display, identity.name) AS identityName, identity.email AS identityEmail, identity.color AS identityColor, identity.synchronize AS identitySynchronize" +
|
||||
", '[' || group_concat(message.`from`, ',') || ']' AS senders" +
|
||||
", '[' || group_concat(message.`to`, ',') || ']' AS recipients" +
|
||||
", group_concat(message.received, ',') AS group_received" +
|
||||
", '[' || (SELECT group_concat(`from`, ',') FROM (SELECT DISTINCT `from` FROM message m0 WHERE m0.thread = message.thread ORDER BY m0.received LIMIT 3)) || ']' AS senders" +
|
||||
", '[' || (SELECT group_concat(`to`, ',') FROM (SELECT DISTINCT `to` FROM message m0 WHERE m0.thread = message.thread ORDER BY m0.received LIMIT 3)) || ']' AS recipients" +
|
||||
", COUNT(message.id) AS count" +
|
||||
", SUM(1 - message.ui_seen) AS unseen" +
|
||||
", SUM(1 - message.ui_flagged) AS unflagged" +
|
||||
|
@ -204,7 +202,6 @@ public interface DaoMessage {
|
|||
", IFNULL(identity.display, identity.name) AS identityName, identity.email AS identityEmail, identity.color AS identityColor, identity.synchronize AS identitySynchronize" +
|
||||
", message.`from` AS senders" +
|
||||
", message.`to` AS recipients" +
|
||||
", message.received AS group_received" +
|
||||
", 1 AS count" +
|
||||
", CASE WHEN message.ui_seen THEN 0 ELSE 1 END AS unseen" +
|
||||
", CASE WHEN message.ui_flagged THEN 0 ELSE 1 END AS unflagged" +
|
||||
|
@ -511,7 +508,6 @@ public interface DaoMessage {
|
|||
", IFNULL(identity.display, identity.name) AS identityName, identity.email AS identityEmail, identity.color AS identityColor, identity.synchronize AS identitySynchronize" +
|
||||
", message.`from` AS senders" +
|
||||
", message.`to` AS recipients" +
|
||||
", message.received AS group_received" +
|
||||
", 1 AS count" +
|
||||
", CASE WHEN message.ui_seen THEN 0 ELSE 1 END AS unseen" +
|
||||
", CASE WHEN message.ui_flagged THEN 0 ELSE 1 END AS unflagged" +
|
||||
|
@ -543,7 +539,6 @@ public interface DaoMessage {
|
|||
", IFNULL(identity.display, identity.name) AS identityName, identity.email AS identityEmail, identity.color AS identityColor, identity.synchronize AS identitySynchronize" +
|
||||
", message.`from` AS senders" +
|
||||
", message.`to` AS recipients" +
|
||||
", message.received AS group_received" +
|
||||
", 1 AS count" +
|
||||
", 1 AS unseen" +
|
||||
", 0 AS unflagged" +
|
||||
|
|
|
@ -55,7 +55,6 @@ public class TupleMessageEx extends EntityMessage {
|
|||
public Boolean identitySynchronize;
|
||||
public Address[] senders;
|
||||
public Address[] recipients;
|
||||
public long[] group_received;
|
||||
public int count;
|
||||
public int unseen;
|
||||
public int unflagged;
|
||||
|
|
Loading…
Reference in New Issue