Fix scroll views for tabbed bottom sheets

This commit is contained in:
Jays2Kings 2021-03-30 14:24:03 -04:00
parent e28a12161a
commit 4999231dfc

View File

@ -44,6 +44,11 @@ abstract class TabbedBottomSheetDialog(private val activity: Activity) :
super.onStart() super.onStart()
sheetBehavior.skipCollapsed = true sheetBehavior.skipCollapsed = true
sheetBehavior.expand() sheetBehavior.expand()
getTabViews().forEachIndexed { index, nestedScrollView ->
val view = nestedScrollView as? NestedScrollView
view?.isNestedScrollingEnabled = binding.pager.currentItem == index
view?.requestLayout()
}
binding.tabs.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener { binding.tabs.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener {
override fun onTabSelected(tab: TabLayout.Tab?) { override fun onTabSelected(tab: TabLayout.Tab?) {
val view = getTabViews()[tab?.position ?: 0] as? NestedScrollView val view = getTabViews()[tab?.position ?: 0] as? NestedScrollView