Commit bf58ddf5 authored by yinjiacheng's avatar yinjiacheng

update 商品列表图片加载逻辑

parent fc62b35f
......@@ -58,21 +58,6 @@ class CommodityListAdapter(private val context: Context, private val status: Com
.apply(RequestOptions().transform(CenterCrop(), RoundedCorners(DensityUtil.dp2px(corner.toFloat()))))
.into(target)
}
/**
* 加载圆角图片
* @param urlList 图片urlList
* @param corner 圆角值
* @param target 目标ImageView
*/
@BindingAdapter(value = ["urlList", "corner"], requireAll = true)
@JvmStatic
fun loadRoundCornerImage(target: ImageView, urlList: List<String>, corner: Int = 12) {
if (urlList.isEmpty()) return
Glide.with(target.context).load(urlList[0])
.apply(RequestOptions().transform(CenterCrop(), RoundedCorners(DensityUtil.dp2px(corner.toFloat()))))
.into(target)
}
}
/**
......
......@@ -26,10 +26,11 @@
android:id="@+id/iv_commodity_pic"
android:layout_width="@dimen/dp80"
android:layout_height="@dimen/dp80"
android:scaleType="centerCrop"
app:corner="@{12}"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:urlList="@{data.descPicUrlList}"
app:url="@{data.descPicUrlList[0]}"
tools:src="@mipmap/news_icon" />
<TextView
......
......@@ -26,10 +26,11 @@
android:id="@+id/iv_commodity_pic"
android:layout_width="@dimen/dp80"
android:layout_height="@dimen/dp80"
android:scaleType="centerCrop"
app:corner="@{12}"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:urlList="@{data.descPicUrlList}"
app:url="@{data.descPicUrlList[0]}"
tools:src="@mipmap/news_icon" />
<TextView
......
......@@ -26,10 +26,11 @@
android:id="@+id/iv_commodity_pic"
android:layout_width="@dimen/dp80"
android:layout_height="@dimen/dp80"
android:scaleType="centerCrop"
app:corner="@{12}"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:urlList="@{data.descPicUrlList}"
app:url="@{data.descPicUrlList[0]}"
tools:src="@mipmap/news_icon" />
<TextView
......
......@@ -26,10 +26,11 @@
android:id="@+id/iv_commodity_pic"
android:layout_width="@dimen/dp80"
android:layout_height="@dimen/dp80"
android:scaleType="centerCrop"
app:corner="@{12}"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:urlList="@{data.descPicUrlList}"
app:url="@{data.descPicUrlList[0]}"
tools:src="@mipmap/news_icon" />
<TextView
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment