Loading app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt +1 −0 Original line number Diff line number Diff line Loading @@ -1488,6 +1488,7 @@ open class MessageList : private fun configureDrawer() { val drawer = drawer ?: return drawer.selectAccount(account!!.uuid) when { singleFolderMode -> drawer.selectFolder(search!!.folderIds[0]) // Don't select any item in the drawer because the Unified Inbox is displayed, but not listed in the drawer Loading app/ui/legacy/src/main/java/com/fsck/k9/ui/K9Drawer.kt +20 −2 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import com.mikepenz.materialdrawer.model.DividerDrawerItem import com.mikepenz.materialdrawer.model.PrimaryDrawerItem import com.mikepenz.materialdrawer.model.ProfileDrawerItem import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem import com.mikepenz.materialdrawer.model.interfaces.IProfile import com.mikepenz.materialdrawer.model.interfaces.badgeText import com.mikepenz.materialdrawer.model.interfaces.descriptionText import com.mikepenz.materialdrawer.model.interfaces.iconDrawable Loading Loading @@ -79,6 +80,7 @@ class K9Drawer(private val parent: MessageList, savedInstanceState: Bundle?) : K private var selectedTextColor: ColorStateList? = null private var selectedBackgroundColor: Int = 0 private var folderBadgeStyle: BadgeStyle? = null private var openedAccountUuid: String? = null private var openedFolderId: Long? = null val layout: DrawerLayout Loading Loading @@ -133,6 +135,7 @@ class K9Drawer(private val parent: MessageList, savedInstanceState: Bundle?) : K headerView.onAccountHeaderListener = { _, profile, _ -> val account = (profile as ProfileDrawerItem).tag as Account openedAccountUuid = account.uuid parent.openRealAccount(account) updateUserAccountsAndFolders(account) true Loading @@ -142,9 +145,9 @@ class K9Drawer(private val parent: MessageList, savedInstanceState: Bundle?) : K private fun setAccounts(accounts: List<Account>) { val photoUris = mutableSetOf<Uri>() val selectedAccountUuid = (headerView.activeProfile?.tag as? Account)?.uuid val oldSelectedBackgroundColor = selectedBackgroundColor var newActiveProfile: IProfile? = null val accountItems = accounts.map { account -> val drawerId = (account.accountNumber + 1 shl DRAWER_ACCOUNT_SHIFT).toLong() Loading Loading @@ -176,8 +179,9 @@ class K9Drawer(private val parent: MessageList, savedInstanceState: Bundle?) : K } } if (account.uuid == selectedAccountUuid) { if (account.uuid == openedAccountUuid) { initializeWithAccountColor(account) newActiveProfile = accountItem } accountItem Loading @@ -186,6 +190,10 @@ class K9Drawer(private val parent: MessageList, savedInstanceState: Bundle?) : K headerView.clear() headerView.addProfiles(*accountItems) newActiveProfile?.let { profile -> headerView.activeProfile = profile } if (oldSelectedBackgroundColor != selectedBackgroundColor) { // Recreate list of folders with updated account color setUserFolders(foldersViewModel.getFolderListLiveData().value) Loading Loading @@ -335,6 +343,13 @@ class K9Drawer(private val parent: MessageList, savedInstanceState: Bundle?) : K userFolderDrawerIds.clear() } fun selectAccount(accountUuid: String) { openedAccountUuid = accountUuid headerView.profiles?.firstOrNull { it.accountUuid == accountUuid }?.let { profile -> headerView.activeProfile = profile } } fun selectFolder(folderId: Long) { deselect() openedFolderId = folderId Loading Loading @@ -414,6 +429,9 @@ class K9Drawer(private val parent: MessageList, savedInstanceState: Bundle?) : K return ColorStateList(states, colors) } private val IProfile.accountUuid: String? get() = (this.tag as? Account)?.uuid companion object { // Bit shift for identifiers of user folders items, to leave space for other items private const val DRAWER_FOLDER_SHIFT: Int = 20 Loading Loading
app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt +1 −0 Original line number Diff line number Diff line Loading @@ -1488,6 +1488,7 @@ open class MessageList : private fun configureDrawer() { val drawer = drawer ?: return drawer.selectAccount(account!!.uuid) when { singleFolderMode -> drawer.selectFolder(search!!.folderIds[0]) // Don't select any item in the drawer because the Unified Inbox is displayed, but not listed in the drawer Loading
app/ui/legacy/src/main/java/com/fsck/k9/ui/K9Drawer.kt +20 −2 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import com.mikepenz.materialdrawer.model.DividerDrawerItem import com.mikepenz.materialdrawer.model.PrimaryDrawerItem import com.mikepenz.materialdrawer.model.ProfileDrawerItem import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem import com.mikepenz.materialdrawer.model.interfaces.IProfile import com.mikepenz.materialdrawer.model.interfaces.badgeText import com.mikepenz.materialdrawer.model.interfaces.descriptionText import com.mikepenz.materialdrawer.model.interfaces.iconDrawable Loading Loading @@ -79,6 +80,7 @@ class K9Drawer(private val parent: MessageList, savedInstanceState: Bundle?) : K private var selectedTextColor: ColorStateList? = null private var selectedBackgroundColor: Int = 0 private var folderBadgeStyle: BadgeStyle? = null private var openedAccountUuid: String? = null private var openedFolderId: Long? = null val layout: DrawerLayout Loading Loading @@ -133,6 +135,7 @@ class K9Drawer(private val parent: MessageList, savedInstanceState: Bundle?) : K headerView.onAccountHeaderListener = { _, profile, _ -> val account = (profile as ProfileDrawerItem).tag as Account openedAccountUuid = account.uuid parent.openRealAccount(account) updateUserAccountsAndFolders(account) true Loading @@ -142,9 +145,9 @@ class K9Drawer(private val parent: MessageList, savedInstanceState: Bundle?) : K private fun setAccounts(accounts: List<Account>) { val photoUris = mutableSetOf<Uri>() val selectedAccountUuid = (headerView.activeProfile?.tag as? Account)?.uuid val oldSelectedBackgroundColor = selectedBackgroundColor var newActiveProfile: IProfile? = null val accountItems = accounts.map { account -> val drawerId = (account.accountNumber + 1 shl DRAWER_ACCOUNT_SHIFT).toLong() Loading Loading @@ -176,8 +179,9 @@ class K9Drawer(private val parent: MessageList, savedInstanceState: Bundle?) : K } } if (account.uuid == selectedAccountUuid) { if (account.uuid == openedAccountUuid) { initializeWithAccountColor(account) newActiveProfile = accountItem } accountItem Loading @@ -186,6 +190,10 @@ class K9Drawer(private val parent: MessageList, savedInstanceState: Bundle?) : K headerView.clear() headerView.addProfiles(*accountItems) newActiveProfile?.let { profile -> headerView.activeProfile = profile } if (oldSelectedBackgroundColor != selectedBackgroundColor) { // Recreate list of folders with updated account color setUserFolders(foldersViewModel.getFolderListLiveData().value) Loading Loading @@ -335,6 +343,13 @@ class K9Drawer(private val parent: MessageList, savedInstanceState: Bundle?) : K userFolderDrawerIds.clear() } fun selectAccount(accountUuid: String) { openedAccountUuid = accountUuid headerView.profiles?.firstOrNull { it.accountUuid == accountUuid }?.let { profile -> headerView.activeProfile = profile } } fun selectFolder(folderId: Long) { deselect() openedFolderId = folderId Loading Loading @@ -414,6 +429,9 @@ class K9Drawer(private val parent: MessageList, savedInstanceState: Bundle?) : K return ColorStateList(states, colors) } private val IProfile.accountUuid: String? get() = (this.tag as? Account)?.uuid companion object { // Bit shift for identifiers of user folders items, to leave space for other items private const val DRAWER_FOLDER_SHIFT: Int = 20 Loading