From 8a05d8dde90554d8c0c75c6edfb013bddfe4b16b Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 2 Oct 2019 18:18:34 +0800 Subject: [PATCH] up --- .../io/legado/app/ui/widget/image/FilletImageView.kt | 9 +++++---- app/src/main/res/layout/item_rss.xml | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/widget/image/FilletImageView.kt b/app/src/main/java/io/legado/app/ui/widget/image/FilletImageView.kt index bb6a4461e..d1c50fb31 100644 --- a/app/src/main/java/io/legado/app/ui/widget/image/FilletImageView.kt +++ b/app/src/main/java/io/legado/app/ui/widget/image/FilletImageView.kt @@ -7,6 +7,7 @@ import android.graphics.Path import android.util.AttributeSet import androidx.appcompat.widget.AppCompatImageView import io.legado.app.R +import kotlin.math.max class FilletImageView : AppCompatImageView { internal var width: Float = 0.toFloat() @@ -62,11 +63,11 @@ class FilletImageView : AppCompatImageView { override fun onDraw(canvas: Canvas) { //这里做下判断,只有图片的宽高大于设置的圆角距离的时候才进行裁剪 - val maxLeft = Math.max(leftTopRadius, leftBottomRadius) - val maxRight = Math.max(rightTopRadius, rightBottomRadius) + val maxLeft = max(leftTopRadius, leftBottomRadius) + val maxRight = max(rightTopRadius, rightBottomRadius) val minWidth = maxLeft + maxRight - val maxTop = Math.max(leftTopRadius, rightTopRadius) - val maxBottom = Math.max(leftBottomRadius, rightBottomRadius) + val maxTop = max(leftTopRadius, rightTopRadius) + val maxBottom = max(leftBottomRadius, rightBottomRadius) val minHeight = maxTop + maxBottom if (width >= minWidth && height > minHeight) { @SuppressLint("DrawAllocation") val path = Path() diff --git a/app/src/main/res/layout/item_rss.xml b/app/src/main/res/layout/item_rss.xml index 1b55a8ed1..6cff479c7 100644 --- a/app/src/main/res/layout/item_rss.xml +++ b/app/src/main/res/layout/item_rss.xml @@ -9,6 +9,7 @@ android:id="@+id/iv_icon" android:layout_width="60dp" android:layout_height="60dp" + android:background="@color/colorPrimary" android:src="@drawable/ic_image" android:scaleType="centerCrop" app:layout_constraintTop_toTopOf="parent"