Fix possible crashes
This commit is contained in:
@@ -59,12 +59,12 @@ abstract class BaseActivity<B : ViewBinding> : AppCompatActivity(), OnApplyWindo
|
|||||||
this.binding = binding
|
this.binding = binding
|
||||||
super.setContentView(binding.root)
|
super.setContentView(binding.root)
|
||||||
(binding.root.findViewById<View>(R.id.toolbar) as? Toolbar)?.let(this::setSupportActionBar)
|
(binding.root.findViewById<View>(R.id.toolbar) as? Toolbar)?.let(this::setSupportActionBar)
|
||||||
val params = (binding.root.findViewById<View>(R.id.toolbar) as? Toolbar)?.layoutParams as AppBarLayout.LayoutParams
|
val params = (binding.root.findViewById<View>(R.id.toolbar) as? Toolbar)?.layoutParams as? AppBarLayout.LayoutParams
|
||||||
ViewCompat.setOnApplyWindowInsetsListener(binding.root, this)
|
ViewCompat.setOnApplyWindowInsetsListener(binding.root, this)
|
||||||
if (get<AppSettings>().isToolbarHideWhenScrolling) {
|
if (get<AppSettings>().isToolbarHideWhenScrolling) {
|
||||||
params.scrollFlags = SCROLL_FLAG_SCROLL or SCROLL_FLAG_ENTER_ALWAYS
|
params?.scrollFlags = SCROLL_FLAG_SCROLL or SCROLL_FLAG_ENTER_ALWAYS
|
||||||
} else {
|
} else {
|
||||||
params.scrollFlags = SCROLL_FLAG_NO_SCROLL
|
params?.scrollFlags = SCROLL_FLAG_NO_SCROLL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user