diff --git a/common/src/main/java/dev/lucasnlm/antimine/common/level/view/CommonLevelFragment.kt b/common/src/main/java/dev/lucasnlm/antimine/common/level/view/CommonLevelFragment.kt index cef5f232..a427f5c1 100644 --- a/common/src/main/java/dev/lucasnlm/antimine/common/level/view/CommonLevelFragment.kt +++ b/common/src/main/java/dev/lucasnlm/antimine/common/level/view/CommonLevelFragment.kt @@ -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 { diff --git a/common/src/main/java/dev/lucasnlm/antimine/common/level/widget/FixedGridLayoutManager.kt b/common/src/main/java/dev/lucasnlm/antimine/common/level/widget/FixedGridLayoutManager.kt index 315eb066..f3aec2a7 100644 --- a/common/src/main/java/dev/lucasnlm/antimine/common/level/widget/FixedGridLayoutManager.kt +++ b/common/src/main/java/dev/lucasnlm/antimine/common/level/widget/FixedGridLayoutManager.kt @@ -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 { /*