Never display folders when showing the Unified Inbox

This commit is contained in:
cketti 2019-12-01 18:05:16 +01:00
parent 89128fbd62
commit b23be23efb

View file

@ -193,7 +193,7 @@ class K9Drawer(private val parent: MessageList, savedInstanceState: Bundle?) : K
val viewModelProvider = ViewModelProviders.of(parent, MessageListViewModelFactory())
val viewModel = viewModelProvider.get(MessageListViewModel::class.java)
foldersLiveData?.removeObserver(foldersObserver)
removeFoldersObserver()
foldersLiveData = viewModel.getFolders(account).apply {
observe(parent, foldersObserver)
}
@ -202,6 +202,11 @@ class K9Drawer(private val parent: MessageList, savedInstanceState: Bundle?) : K
}
}
private fun removeFoldersObserver() {
foldersLiveData?.removeObserver(foldersObserver)
foldersLiveData = null
}
private fun updateFolderSettingsItem() {
val drawerItem = drawer.getDrawerItem(DRAWER_ID_FOLDERS)!!
drawerItem.isEnabled = !unifiedInboxSelected
@ -297,6 +302,7 @@ class K9Drawer(private val parent: MessageList, savedInstanceState: Bundle?) : K
selectedColor = 0
accountHeader.setActiveProfile(DRAWER_ID_UNIFIED_INBOX)
accountHeader.headerBackgroundView.setColorFilter(0xFFFFFFFFL.toInt(), PorterDuff.Mode.MULTIPLY)
removeFoldersObserver()
clearUserFolders()
updateFolderSettingsItem()
}