Add padding to recycler
This commit is contained in:
parent
7e85c9f792
commit
9c27715464
2 changed files with 5 additions and 5 deletions
|
@ -39,7 +39,7 @@ abstract class CommonLevelFragment(@LayoutRes val contentLayoutId: Int) : Fragme
|
|||
recyclerGrid.apply {
|
||||
val horizontalPadding = calcHorizontalPadding(view, levelSetup.width)
|
||||
val verticalPadding = calcVerticalPadding(view, levelSetup.height)
|
||||
setPadding(horizontalPadding, verticalPadding, 0, 0)
|
||||
setPadding(horizontalPadding, verticalPadding, horizontalPadding, verticalPadding)
|
||||
layoutManager = makeNewLayoutManager(levelSetup.width)
|
||||
adapter = areaAdapter
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ abstract class CommonLevelFragment(@LayoutRes val contentLayoutId: Int) : Fragme
|
|||
val width = view.measuredWidth
|
||||
val recyclerViewWidth = (dimensionRepository.areaSize() * boardWidth)
|
||||
val separatorsWidth = (dimensionRepository.areaSeparator() * (boardWidth + 2))
|
||||
return ((width - recyclerViewWidth - separatorsWidth) / 2).coerceAtLeast(0.0f).nextDown().toInt()
|
||||
return ((width - recyclerViewWidth - separatorsWidth) / 2).coerceAtLeast(dimensionRepository.areaSize()).nextDown().toInt()
|
||||
}
|
||||
|
||||
private fun calcVerticalPadding(view: View, boardHeight: Int): Int {
|
||||
|
@ -60,7 +60,7 @@ abstract class CommonLevelFragment(@LayoutRes val contentLayoutId: Int) : Fragme
|
|||
val recyclerViewHeight = (dimensionRepository.areaSize() * boardHeight)
|
||||
val separatorsHeight = (2 * dimensionRepository.areaSeparator() * (boardHeight - 1))
|
||||
val calculatedHeight = (height - recyclerViewHeight - separatorsHeight - adsHeight)
|
||||
return ((calculatedHeight / 2) - adsHeight).coerceAtLeast(0.0f).toInt()
|
||||
return ((calculatedHeight / 2) - adsHeight).coerceAtLeast(dimensionRepository.areaSize()).toInt()
|
||||
}
|
||||
|
||||
open fun dpFromPx(context: Context, px: Float): Int {
|
||||
|
|
|
@ -565,7 +565,7 @@ class FixedGridLayoutManager : RecyclerView.LayoutManager() {
|
|||
// Check right bound
|
||||
if (rightBoundReached) {
|
||||
// If we've reached the last column, enforce limits
|
||||
val rightOffset = horizontalSpace - getDecoratedRight(bottomView) + paddingRight
|
||||
val rightOffset = horizontalSpace - getDecoratedRight(bottomView) - paddingRight
|
||||
(-dx).coerceAtLeast(rightOffset)
|
||||
} else {
|
||||
// No limits while the last column isn't visible
|
||||
|
@ -648,7 +648,7 @@ class FixedGridLayoutManager : RecyclerView.LayoutManager() {
|
|||
val bottomOffset: Int =
|
||||
if (rowOfIndex(childCount - 1) >= maxRowCount - 1) {
|
||||
// We are truly at the bottom, determine how far
|
||||
verticalSpace - getDecoratedBottom(bottomView) +
|
||||
verticalSpace - getDecoratedBottom(bottomView) -
|
||||
paddingBottom
|
||||
} else {
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue