Commit 49623cab authored by yinjiacheng's avatar yinjiacheng

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

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