Using with for recycler in library

This commit is contained in:
Jays2Kings 2021-04-19 16:11:39 -04:00
parent d45d3014f4
commit d731027b2e

View File

@ -784,23 +784,27 @@ class LibraryController(
} }
private fun setRecyclerLayout() { private fun setRecyclerLayout() {
binding.libraryGridRecycler.recycler.post { with(binding.libraryGridRecycler.recycler) {
binding.libraryGridRecycler.recycler.updatePaddingRelative(bottom = 50.dpToPx + (activityBinding?.bottomNav?.height ?: 0)) post {
updatePaddingRelative(
bottom = 50.dpToPx + (activityBinding?.bottomNav?.height ?: 0)
)
} }
if (libraryLayout == 0) { if (libraryLayout == 0) {
binding.libraryGridRecycler.recycler.spanCount = 1 spanCount = 1
binding.libraryGridRecycler.recycler.updatePaddingRelative( updatePaddingRelative(
start = 0, start = 0,
end = 0 end = 0
) )
} else { } else {
binding.libraryGridRecycler.recycler.setGridSize(preferences) setGridSize(preferences)
binding.libraryGridRecycler.recycler.updatePaddingRelative( updatePaddingRelative(
start = 5.dpToPx, start = 5.dpToPx,
end = 5.dpToPx end = 5.dpToPx
) )
} }
} }
}
private fun setPreferenceFlows() { private fun setPreferenceFlows() {
listOf( listOf(