Преглед на файлове

设置首页的Adapter到ViewModel,使用DataBinding解决卡顿问题

liukai преди 2 години
родител
ревизия
b65928360d

+ 51 - 0
cpt_main/src/main/java/com/hongyegroup/cpt_main/mvvm/HomeViewModel.kt

@@ -1,7 +1,12 @@
 package com.hongyegroup.cpt_main.mvvm
 
+import android.annotation.SuppressLint
 import androidx.lifecycle.SavedStateHandle
+import com.guadou.cs_cptservices.adapter.BannerGlobalAdapter
+import com.guadou.cs_cptservices.binding.BaseDataBindingAdapter
 import com.guadou.lib_baselib.base.vm.BaseViewModel
+import com.hongyegroup.cpt_main.BR
+import com.hongyegroup.cpt_main.R
 import dagger.hilt.android.lifecycle.HiltViewModel
 import javax.inject.Inject
 
@@ -10,4 +15,50 @@ class HomeViewModel @Inject constructor(
     private val savedStateHandle: SavedStateHandle
 ) : BaseViewModel() {
 
+    private val hotJobs = mutableListOf<String>()
+    private val cityJobs = mutableListOf<String>()
+    private val areaJobs = mutableListOf<String>()
+    private val jobTips = mutableListOf<String>()
+    private val imgUrls = mutableListOf<String>()
+
+    val mHotJobAdapter by lazy { BaseDataBindingAdapter(R.layout.item_home_part_time_job, BR.item, hotJobs) }
+    val mCityJobAdapter by lazy { BaseDataBindingAdapter(R.layout.item_home_part_time_job, BR.item, cityJobs) }
+    val mAreaJobAdapter by lazy { BaseDataBindingAdapter(R.layout.item_home_part_time_job, BR.item, areaJobs) }
+    val mJobTipsAdapter by lazy { BaseDataBindingAdapter(R.layout.item_home_job_tips, BR.item, jobTips) }
+    val mBannerAdapter by lazy { BannerGlobalAdapter(imgUrls) }
+
+
+    @SuppressLint("NotifyDataSetChanged")
+    fun setupDataes() {
+        hotJobs.clear()
+        for (i in 1..6) {
+            hotJobs.add("http://malaysia-yyjobs-admin-dev.guabean.com/storage/202206/09/9NdPaX0fB66dFc4SMuR2kIqLDiJcVGjTW6vZ9hUu-690x410.png")
+        }
+        mHotJobAdapter.notifyDataSetChanged()
+
+        cityJobs.clear()
+        for (i in 1..4) {
+            cityJobs.add("http://malaysia-yyjobs-admin-dev.guabean.com/storage/202206/09/9NdPaX0fB66dFc4SMuR2kIqLDiJcVGjTW6vZ9hUu-690x410.png")
+        }
+        mCityJobAdapter.notifyDataSetChanged()
+
+        areaJobs.clear()
+        for (i in 1..5) {
+            areaJobs.add("http://malaysia-yyjobs-admin-dev.guabean.com/storage/202206/09/9NdPaX0fB66dFc4SMuR2kIqLDiJcVGjTW6vZ9hUu-690x410.png")
+        }
+        mAreaJobAdapter.notifyDataSetChanged()
+
+        jobTips.clear()
+        for (i in 1..4) {
+            jobTips.add("http://malaysia-yyjobs-admin-dev.guabean.com/storage/202206/09/9NdPaX0fB66dFc4SMuR2kIqLDiJcVGjTW6vZ9hUu-690x410.png")
+        }
+        mJobTipsAdapter.notifyDataSetChanged()
+
+        imgUrls.clear()
+        imgUrls.add("http://yyjobs-admin-dev.guabean.com/storage/202206/21/5Kg5pL4lKlUkOijrntMucMw4CgbDMJbQ8ZfTXWjU-750x320.png")
+        imgUrls.add("http://yyjobs-admin-dev.guabean.com/storage/202205/31/VX8sQRRgDXCC9nReU9hFx7Hhxg0karC1tQrWH74S-750x320.png")
+        imgUrls.add("http://yyjobs-admin-dev.guabean.com/storage/202207/05/i049TYZ9GTf2BJ0jtc7cwa9zq7gtJGJhiVaUzcyB-1563x667.png")
+        mBannerAdapter.notifyDataSetChanged()
+
+    }
 }

+ 41 - 82
cpt_main/src/main/java/com/hongyegroup/cpt_main/ui/HomeFragment.kt

@@ -2,16 +2,11 @@ package com.hongyegroup.cpt_main.ui
 
 import android.os.Bundle
 import android.view.View
-import android.widget.ImageView
-import com.guadou.cs_cptservices.adapter.BannerGlobalAdapter
 import com.guadou.cs_cptservices.adapter.BannerRectangleCircleIndicator
 import com.guadou.cs_cptservices.base.fragment.YYBaseVDBLoadingFragment
 import com.guadou.cs_cptservices.interfaces.IFragmentRefresh
 import com.guadou.lib_baselib.bean.DataBindingConfig
-import com.guadou.lib_baselib.engine.extLoad
 import com.guadou.lib_baselib.engine.toast
-import com.guadou.lib_baselib.ext.bindData
-import com.guadou.lib_baselib.ext.click
 import com.guadou.lib_baselib.ext.horizontal
 import com.guadou.lib_baselib.ext.vertical
 import com.guadou.lib_baselib.utils.CommUtils
@@ -48,10 +43,25 @@ class HomeFragment : YYBaseVDBLoadingFragment<HomeViewModel, FragmentHomeBinding
 
     override fun init(savedInstanceState: Bundle?) {
 
+        initRV()
         initData()
         initListener()
     }
 
+    private fun initRV() {
+        mBinding.rvHotJob.horizontal().adapter = mViewModel.mHotJobAdapter
+
+        mBinding.rvCityJob.horizontal().adapter = mViewModel.mCityJobAdapter
+
+        mBinding.rvAreaJob.horizontal().adapter = mViewModel.mAreaJobAdapter
+
+        mBinding.rvJobTips.vertical(2).adapter = mViewModel.mJobTipsAdapter
+
+        mBinding.banner.addBannerLifecycleObserver(this)
+        mBinding.banner.indicator = BannerRectangleCircleIndicator(mActivity)
+        mBinding.banner.adapter = mViewModel.mBannerAdapter
+    }
+
     private fun initData() {
         showStateLoading()
 
@@ -59,7 +69,7 @@ class HomeFragment : YYBaseVDBLoadingFragment<HomeViewModel, FragmentHomeBinding
         //requestHomeData()
 
         CommUtils.getHandler().postDelayed({
-            mBinding.refreshLayout.finishRefresh()
+            mBinding.refreshLayout.finishRefresh(250)
             showStateSuccess()
             popopData()
         }, 1500)
@@ -74,6 +84,27 @@ class HomeFragment : YYBaseVDBLoadingFragment<HomeViewModel, FragmentHomeBinding
         mBinding.refreshLayout.setEnableLoadMore(false)
         mBinding.refreshLayout.setEnableRefresh(true)
         mBinding.refreshLayout.setOnRefreshListener(this)
+
+
+        mViewModel.mHotJobAdapter.setOnItemClickListener { adapter, view, position ->
+            toast("去兼职工作详情页面")
+        }
+
+        mViewModel.mCityJobAdapter.setOnItemClickListener { adapter, view, position ->
+            toast("去兼职工作详情页面")
+        }
+
+        mViewModel.mAreaJobAdapter.setOnItemClickListener { adapter, view, position ->
+            toast("去兼职工作详情页面")
+        }
+
+        mViewModel.mJobTipsAdapter.setOnItemClickListener { adapter, view, position ->
+            toast("去公告板详情页面")
+        }
+
+        mBinding.banner.setOnBannerListener { _, position ->
+            toast("点击Banner根据类型跳转:$position")
+        }
     }
 
     override fun onRefresh(refreshLayout: RefreshLayout) {
@@ -83,83 +114,11 @@ class HomeFragment : YYBaseVDBLoadingFragment<HomeViewModel, FragmentHomeBinding
         }, 1500)
     }
 
+    /**
+     * 模拟数据
+     */
     private fun popopData() {
-
-        popupBannerData()
-
-        val hotJobs = listOf("1", "2", "3", "4", "5")
-        val cityJobs = listOf("1", "2", "3", "4")
-        val areaJobs = listOf("1", "2", "3", "4", "5", "6")
-        val jobTips = listOf("1", "2", "3", "4")
-
-        mBinding.rvHotJob.horizontal()
-            .bindData(hotJobs, R.layout.item_home_part_time_job) { holder, t, _ ->
-
-                holder.getView<ImageView>(R.id.iv_job_image).extLoad(
-                    "http://malaysia-yyjobs-admin-dev.guabean.com/storage/202206/09/9NdPaX0fB66dFc4SMuR2kIqLDiJcVGjTW6vZ9hUu-690x410.png",
-                    R.drawable.placeholder_img_top_round_job, isCenterCrop = true, topRoundRadius = 5
-                )
-
-                holder.itemView.click {
-                    toast("点击进入工作详情")
-                }
-            }
-
-        mBinding.rvCityJob.horizontal()
-            .bindData(cityJobs, R.layout.item_home_part_time_job) { holder, t, _ ->
-
-                holder.getView<ImageView>(R.id.iv_job_image).extLoad(
-                    "http://malaysia-yyjobs-admin-dev.guabean.com/storage/202206/09/9NdPaX0fB66dFc4SMuR2kIqLDiJcVGjTW6vZ9hUu-690x410.png",
-                    R.drawable.placeholder_img_top_round_job, isCenterCrop = true, topRoundRadius = 5
-                )
-
-                holder.itemView.click {
-                    toast("点击进入工作详情")
-                }
-            }
-
-        mBinding.rvAreaJob.horizontal()
-            .bindData(areaJobs, R.layout.item_home_part_time_job) { holder, t, _ ->
-
-                holder.getView<ImageView>(R.id.iv_job_image).extLoad(
-                    "http://malaysia-yyjobs-admin-dev.guabean.com/storage/202206/09/9NdPaX0fB66dFc4SMuR2kIqLDiJcVGjTW6vZ9hUu-690x410.png",
-                    R.drawable.placeholder_img_top_round_job, isCenterCrop = true, topRoundRadius = 5
-                )
-
-                holder.itemView.click {
-                    toast("点击进入工作详情")
-                }
-            }
-
-        mBinding.rvJobTips.vertical(2)
-            .bindData(jobTips, R.layout.item_home_job_tips) { holder, t, _ ->
-
-                holder.getView<ImageView>(R.id.iv_top_img).extLoad(
-                    "http://malaysia-yyjobs-admin-dev.guabean.com/storage/202206/09/9NdPaX0fB66dFc4SMuR2kIqLDiJcVGjTW6vZ9hUu-690x410.png",
-                    R.drawable.placeholder_img_top_round_job, isCenterCrop = true, topRoundRadius = 5
-                )
-
-                holder.itemView.click {
-                    toast("点击进入公告板详情")
-                }
-            }
-    }
-
-    private fun popupBannerData() {
-
-        val imgUrls = listOf(
-            "http://yyjobs-admin-dev.guabean.com/storage/202206/21/5Kg5pL4lKlUkOijrntMucMw4CgbDMJbQ8ZfTXWjU-750x320.png",
-            "http://yyjobs-admin-dev.guabean.com/storage/202205/31/VX8sQRRgDXCC9nReU9hFx7Hhxg0karC1tQrWH74S-750x320.png",
-            "http://yyjobs-admin-dev.guabean.com/storage/202207/05/i049TYZ9GTf2BJ0jtc7cwa9zq7gtJGJhiVaUzcyB-1563x667.png"
-        )
-
-        mBinding.banner.addBannerLifecycleObserver(this)
-        mBinding.banner.indicator = BannerRectangleCircleIndicator(mActivity)
-        mBinding.banner.adapter = BannerGlobalAdapter(imgUrls)
-
-        mBinding.banner.setOnBannerListener { _, position ->
-            toast("点击Banner根据类型跳转")
-        }
+        mViewModel.setupDataes()
     }
 
     override fun scrollTopRefresh() {

+ 69 - 50
cpt_main/src/main/res/layout/item_home_job_tips.xml

@@ -1,52 +1,71 @@
 <?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
-    android:id="@+id/ll_item_root"
-    android:layout_width="wrap_content"
-    android:layout_height="195dp"
-    android:layout_marginRight="@dimen/d_12dp"
-    android:layout_marginBottom="@dimen/d_12dp"
-    android:background="@drawable/home_item_promotion_bg"
-    android:orientation="vertical">
-
-    <com.guadou.cs_cptservices.widget.TopRound5ImageView
-        android:id="@+id/iv_top_img"
-        android:layout_width="match_parent"
-        android:layout_height="109dp"
-        android:layout_marginLeft="4dp"
-        android:layout_marginTop="4dp"
-        android:layout_marginRight="4dp"
-        android:scaleType="centerCrop"
-        android:src="@drawable/placeholder_img_top_round_tips" />
-
-    <TextView
-        android:id="@+id/tv_content_title"
-        android:layout_width="match_parent"
-        android:layout_height="@dimen/d_40dp"
-        android:layout_marginLeft="@dimen/d_10dp"
-        android:layout_marginTop="5dp"
-        android:layout_marginRight="@dimen/d_5dp"
-        android:ellipsize="end"
-        android:gravity="center_vertical"
-        android:lines="2"
-        android:text="在中国排名前十的兼职类型"
-        android:textColor="@color/black"
-        android:textSize="@dimen/d_14sp" />
-
-
-    <TextView
-        android:id="@+id/tv_sub_titme"
+<layout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:binding="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools">
+
+    <data>
+
+        <variable
+            name="item"
+            type="String" />
+
+        <import type="android.text.TextUtils" />
+
+    </data>
+
+    <LinearLayout
+        android:id="@+id/ll_item_root"
         android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginLeft="@dimen/d_12dp"
-        android:layout_marginTop="@dimen/d_5dp"
-        android:layout_marginRight="@dimen/d_10dp"
-        android:ellipsize="end"
-        android:lines="1"
-        android:singleLine="true"
-        android:text="销售、外卖员、清洁工 发传单 修理工"
-        android:textColor="@color/gray_9a"
-        android:textSize="@dimen/d_12dp" />
-
-
-</LinearLayout>
+        android:layout_height="195dp"
+        android:layout_marginRight="@dimen/d_12dp"
+        android:layout_marginBottom="@dimen/d_12dp"
+        android:background="@drawable/home_item_promotion_bg"
+        android:orientation="vertical">
+
+        <com.guadou.cs_cptservices.widget.TopRound5ImageView
+            android:id="@+id/iv_top_img"
+            android:layout_width="match_parent"
+            android:layout_height="109dp"
+            android:layout_marginLeft="4dp"
+            android:layout_marginTop="4dp"
+            android:layout_marginRight="4dp"
+            android:scaleType="centerCrop"
+            android:src="@drawable/placeholder_img_top_round_tips"
+            binding:imgUrl="@{item}"
+            binding:placeholder="@{@drawable/placeholder_img_top_round_tips}"
+            binding:topRoundRadius="@{5}" />
+
+        <TextView
+            android:id="@+id/tv_content_title"
+            android:layout_width="match_parent"
+            android:layout_height="@dimen/d_40dp"
+            android:layout_marginLeft="@dimen/d_10dp"
+            android:layout_marginTop="5dp"
+            android:layout_marginRight="@dimen/d_5dp"
+            android:ellipsize="end"
+            android:gravity="center_vertical"
+            android:lines="2"
+            android:text="在中国排名前十的兼职类型"
+            android:textColor="@color/black"
+            android:textSize="@dimen/d_14sp" />
+
+
+        <TextView
+            android:id="@+id/tv_sub_titme"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="@dimen/d_12dp"
+            android:layout_marginTop="@dimen/d_5dp"
+            android:layout_marginRight="@dimen/d_10dp"
+            android:ellipsize="end"
+            android:lines="1"
+            android:singleLine="true"
+            android:text="销售、外卖员、清洁工 发传单 修理工"
+            android:textColor="@color/gray_9a"
+            android:textSize="@dimen/d_12dp" />
+
+
+    </LinearLayout>
+
+</layout>

+ 105 - 86
cpt_main/src/main/res/layout/item_home_part_time_job.xml

@@ -1,101 +1,120 @@
 <?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
-    android:id="@+id/ll_item_root"
-    android:layout_width="145dp"
-    android:layout_height="200dp"
-    android:layout_marginRight="@dimen/d_3dp"
-    android:background="@drawable/home_item_job_bg"
-    android:orientation="vertical">
-
-    <FrameLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content">
-
-        <com.guadou.cs_cptservices.widget.TopRound5ImageView
-            android:id="@+id/iv_job_image"
-            android:layout_width="match_parent"
-            android:layout_height="101dp"
-            android:layout_marginLeft="4dp"
-            android:layout_marginTop="6.2dp"
-            android:layout_marginRight="4dp"
-            android:scaleType="centerCrop"
-            tools:src="@drawable/placeholder_img_top_round_job" />
+<layout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:binding="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools">
 
-        <TextView
-            android:id="@+id/tv_job_tag"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_marginLeft="8.5dp"
-            android:layout_marginTop="8.5dp"
-            android:background="@drawable/shape_blue_round3"
-            android:paddingLeft="@dimen/d_6dp"
-            android:paddingTop="@dimen/d_3dp"
-            android:paddingRight="@dimen/d_6dp"
-            android:paddingBottom="@dimen/d_4dp"
-            android:text="立即预定"
-            android:textColor="@color/white"
-            android:textSize="@dimen/d_12sp" />
-    </FrameLayout>
-
-    <TextView
-        android:id="@+id/tv_job_title"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_marginLeft="@dimen/d_10dp"
-        android:layout_marginTop="@dimen/d_8dp"
-        android:layout_marginRight="@dimen/d_10dp"
-        android:ellipsize="end"
-        android:lines="2"
-        android:text="香格里拉酒店前台 服务生招聘"
-        android:textColor="@color/text_black_37"
-        android:textSize="@dimen/d_14sp" />
+    <data>
+
+        <variable
+            name="item"
+            type="String" />
+
+        <import type="android.text.TextUtils" />
+
+    </data>
 
     <LinearLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_marginLeft="@dimen/d_10dp"
-        android:layout_marginTop="@dimen/d_7dp"
-        android:layout_marginRight="@dimen/d_10dp"
-        android:gravity="center_vertical"
-        android:orientation="horizontal">
+        android:id="@+id/ll_item_root"
+        android:layout_width="145dp"
+        android:layout_height="200dp"
+        android:layout_marginRight="@dimen/d_3dp"
+        android:background="@drawable/home_item_job_bg"
+        android:orientation="vertical">
 
-        <TextView
-            android:id="@+id/tv_job_hour_rate"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:text="¥ 8"
-            android:textColor="@color/app_blue"
-            android:textSize="@dimen/d_15sp" />
+        <FrameLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content">
 
-        <TextView
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:text="/时"
-            android:textColor="@color/gray_76"
-            android:textSize="@dimen/d_13sp" />
+            <com.guadou.cs_cptservices.widget.TopRound5ImageView
+                android:id="@+id/iv_job_image"
+                android:layout_width="match_parent"
+                android:layout_height="101dp"
+                android:layout_marginLeft="4dp"
+                android:layout_marginTop="6.2dp"
+                android:layout_marginRight="4dp"
+                android:scaleType="centerCrop"
+                binding:imgUrl="@{item}"
+                binding:placeholder="@{@drawable/placeholder_img_top_round_job}"
+                binding:topRoundRadius="@{5}"
+                tools:src="@drawable/placeholder_img_top_round_job" />
 
-        <View
-            android:layout_width="0dp"
-            android:layout_height="1dp"
-            android:layout_weight="1" />
+            <TextView
+                android:id="@+id/tv_job_tag"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginLeft="8.5dp"
+                android:layout_marginTop="8.5dp"
+                android:background="@drawable/shape_blue_round3"
+                android:paddingLeft="@dimen/d_6dp"
+                android:paddingTop="@dimen/d_3dp"
+                android:paddingRight="@dimen/d_6dp"
+                android:paddingBottom="@dimen/d_4dp"
+                android:text="立即预定"
+                android:textColor="@color/white"
+                android:textSize="@dimen/d_12sp" />
+        </FrameLayout>
 
         <TextView
-            android:layout_width="wrap_content"
+            android:id="@+id/tv_job_title"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:text="总计"
-            android:textColor="@color/gray_76"
-            android:textSize="@dimen/d_13sp" />
+            android:layout_marginLeft="@dimen/d_10dp"
+            android:layout_marginTop="@dimen/d_8dp"
+            android:layout_marginRight="@dimen/d_10dp"
+            android:ellipsize="end"
+            android:lines="2"
+            android:text="香格里拉酒店前台 服务生招聘"
+            android:textColor="@color/text_black_37"
+            android:textSize="@dimen/d_14sp" />
 
-        <TextView
-            android:id="@+id/tv_job_est"
-            android:layout_width="wrap_content"
+        <LinearLayout
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:layout_marginLeft="@dimen/d_5dp"
-            android:text="¥80"
-            android:textColor="@color/profile_red"
-            android:textSize="@dimen/d_15sp" />
+            android:layout_marginLeft="@dimen/d_10dp"
+            android:layout_marginTop="@dimen/d_7dp"
+            android:layout_marginRight="@dimen/d_10dp"
+            android:gravity="center_vertical"
+            android:orientation="horizontal">
+
+            <TextView
+                android:id="@+id/tv_job_hour_rate"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="¥ 8"
+                android:textColor="@color/app_blue"
+                android:textSize="@dimen/d_15sp" />
+
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="/时"
+                android:textColor="@color/gray_76"
+                android:textSize="@dimen/d_13sp" />
+
+            <View
+                android:layout_width="0dp"
+                android:layout_height="1dp"
+                android:layout_weight="1" />
+
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="总计"
+                android:textColor="@color/gray_76"
+                android:textSize="@dimen/d_13sp" />
+
+            <TextView
+                android:id="@+id/tv_job_est"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginLeft="@dimen/d_5dp"
+                android:text="¥80"
+                android:textColor="@color/profile_red"
+                android:textSize="@dimen/d_15sp" />
+
+        </LinearLayout>
 
     </LinearLayout>
 
-</LinearLayout>
+</layout>

+ 4 - 2
cs_cptServices/src/main/java/com/guadou/cs_cptservices/binding/BindingImageView.kt

@@ -10,16 +10,18 @@ import com.guadou.lib_baselib.utils.CommUtils
 /**
  * 设置图片的加载
  */
-@BindingAdapter("imgUrl", "placeholder", "isOriginal", "roundRadius", "isCircle", requireAll = false)
+@BindingAdapter("imgUrl", "placeholder", "isOriginal", "roundRadius", "topRoundRadius", "bottomRoundRadius", "isCircle", requireAll = false)
 fun loadImg(
     view: ImageView, url: Any?, placeholder: Drawable? = null, isOriginal: Boolean = false, roundRadius: Int = 0,
-    isCircle: Boolean = false
+    topRoundRadius: Int = 0, bottomRoundRadius: Int = 0, isCircle: Boolean = false
 ) {
     url?.let {
         view.extLoad(
             it,
             placeholder = placeholder,
             roundRadius = CommUtils.dip2px(roundRadius),
+            topRoundRadius = topRoundRadius,
+            bottomRoundRadius = bottomRoundRadius,
             isCircle = isCircle,
             isForceOriginalSize = isOriginal
         )