Fix padding for exts/migration sheet

This commit is contained in:
Jays2Kings 2021-03-31 16:37:55 -04:00
parent 214a4d2e5a
commit 7be208d630
2 changed files with 8 additions and 4 deletions

View File

@ -31,6 +31,7 @@ import eu.kanade.tachiyomi.util.view.collapse
import eu.kanade.tachiyomi.util.view.doOnApplyWindowInsets import eu.kanade.tachiyomi.util.view.doOnApplyWindowInsets
import eu.kanade.tachiyomi.util.view.expand import eu.kanade.tachiyomi.util.view.expand
import eu.kanade.tachiyomi.util.view.isExpanded import eu.kanade.tachiyomi.util.view.isExpanded
import eu.kanade.tachiyomi.util.view.updatePaddingRelative
import eu.kanade.tachiyomi.util.view.withFadeTransaction import eu.kanade.tachiyomi.util.view.withFadeTransaction
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
@ -91,8 +92,8 @@ class ExtensionBottomSheet @JvmOverloads constructor(context: Context, attrs: At
this.controller = controller this.controller = controller
binding.pager.doOnApplyWindowInsets { _, _, _ -> binding.pager.doOnApplyWindowInsets { _, _, _ ->
val bottomBar = controller.activityBinding?.bottomNav val bottomBar = controller.activityBinding?.bottomNav
// extRecyler?.updatePaddingRelative(bottom = bottomBar?.height ?: 0) extensionFrameLayout?.binding?.recycler?.updatePaddingRelative(bottom = bottomBar?.height ?: 0)
// migRecyler?.updatePaddingRelative(bottom = bottomBar?.height ?: 0) migrationFrameLayout?.binding?.recycler?.updatePaddingRelative(bottom = bottomBar?.height ?: 0)
} }
binding.tabs.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener { binding.tabs.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener {
override fun onTabSelected(tab: TabLayout.Tab?) { override fun onTabSelected(tab: TabLayout.Tab?) {
@ -322,7 +323,8 @@ class ExtensionBottomSheet @JvmOverloads constructor(context: Context, attrs: At
override fun createView(container: ViewGroup): View { override fun createView(container: ViewGroup): View {
val binding = RecyclerWithScrollerBinding.inflate(LayoutInflater.from(container.context), container, false) val binding = RecyclerWithScrollerBinding.inflate(LayoutInflater.from(container.context), container, false)
val view: RecyclerWithScrollerView = binding.root val view: RecyclerWithScrollerView = binding.root
view.setUp(this@ExtensionBottomSheet, binding) view.setUp(this@ExtensionBottomSheet, binding, this@ExtensionBottomSheet.controller.activityBinding?.bottomNav?.height ?: 0)
return view return view
} }

View File

@ -6,15 +6,17 @@ import android.widget.FrameLayout
import eu.davidea.flexibleadapter.FlexibleAdapter import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.davidea.flexibleadapter.items.IFlexible import eu.davidea.flexibleadapter.items.IFlexible
import eu.kanade.tachiyomi.databinding.RecyclerWithScrollerBinding import eu.kanade.tachiyomi.databinding.RecyclerWithScrollerBinding
import eu.kanade.tachiyomi.util.view.updatePaddingRelative
class RecyclerWithScrollerView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : class RecyclerWithScrollerView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
FrameLayout(context, attrs) { FrameLayout(context, attrs) {
var binding: RecyclerWithScrollerBinding? = null var binding: RecyclerWithScrollerBinding? = null
fun setUp(sheet: ExtensionBottomSheet, binding: RecyclerWithScrollerBinding) { fun setUp(sheet: ExtensionBottomSheet, binding: RecyclerWithScrollerBinding, height: Int) {
binding.recycler.layoutManager = androidx.recyclerview.widget.LinearLayoutManager(context) binding.recycler.layoutManager = androidx.recyclerview.widget.LinearLayoutManager(context)
binding.recycler.setHasFixedSize(true) binding.recycler.setHasFixedSize(true)
binding.recycler.addItemDecoration(ExtensionDividerItemDecoration(context)) binding.recycler.addItemDecoration(ExtensionDividerItemDecoration(context))
binding.recycler.updatePaddingRelative(bottom = height)
this.binding = binding this.binding = binding
} }