mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-04 23:55:08 +01:00
Make layout selectable for grid items
The entire layout is now selectable for grid items rather than just the card, this greatly increases the visibility of the selection when not in touch mode as the contrast of a darken effect on the icon can be minimal depending on how dark the icon already is.
This commit is contained in:
parent
1d070e6332
commit
bac7c526ef
@ -94,10 +94,13 @@ class AppViewItem(var layoutType : LayoutType, private val item : AppItem, priva
|
||||
binding.icon.setOnClickListener { showIconDialog(it.context, item) }
|
||||
}
|
||||
|
||||
binding.root.findViewById<View>(R.id.item_click_layout).apply {
|
||||
setOnClickListener { onClick.invoke(item) }
|
||||
setOnLongClickListener { true.also { onLongClick.invoke(item) } }
|
||||
val handleClicks = { view : View ->
|
||||
view.setOnClickListener { onClick.invoke(item) }
|
||||
view.setOnLongClickListener { true.also { onLongClick.invoke(item) } }
|
||||
}
|
||||
|
||||
handleClicks(binding.root.findViewById(R.id.item_click_layout))
|
||||
binding.root.findViewById<View>(R.id.item_card)?.let { handleClicks(it) }
|
||||
}
|
||||
|
||||
private fun showIconDialog(context : Context, appItem : AppItem) {
|
||||
|
@ -0,0 +1,9 @@
|
||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="?colorControlHighlight">
|
||||
<item android:id="@android:id/mask">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="9dp" />
|
||||
<solid android:color="@android:color/black" />
|
||||
</shape>
|
||||
</item>
|
||||
</ripple>
|
@ -2,19 +2,18 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/item_click_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:foreground="?attr/selectableItemBackground"
|
||||
android:focusable="true"
|
||||
android:foreground="@drawable/rounded_selectable_item_background"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/item_click_layout"
|
||||
android:id="@+id/item_card"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_margin="10dp"
|
||||
app:cardCornerRadius="16dp"
|
||||
app:cardElevation="2dp">
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user