From 417db2287965af85c2f30563c2d41b9da3d5326a Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Mon, 26 Apr 2010 14:25:37 +0000 Subject: [PATCH] Consistent random colors for accounts without color chips --- src/com/fsck/k9/Account.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/com/fsck/k9/Account.java b/src/com/fsck/k9/Account.java index a31a738ed..63d0cd396 100644 --- a/src/com/fsck/k9/Account.java +++ b/src/com/fsck/k9/Account.java @@ -128,7 +128,7 @@ public class Account implements BaseAccount mExpungePolicy = EXPUNGE_IMMEDIATELY; mAutoExpandFolderName = "INBOX"; mMaxPushFolders = 10; - mChipColor = (new Random()).nextInt(); + mChipColor = 0; searchableFolders = Searchable.ALL; @@ -183,8 +183,6 @@ public class Account implements BaseAccount mMaxPushFolders = preferences.getPreferences().getInt(mUuid + ".maxPushFolders", 10); - mChipColor = preferences.getPreferences().getInt(mUuid+".chipColor", (new Random()).nextInt()); - for (String type : networkTypes) { Boolean useCompression = preferences.getPreferences().getBoolean(mUuid + ".useCompression." + type, @@ -217,6 +215,15 @@ public class Account implements BaseAccount "INBOX"); 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); mRing = preferences.getPreferences().getBoolean(mUuid + ".ring", true);