Fix list selection corners
This commit is contained in:
@@ -28,6 +28,7 @@ class MangaSelectionDecoration(context: Context) : AbstractSelectionItemDecorati
|
||||
ColorUtils.blendARGB(strokeColor, context.getThemeColor(materialR.attr.colorSurface), 0.8f),
|
||||
0x74
|
||||
)
|
||||
private val defaultRadius = context.resources.getDimension(R.dimen.list_selector_corner)
|
||||
|
||||
init {
|
||||
hasBackground = false
|
||||
@@ -51,21 +52,24 @@ class MangaSelectionDecoration(context: Context) : AbstractSelectionItemDecorati
|
||||
bounds: RectF,
|
||||
state: RecyclerView.State,
|
||||
) {
|
||||
val radius = (child as? CardView)?.radius ?: 32f
|
||||
val isCard = child is CardView
|
||||
val radius = (child as? CardView)?.radius ?: defaultRadius
|
||||
paint.color = fillColor
|
||||
paint.style = Paint.Style.FILL
|
||||
canvas.drawRoundRect(bounds, radius, radius, paint)
|
||||
paint.color = strokeColor
|
||||
paint.style = Paint.Style.STROKE
|
||||
canvas.drawRoundRect(bounds, radius, radius, paint)
|
||||
checkIcon?.run {
|
||||
setBounds(
|
||||
(bounds.left + iconOffset).toInt(),
|
||||
(bounds.top + iconOffset).toInt(),
|
||||
(bounds.left + iconOffset + intrinsicWidth).toInt(),
|
||||
(bounds.top + iconOffset + intrinsicHeight).toInt(),
|
||||
)
|
||||
draw(canvas)
|
||||
if (isCard) {
|
||||
checkIcon?.run {
|
||||
setBounds(
|
||||
(bounds.left + iconOffset).toInt(),
|
||||
(bounds.top + iconOffset).toInt(),
|
||||
(bounds.left + iconOffset + intrinsicWidth).toInt(),
|
||||
(bounds.top + iconOffset + intrinsicHeight).toInt(),
|
||||
)
|
||||
draw(canvas)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@
|
||||
android:bottom="2dp"
|
||||
android:left="2dp">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="12dp" />
|
||||
<corners android:radius="@dimen/list_selector_corner" />
|
||||
<solid android:color="@color/selector_overlay" />
|
||||
</shape>
|
||||
</item>
|
||||
@@ -22,7 +22,7 @@
|
||||
android:bottom="2dp"
|
||||
android:left="2dp">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="12dp" />
|
||||
<corners android:radius="@dimen/list_selector_corner" />
|
||||
<solid android:color="@color/selector_overlay" />
|
||||
</shape>
|
||||
</item>
|
||||
@@ -32,7 +32,7 @@
|
||||
android:bottom="2dp"
|
||||
android:left="2dp">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="12dp" />
|
||||
<corners android:radius="@dimen/list_selector_corner" />
|
||||
<solid android:color="?android:attr/windowBackground" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
<dimen name="list_footer_height_outer">48dp</dimen>
|
||||
<dimen name="screen_padding">16dp</dimen>
|
||||
<dimen name="selection_stroke_width">2dp</dimen>
|
||||
<dimen name="list_selector_corner">12dp</dimen>
|
||||
|
||||
<dimen name="search_suggestions_manga_height">124dp</dimen>
|
||||
<dimen name="search_suggestions_manga_spacing">4dp</dimen>
|
||||
|
||||
Reference in New Issue
Block a user