mirror of
https://github.com/moparisthebest/k-9
synced 2024-08-13 17:03:48 -04:00
Cache the read and unread color chip variants per account.
This commit is contained in:
parent
86c9aab7a8
commit
8daea241af
@ -190,6 +190,9 @@ public class Account implements BaseAccount {
|
|||||||
|
|
||||||
private CryptoProvider mCryptoProvider = null;
|
private CryptoProvider mCryptoProvider = null;
|
||||||
|
|
||||||
|
private ColorChip mUnreadColorChip;
|
||||||
|
private ColorChip mReadColorChip;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates whether this account is enabled, i.e. ready for use, or not.
|
* Indicates whether this account is enabled, i.e. ready for use, or not.
|
||||||
*
|
*
|
||||||
@ -749,6 +752,8 @@ public class Account implements BaseAccount {
|
|||||||
|
|
||||||
public synchronized void setChipColor(int color) {
|
public synchronized void setChipColor(int color) {
|
||||||
mChipColor = color;
|
mChipColor = color;
|
||||||
|
mUnreadColorChip = null;
|
||||||
|
mReadColorChip = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized int getChipColor() {
|
public synchronized int getChipColor() {
|
||||||
@ -757,7 +762,17 @@ public class Account implements BaseAccount {
|
|||||||
|
|
||||||
|
|
||||||
public ColorChip generateColorChip(boolean messageRead) {
|
public ColorChip generateColorChip(boolean messageRead) {
|
||||||
return new ColorChip(mChipColor, messageRead);
|
if (messageRead) {
|
||||||
|
if (mReadColorChip == null) {
|
||||||
|
mReadColorChip = new ColorChip(mChipColor, true);
|
||||||
|
}
|
||||||
|
return mReadColorChip;
|
||||||
|
} else {
|
||||||
|
if (mUnreadColorChip == null) {
|
||||||
|
mUnreadColorChip = new ColorChip(mChipColor, false);
|
||||||
|
}
|
||||||
|
return mUnreadColorChip;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ColorChip generateColorChip() {
|
public ColorChip generateColorChip() {
|
||||||
|
Loading…
Reference in New Issue
Block a user