diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt b/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt index b8ca57ad9a218de858ef49905639ebb2fa2b789c..d82501ae9f4c5e0e106710789a24ed86418d900a 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt @@ -120,7 +120,7 @@ open class MessageList : private val permissionUiHelper: PermissionUiHelper = K9PermissionUiHelper(this) - private lateinit var actionBar: ActionBar + private var actionBar: ActionBar? = null private lateinit var searchView: SearchView private var drawer: K9Drawer? = null private var openFolderTransaction: FragmentTransaction? = null @@ -587,7 +587,7 @@ open class MessageList : private fun initializeActionBar() { actionBar = supportActionBar!! - actionBar.setDisplayHomeAsUpEnabled(true) + actionBar?.setDisplayHomeAsUpEnabled(true) } private fun initializeDrawer(savedInstanceState: Bundle?) { @@ -1250,8 +1250,8 @@ open class MessageList : } fun setActionBarTitle(title: String, subtitle: String? = null) { - actionBar.title = title - actionBar.subtitle = subtitle + actionBar?.title = title + actionBar?.subtitle = subtitle } override fun setMessageListTitle(title: String, subtitle: String?) { @@ -1261,11 +1261,11 @@ open class MessageList : } override fun setMessageListProgressEnabled(enable: Boolean) { - progressBar!!.visibility = if (enable) View.VISIBLE else View.INVISIBLE + progressBar?.visibility = if (enable) View.VISIBLE else View.INVISIBLE } override fun setMessageListProgress(progress: Int) { - progressBar!!.progress = progress + progressBar?.progress = progress } override fun openMessage(messageReference: MessageReference) { @@ -1276,9 +1276,7 @@ open class MessageList : if (draftsFolderId != null && folderId == draftsFolderId) { MessageActions.actionEditDraft(this, messageReference) } else { - if (messageListFragment != null) { - messageListFragment!!.setActiveMessage(messageReference) - } + messageListFragment?.setActiveMessage(messageReference) val fragment = MessageViewFragment.newInstance(messageReference) val fragmentTransaction = supportFragmentManager.beginTransaction() @@ -1600,12 +1598,12 @@ open class MessageList : private fun lockDrawer() { drawer!!.lock() - actionBar.setHomeAsUpIndicator(R.drawable.ic_arrow_back) + actionBar?.setHomeAsUpIndicator(R.drawable.ic_arrow_back) } private fun unlockDrawer() { drawer!!.unlock() - actionBar.setHomeAsUpIndicator(getResId(R.attr.iconMenu)) + actionBar?.setHomeAsUpIndicator(getResId(R.attr.iconMenu)) } private fun initializeFromLocalSearch(search: LocalSearch?) {