diff --git a/app/core/src/main/java/com/fsck/k9/AccountPreferenceSerializer.kt b/app/core/src/main/java/com/fsck/k9/AccountPreferenceSerializer.kt index 51e3d1b793793b0df1034abfdee0e259aa24137d..7fe5ea654a4ebcd07ae12ba88508ee981e0593b5 100644 --- a/app/core/src/main/java/com/fsck/k9/AccountPreferenceSerializer.kt +++ b/app/core/src/main/java/com/fsck/k9/AccountPreferenceSerializer.kt @@ -129,7 +129,7 @@ class AccountPreferenceSerializer( accountNumber = storage.getInt("$accountUuid.accountNumber", UNASSIGNED_ACCOUNT_NUMBER) - chipColor = storage.getInt("$accountUuid.chipColor", FALLBACK_ACCOUNT_COLOR) + chipColor = FALLBACK_ACCOUNT_COLOR sortType = getEnumStringPref(storage, "$accountUuid.sortTypeEnum", SortType.SORT_DATE) @@ -291,7 +291,7 @@ class AccountPreferenceSerializer( editor.putBoolean("$accountUuid.syncRemoteDeletions", isSyncRemoteDeletions) editor.putInt("$accountUuid.maxPushFolders", maxPushFolders) editor.putString("$accountUuid.searchableFolders", searchableFolders.name) - editor.putInt("$accountUuid.chipColor", chipColor) + editor.putInt("$accountUuid.chipColor", FALLBACK_ACCOUNT_COLOR) editor.putBoolean("$accountUuid.subscribedFoldersOnly", isSubscribedFoldersOnly) editor.putInt("$accountUuid.maximumPolledMessageAge", maximumPolledMessageAge) editor.putInt("$accountUuid.maximumAutoDownloadMessageSize", maximumAutoDownloadMessageSize) @@ -626,7 +626,7 @@ class AccountPreferenceSerializer( const val IDENTITY_EMAIL_KEY = "email" const val IDENTITY_DESCRIPTION_KEY = "description" - const val FALLBACK_ACCOUNT_COLOR = 0x0099CC + const val FALLBACK_ACCOUNT_COLOR = 0x0086FF @JvmField val DEFAULT_MESSAGE_FORMAT = MessageFormat.HTML diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/account/AccountCreator.kt b/app/ui/legacy/src/main/java/com/fsck/k9/account/AccountCreator.kt index f1ec3cb0ec439e08ac78202dd06e082234e7dd5a..70a3832b5727fec066a58a55a4696367bcdedc7e 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/account/AccountCreator.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/account/AccountCreator.kt @@ -1,6 +1,7 @@ package com.fsck.k9.account import android.content.res.Resources +import androidx.core.content.res.ResourcesCompat import com.fsck.k9.Account.DeletePolicy import com.fsck.k9.Preferences import com.fsck.k9.mail.ConnectionSecurity @@ -52,8 +53,7 @@ class AccountCreator(private val preferences: Preferences, private val resources } fun pickColor(): Int { - val accountColors = resources.getIntArray(R.array.account_colors).toList() - return accountColors[0]; + return ResourcesCompat.getColor(resources, R.color.color_default_accent, null) } companion object { diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/K9Drawer.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/K9Drawer.kt index fcda8c1925c0dbc2596700d0e14c352523cab3cd..d2659f13ad850f4fafe51d0b548455f5097b8af3 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/K9Drawer.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/K9Drawer.kt @@ -463,24 +463,12 @@ class K9Drawer(private val parent: MessageList, savedInstanceState: Bundle?) : K ) private fun getDrawerColorsForAccount(account: Account): DrawerColors { - val baseColor = if (themeManager.appTheme == Theme.DARK) { - getDarkThemeAccentColor(account.chipColor) - } else { - account.chipColor - } return DrawerColors( - accentColor = baseColor, + accentColor = ResourcesCompat.getColor(resources, R.color.color_default_accent, null), selectedColor = ResourcesCompat.getColor(resources, R.color.color_drawer_selected_background, null) ) } - private fun getDarkThemeAccentColor(color: Int): Int { - val lightColors = resources.getIntArray(R.array.account_colors) - val darkColors = resources.getIntArray(R.array.drawer_account_accent_color_dark_theme) - val index = lightColors.indexOf(color) - return if (index == -1) color else darkColors[index] - } - fun open() { drawer.openDrawer(GravityCompat.START) } diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/account/AccountSettingsDataStore.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/account/AccountSettingsDataStore.kt index 9672c89366f77b4988225ef703094aab322eb576..0b3d2d3e1e8f95317f0da58726aac19e90019324 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/account/AccountSettingsDataStore.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/account/AccountSettingsDataStore.kt @@ -79,12 +79,7 @@ class AccountSettingsDataStore( } override fun putInt(key: String?, value: Int) { - when (key) { - "chip_color" -> setAccountColor(value) - else -> return - } - - saveSettingsInBackground() + return } override fun getLong(key: String?, defValue: Long): Long { @@ -187,16 +182,6 @@ class AccountSettingsDataStore( saveSettingsInBackground() } - private fun setAccountColor(color: Int) { - if (color != account.chipColor) { - account.chipColor = color - - if (account.notificationSettings.light == NotificationLight.AccountColor) { - notificationSettingsChanged = true - } - } - } - private fun setNotificationSound(value: String) { account.notificationSettings.let { notificationSettings -> if (!notificationSettings.isRingEnabled || notificationSettings.ringtone != value) {