Commit 49623cab authored by yinjiacheng's avatar yinjiacheng

update 订单详情商品信息无商品图片UI

parent 2b9e9b7a
package com.yidian.shenghuoquan.buserorder.viewmodel
import android.view.View
import android.widget.ImageView
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.databinding.BindingAdapter
import com.bumptech.glide.Glide
import com.bumptech.glide.load.resource.bitmap.CenterCrop
......@@ -35,5 +37,13 @@ class OrderDetailCommodityListItemViewModel : BaseViewModel() {
)
.into(target)
}
@JvmStatic
@BindingAdapter("layout_marginStart")
fun setMarginStart(view: View, margin: Int) {
val lp = view.layoutParams as ConstraintLayout.LayoutParams
lp.marginStart = DensityUtil.dp2px(margin.toFloat())
view.layoutParams = lp
}
}
}
......@@ -5,6 +5,8 @@
<data>
<import type="android.view.View" />
<variable
name="vm"
type="com.yidian.shenghuoquan.buserorder.viewmodel.OrderDetailCommodityListItemViewModel" />
......@@ -22,6 +24,7 @@
android:id="@+id/iv_commodity_pic"
android:layout_width="@dimen/dp82"
android:layout_height="@dimen/dp60"
android:visibility="@{data.descPicUrl.size() > 0 ? View.VISIBLE : View.GONE}"
app:commodityImageUrl='@{data.descPicUrl.size() > 0 ? data.descPicUrl.get(0) : ""}'
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
......@@ -31,7 +34,6 @@
android:id="@+id/tv_commodity_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp8"
android:ellipsize="end"
android:includeFontPadding="false"
android:maxLines="1"
......@@ -40,6 +42,7 @@
android:textSize="@dimen/sp15"
app:layout_constraintStart_toEndOf="@id/iv_commodity_pic"
app:layout_constraintTop_toTopOf="parent"
app:layout_marginStart="@{ivCommodityPic.visibility == View.VISIBLE ? 8 : 0}"
tools:text="肉末茄子+蔬蒸蛋套餐+肉末茄…" />
<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