From 6e3ac2317ec11b22675c4adf80d51e4abea6a27d Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Mon, 24 Sep 2012 12:10:53 -0400 Subject: [PATCH] Fix a bug that caused accounts to not have a color on initial load (and now caused a crash on inital load) --- src/com/fsck/k9/Account.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/com/fsck/k9/Account.java b/src/com/fsck/k9/Account.java index 62b21afe9..bed3173f7 100644 --- a/src/com/fsck/k9/Account.java +++ b/src/com/fsck/k9/Account.java @@ -267,7 +267,11 @@ public class Account implements BaseAccount { mAutoExpandFolderName = INBOX; mInboxFolderName = INBOX; mMaxPushFolders = 10; - mChipColor = (new Random()).nextInt(0xffffff) + 0xff000000; + Random random = new Random((long)mAccountNumber + 4); + mChipColor = (random.nextInt(0x70) + + (random.nextInt(0x70) * 0xff) + + (random.nextInt(0x70) * 0xffff) + + 0xff000000); goToUnreadMessageSearch = false; mNotificationShowsUnreadCount = true; subscribedFoldersOnly = false; @@ -306,6 +310,8 @@ public class Account implements BaseAccount { mNotificationSetting.setRing(true); mNotificationSetting.setRingtone("content://settings/system/notification_sound"); mNotificationSetting.setLedColor(mChipColor); + + cacheChips(); } protected Account(Preferences preferences, String uuid) {