Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9cfc3cf9 authored by Michael Enoma's avatar Michael Enoma
Browse files

The drawer now uses two adapters for the account list and the folder list. So...

The drawer now uses two adapters for the account list and the folder list. So there's no need to keep the ID space separate.
parent b8051992
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -263,7 +263,6 @@ class K9Drawer(private val parent: MessageList, savedInstanceState: Bundle?) : K
        var newActiveProfile: IProfile? = null
        val accountItems = displayAccounts.map { displayAccount ->
            val account = displayAccount.account
            val drawerId = (account.accountNumber + 1 shl DRAWER_ACCOUNT_SHIFT).toLong()

            val drawerColors = getDrawerColorsForAccount(account)
            val selectedTextColor = drawerColors.accentColor.toSelectedColorStateList()
@@ -272,7 +271,7 @@ class K9Drawer(private val parent: MessageList, savedInstanceState: Bundle?) : K
                isNameShown = true
                nameText = account.description ?: ""
                descriptionText = account.email
                identifier = drawerId
                identifier = account.drawerId
                tag = account
                textColor = selectedTextColor
                descriptionTextColor = selectedTextColor
@@ -314,7 +313,7 @@ class K9Drawer(private val parent: MessageList, savedInstanceState: Bundle?) : K
    fun updateUserAccountsAndFolders(account: Account?) {
        if (account != null) {
            initializeWithAccountColor(account)
            headerView.setActiveProfile((account.accountNumber + 1 shl DRAWER_ACCOUNT_SHIFT).toLong())
            headerView.setActiveProfile(account.drawerId)
            foldersViewModel.loadFolders(account)
        }

@@ -530,6 +529,9 @@ class K9Drawer(private val parent: MessageList, savedInstanceState: Bundle?) : K
    private val IProfile.accountUuid: String?
        get() = (this.tag as? Account)?.uuid

    private val Account.drawerId: Long
        get() = (accountNumber + 1).toLong()

    companion object {
        // Bit shift for identifiers of user folders items, to leave space for other items
        private const val DRAWER_FOLDER_SHIFT: Int = 20