[android, gameProperties] Use StaggeredGrid instead stead of Grid layout for cards (#2781)

Fixes weird behavior with new secondary action chips.

Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2781
Co-authored-by: Inix <Nixy01@proton.me>
Co-committed-by: Inix <Nixy01@proton.me>
This commit is contained in:
Inix 2025-10-20 06:46:31 +02:00 committed by crueter
parent 54d6283ac3
commit 0eeeee515e
No known key found for this signature in database
GPG key ID: 425ACD2D4830EBC6

View file

@ -22,7 +22,7 @@ import androidx.fragment.app.activityViewModels
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import androidx.navigation.findNavController import androidx.navigation.findNavController
import androidx.navigation.fragment.navArgs import androidx.navigation.fragment.navArgs
import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.StaggeredGridLayoutManager
import com.google.android.material.transition.MaterialSharedAxis import com.google.android.material.transition.MaterialSharedAxis
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
@ -457,8 +457,14 @@ class GamePropertiesFragment : Fragment() {
} }
} }
binding.listProperties.apply { binding.listProperties.apply {
layoutManager = val spanCount = resources.getInteger(R.integer.grid_columns)
GridLayoutManager(requireContext(), resources.getInteger(R.integer.grid_columns)) val staggered = StaggeredGridLayoutManager(
spanCount,
StaggeredGridLayoutManager.VERTICAL
).apply {
gapStrategy = StaggeredGridLayoutManager.GAP_HANDLING_MOVE_ITEMS_BETWEEN_SPANS
}
layoutManager = staggered
adapter = GamePropertiesAdapter(viewLifecycleOwner, properties) adapter = GamePropertiesAdapter(viewLifecycleOwner, properties)
} }
} }