From 051e5540b1a6203217cf7e360b27f7955d41609c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=9C=8B=E9=A3=9E?= Date: Mon, 14 Nov 2022 10:16:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E5=B8=B8=E6=8F=90=E4=BA=A4:2022-11-14?= =?UTF-8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 王朋飞 --- .../wpf/app/quickbind/utils/DataAutoSet2ViewUtils.kt | 10 ++++++++++ README.md | 2 ++ 2 files changed, 12 insertions(+) diff --git a/QuickBind/src/main/java/com/wpf/app/quickbind/utils/DataAutoSet2ViewUtils.kt b/QuickBind/src/main/java/com/wpf/app/quickbind/utils/DataAutoSet2ViewUtils.kt index 1a6b3346..89633632 100644 --- a/QuickBind/src/main/java/com/wpf/app/quickbind/utils/DataAutoSet2ViewUtils.kt +++ b/QuickBind/src/main/java/com/wpf/app/quickbind/utils/DataAutoSet2ViewUtils.kt @@ -5,11 +5,14 @@ import android.view.ViewGroup import android.widget.Checkable import android.widget.TextView import androidx.core.view.children +import com.wpf.app.quickbind.annotations.BindD2VHelper import com.wpf.app.quickbind.bindview.QuickRequestData import com.wpf.app.quickbind.interfaces.RunOnHolderWithSelf object DataAutoSet2ViewUtils { + var bind2ViewList: MutableList> = arrayListOf() + fun autoSet(data: T, view: View) { setData2ViewGroup(view, data) } @@ -53,5 +56,12 @@ object DataAutoSet2ViewUtils { view.isChecked = viewData == true } } + bind2ViewList.forEach { bind -> + bind.initView(view, data) + } } +} + +interface BindData2View { + fun bind(view: View, data: Any) } \ No newline at end of file diff --git a/README.md b/README.md index 71e3f3db..5c3886bc 100755 --- a/README.md +++ b/README.md @@ -53,3 +53,5 @@ 3.可刷新List支持请求接口后自动加载 已实现 4.布局View支持请求接口后自动映射赋值 已实现 + + 5.布局xml支持接口请求并自动赋值