1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-12 04:25:08 -05:00

Consistent random colors for accounts without color chips

This commit is contained in:
Jesse Vincent 2010-04-26 14:25:37 +00:00
parent 7b75788398
commit 417db22879

View File

@ -128,7 +128,7 @@ public class Account implements BaseAccount
mExpungePolicy = EXPUNGE_IMMEDIATELY; mExpungePolicy = EXPUNGE_IMMEDIATELY;
mAutoExpandFolderName = "INBOX"; mAutoExpandFolderName = "INBOX";
mMaxPushFolders = 10; mMaxPushFolders = 10;
mChipColor = (new Random()).nextInt(); mChipColor = 0;
searchableFolders = Searchable.ALL; searchableFolders = Searchable.ALL;
@ -183,8 +183,6 @@ public class Account implements BaseAccount
mMaxPushFolders = preferences.getPreferences().getInt(mUuid + ".maxPushFolders", 10); mMaxPushFolders = preferences.getPreferences().getInt(mUuid + ".maxPushFolders", 10);
mChipColor = preferences.getPreferences().getInt(mUuid+".chipColor", (new Random()).nextInt());
for (String type : networkTypes) for (String type : networkTypes)
{ {
Boolean useCompression = preferences.getPreferences().getBoolean(mUuid + ".useCompression." + type, Boolean useCompression = preferences.getPreferences().getBoolean(mUuid + ".useCompression." + type,
@ -217,6 +215,15 @@ public class Account implements BaseAccount
"INBOX"); "INBOX");
mAccountNumber = preferences.getPreferences().getInt(mUuid + ".accountNumber", 0); mAccountNumber = preferences.getPreferences().getInt(mUuid + ".accountNumber", 0);
Random random = new Random((long)mAccountNumber+4);
mChipColor = preferences.getPreferences().getInt(mUuid+".chipColor",
(random.nextInt(0x70) ) +
(random.nextInt(0x70) * 0xff ) +
(random.nextInt(0x70) * 0xffff ) +
0xff000000);
mVibrate = preferences.getPreferences().getBoolean(mUuid + ".vibrate", false); mVibrate = preferences.getPreferences().getBoolean(mUuid + ".vibrate", false);
mRing = preferences.getPreferences().getBoolean(mUuid + ".ring", true); mRing = preferences.getPreferences().getBoolean(mUuid + ".ring", true);