mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-23 18:02:15 -05:00
Merge pull request #240 from maniac103/thread-star
Show thread as starred if at least one message in it is starred.
This commit is contained in:
commit
d97d6b848d
@ -89,6 +89,16 @@ public class EmailProvider extends ContentProvider {
|
||||
InternalMessageColumns.MIME_TYPE
|
||||
};
|
||||
|
||||
private static final Map<String, String> THREAD_AGGREGATION_FUNCS = new HashMap<String, String>();
|
||||
static {
|
||||
THREAD_AGGREGATION_FUNCS.put(MessageColumns.DATE, "MAX");
|
||||
THREAD_AGGREGATION_FUNCS.put(MessageColumns.INTERNAL_DATE, "MAX");
|
||||
THREAD_AGGREGATION_FUNCS.put(MessageColumns.ATTACHMENT_COUNT, "SUM");
|
||||
THREAD_AGGREGATION_FUNCS.put(MessageColumns.READ, "MIN");
|
||||
THREAD_AGGREGATION_FUNCS.put(MessageColumns.FLAGGED, "MAX");
|
||||
THREAD_AGGREGATION_FUNCS.put(MessageColumns.ANSWERED, "MIN");
|
||||
THREAD_AGGREGATION_FUNCS.put(MessageColumns.FORWARDED, "MIN");
|
||||
}
|
||||
private static final String[] FIXUP_MESSAGES_COLUMNS = {
|
||||
MessageColumns.ID
|
||||
};
|
||||
@ -395,12 +405,12 @@ public class EmailProvider extends ContentProvider {
|
||||
first = false;
|
||||
}
|
||||
|
||||
final String aggregationFunc = THREAD_AGGREGATION_FUNCS.get(columnName);
|
||||
|
||||
if (MessageColumns.ID.equals(columnName)) {
|
||||
query.append("u." + MessageColumns.ID + " AS " + MessageColumns.ID);
|
||||
} else if (MessageColumns.READ.equals(columnName)) {
|
||||
query.append("MIN(read) AS " + MessageColumns.READ);
|
||||
} else if (MessageColumns.DATE.equals(columnName)) {
|
||||
query.append("MAX(date) AS " + MessageColumns.DATE);
|
||||
} else if (aggregationFunc != null) {
|
||||
query.append(aggregationFunc + "(" + columnName + ") AS " + columnName);
|
||||
} else if (SpecialColumns.THREAD_COUNT.equals(columnName)) {
|
||||
query.append("COUNT(g) AS " + SpecialColumns.THREAD_COUNT);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user