mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-04-10 03:18:55 +02:00
fixed landscape right column top spacing
This commit is contained in:
parent
94906f89d7
commit
87e3bcce13
1 changed files with 14 additions and 2 deletions
|
|
@ -1,10 +1,11 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
||||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
package org.yuzu.yuzu_emu.features.fetcher
|
||||
|
||||
import android.graphics.Rect
|
||||
import android.view.View
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
|
||||
class SpacingItemDecoration(private val spacing: Int) : RecyclerView.ItemDecoration() {
|
||||
|
|
@ -14,8 +15,19 @@ class SpacingItemDecoration(private val spacing: Int) : RecyclerView.ItemDecorat
|
|||
parent: RecyclerView,
|
||||
state: RecyclerView.State
|
||||
) {
|
||||
val position = parent.getChildAdapterPosition(view)
|
||||
if (position == RecyclerView.NO_POSITION) {
|
||||
return
|
||||
}
|
||||
|
||||
outRect.bottom = spacing
|
||||
if (parent.getChildAdapterPosition(view) == 0) {
|
||||
val layoutManager = parent.layoutManager
|
||||
val isFirstRow = if (layoutManager is GridLayoutManager) {
|
||||
layoutManager.spanSizeLookup.getSpanGroupIndex(position, layoutManager.spanCount) == 0
|
||||
} else {
|
||||
position == 0
|
||||
}
|
||||
if (isFirstRow) {
|
||||
outRect.top = spacing
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue