home: move speed dial touch setup to onStart

If we don't do this, the views won't be there and the app will crash
in some circumstances.

Resolves #701.
This commit is contained in:
Alexander Capehart 2024-02-17 12:05:19 -07:00
parent fb531c8adc
commit eb3c320523
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47

View file

@ -148,19 +148,6 @@ class HomeFragment :
// --- UI SETUP --- // --- UI SETUP ---
// Stock bottom sheet overlay won't work with our nested UI setup, have to replicate
// it ourselves.
binding.root.rootView.apply {
post {
findViewById<View>(R.id.main_scrim).setOnTouchListener { _, event ->
handleSpeedDialBoundaryTouch(event)
}
findViewById<View>(R.id.sheet_scrim).setOnTouchListener { _, event ->
handleSpeedDialBoundaryTouch(event)
}
}
}
binding.homeAppbar.addOnOffsetChangedListener(this) binding.homeAppbar.addOnOffsetChangedListener(this)
binding.homeNormalToolbar.apply { binding.homeNormalToolbar.apply {
setOnMenuItemClickListener(this@HomeFragment) setOnMenuItemClickListener(this@HomeFragment)
@ -235,6 +222,23 @@ class HomeFragment :
collect(detailModel.toShow.flow, ::handleShow) collect(detailModel.toShow.flow, ::handleShow)
} }
override fun onStart() {
super.onStart()
// Stock bottom sheet overlay won't work with our nested UI setup, have to replicate
// it ourselves.
requireBinding().root.rootView.apply {
post {
findViewById<View>(R.id.main_scrim).setOnTouchListener { _, event ->
handleSpeedDialBoundaryTouch(event)
}
findViewById<View>(R.id.sheet_scrim).setOnTouchListener { _, event ->
handleSpeedDialBoundaryTouch(event)
}
}
}
}
override fun onSaveInstanceState(outState: Bundle) { override fun onSaveInstanceState(outState: Bundle) {
val transition = enterTransition val transition = enterTransition
if (transition is MaterialSharedAxis) { if (transition is MaterialSharedAxis) {