Skip to content
Snippets Groups Projects
Commit d50c2aed authored by Adrien Béraud's avatar Adrien Béraud
Browse files

misc: add missing null checks

Change-Id: Ie99c118b1a9584aa8f65b54c022b36e68468b954
parent 0e9035ec
No related branches found
No related tags found
Loading
......@@ -160,7 +160,7 @@ class HomeActivity : AppCompatActivity(), Colorable, ContactPickerFragment.OnCon
}
WindowCompat.setDecorFitsSystemWindows(window, false)
mHomeFragment = supportFragmentManager.findFragmentById(R.id.home_fragment) as HomeFragment
mHomeFragment = supportFragmentManager.findFragmentById(R.id.home_fragment) as? HomeFragment?
frameContent = supportFragmentManager.findFragmentById(fragmentContainerId)
supportFragmentManager.addOnBackStackChangedListener {
frameContent = supportFragmentManager.findFragmentById(fragmentContainerId)
......@@ -169,7 +169,7 @@ class HomeActivity : AppCompatActivity(), Colorable, ContactPickerFragment.OnCon
mBinding!!.frame.isVisible = true
}
fConversation = supportFragmentManager.findFragmentByTag(ConversationFragment::class.java.simpleName) as ConversationFragment?
fConversation = supportFragmentManager.findFragmentByTag(ConversationFragment::class.java.simpleName) as? ConversationFragment?
if (fConversation != null) {
Log.w(TAG, "Restore conversation fragment $fConversation")
conversationBackPressedCallback.isEnabled = true
......@@ -180,7 +180,6 @@ class HomeActivity : AppCompatActivity(), Colorable, ContactPickerFragment.OnCon
}
onBackPressedDispatcher.addCallback(this, conversationBackPressedCallback)
handleIntent(intent)
}
override fun onDestroy() {
......
......@@ -777,22 +777,24 @@ class ConversationFragment : BaseSupportFragment<ConversationPresenter, Conversa
val searchMenuItem = menu.findItem(R.id.conv_search)
searchMenuItem.setOnActionExpandListener(object : MenuItem.OnActionExpandListener {
override fun onMenuItemActionCollapse(item: MenuItem): Boolean {
val binding = binding ?: return false
presenter.stopSearch()
binding!!.histList.adapter = mAdapter
binding.histList.adapter = mAdapter
updateListPadding()
currentBottomView?.isVisible = true
if (animation.isStarted) animation.cancel()
animation.setIntValues(binding!!.histList.paddingBottom, currentBottomView!!.height + marginPxTotal)
animation.setIntValues(binding.histList.paddingBottom, currentBottomView!!.height + marginPxTotal)
animation.start()
return true
}
override fun onMenuItemActionExpand(item: MenuItem): Boolean {
val binding = binding ?: return false
mSearchAdapter = ConversationAdapter(this@ConversationFragment, presenter)
presenter.startSearch()
currentBottomView?.isVisible = false
binding!!.histList.adapter = mSearchAdapter
binding.histList.adapter = mSearchAdapter
if (animation.isStarted) animation.cancel()
animation.setIntValues(binding!!.histList.paddingBottom, marginPxTotal)
animation.setIntValues(binding.histList.paddingBottom, marginPxTotal)
animation.start()
return true
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment