From 548dce0bcff06ee7a1795defe8e7789b9d7aad94 Mon Sep 17 00:00:00 2001 From: zuoxiao <470321431@qq.com> Date: 星期五, 25 四月 2025 16:52:50 +0800 Subject: [PATCH] refactor(nfc): 重构 NFC 读写助手类并优化相关功能 --- generallibrary/src/main/java/com/dayu/general/activity/NewCard2Activity.kt | 2 generallibrary/src/main/res/layout/item_card_replace.xml | 180 +++++++++++++++++++++++++ baselibrary/src/main/java/com/dayu/baselibrary/tools/nfc/NativeNfcReadHelper.java | 17 ++ generallibrary/src/main/java/com/dayu/general/activity/BSCardFragment.kt | 14 + generallibrary/src/main/java/com/dayu/general/activity/MainActivity.kt | 4 generallibrary/src/main/java/com/dayu/general/activity/RechargeFragment.kt | 11 + generallibrary/src/main/res/layout/fragment_card.xml | 3 baselibrary/src/main/java/com/dayu/baselibrary/tools/nfc/NfcReadAdapter.java | 11 + baselibrary/src/main/java/com/dayu/baselibrary/tools/nfc/NativeNfcWriteHelper.java | 26 ++- generallibrary/src/main/res/layout/activity_manage_list_ge.xml | 145 ++++++++++---------- baselibrary/src/main/java/com/dayu/baselibrary/tools/nfc/NfcWriteAdapter.java | 2 11 files changed, 320 insertions(+), 95 deletions(-) diff --git a/baselibrary/src/main/java/com/dayu/baselibrary/tools/nfc/NativeNfcReadHelper.java b/baselibrary/src/main/java/com/dayu/baselibrary/tools/nfc/NativeNfcReadHelper.java index 4c8aa09..fd1651e 100644 --- a/baselibrary/src/main/java/com/dayu/baselibrary/tools/nfc/NativeNfcReadHelper.java +++ b/baselibrary/src/main/java/com/dayu/baselibrary/tools/nfc/NativeNfcReadHelper.java @@ -31,8 +31,6 @@ private static NativeNfcReadHelper helper; - public NativeNfcReadHelper(Intent intent, Activity activity) { - } @Override @@ -49,7 +47,7 @@ */ public static NativeNfcReadHelper getInstence(Intent intent, Activity activity) { if (helper == null) { - helper = new NativeNfcReadHelper(intent, activity); + helper = new NativeNfcReadHelper(); } helper.setIntent(intent); return helper; @@ -387,6 +385,9 @@ @Override public String getCardNumber() { + if (tag == null) { + return ""; + } MifareClassic mfc = MifareClassic.get(tag); if (null != mfc) { try { @@ -434,7 +435,13 @@ } + + + public String getCardNumberNoClose() { + if (tag == null) { + return ""; + } MifareClassic mfc = MifareClassic.get(tag); if (null != mfc) { try { @@ -667,4 +674,8 @@ } return null; } + + public boolean changePasword(int a, MifareClassic mfc) { + + } } diff --git a/baselibrary/src/main/java/com/dayu/baselibrary/tools/nfc/NativeNfcWriteHelper.java b/baselibrary/src/main/java/com/dayu/baselibrary/tools/nfc/NativeNfcWriteHelper.java index c427898..22349c3 100644 --- a/baselibrary/src/main/java/com/dayu/baselibrary/tools/nfc/NativeNfcWriteHelper.java +++ b/baselibrary/src/main/java/com/dayu/baselibrary/tools/nfc/NativeNfcWriteHelper.java @@ -9,6 +9,7 @@ import com.dayu.baselibrary.bean.BaseUserCardCard; import com.dayu.baselibrary.tools.HexUtil; +import com.tencent.bugly.crashreport.CrashReport; import java.io.IOException; @@ -23,8 +24,6 @@ private static NativeNfcWriteHelper helper; - public NativeNfcWriteHelper(Intent intent, Activity activity) { - } public void setIntent(Intent intent) { this.tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG); @@ -38,7 +37,7 @@ */ public static NativeNfcWriteHelper getInstence(Intent intent, Activity activity) { if (helper == null) { - helper = new NativeNfcWriteHelper(intent, activity); + helper = new NativeNfcWriteHelper(); } helper.setIntent(intent); return helper; @@ -125,7 +124,7 @@ @Override public boolean writeData(byte[] str, int a, int b, NFCCallBack callBack) { - return writeData(str, a, b, true,null); + return writeData(str, a, b, true, null); } @Override @@ -137,7 +136,7 @@ if (null != mfc) { try { //杩炴帴NFC - if (isConnect){ + if (isConnect) { mfc.connect(); } //鑾峰彇鎵囧尯鏁伴噺 @@ -172,11 +171,10 @@ } } } else if (listA_PS.size() != 0 && listA_PS.size() > a) { - if (mfc.authenticateSectorWithKeyA(a, defauleKey)){ - changePasword(a, mfc); + if (mfc.authenticateSectorWithKeyA(a, defauleKey)) { isOpen = true; - }else if (mfc.authenticateSectorWithKeyA(a, listA_PS.get(a))) { + } else if (mfc.authenticateSectorWithKeyA(a, listA_PS.get(a))) { isOpen = true; } } @@ -288,6 +286,18 @@ return false; } + + public boolean changePasword(int a,byte[] passWord, MifareClassic mfc) { + try { + + + } catch (Exception e) { + e.printStackTrace(); + CrashReport.postCatchedException(e); + } + return false; + } + /** * 鍒濆鍖栧崱 * diff --git a/baselibrary/src/main/java/com/dayu/baselibrary/tools/nfc/NfcReadAdapter.java b/baselibrary/src/main/java/com/dayu/baselibrary/tools/nfc/NfcReadAdapter.java index ba423c5..e845c04 100644 --- a/baselibrary/src/main/java/com/dayu/baselibrary/tools/nfc/NfcReadAdapter.java +++ b/baselibrary/src/main/java/com/dayu/baselibrary/tools/nfc/NfcReadAdapter.java @@ -27,7 +27,7 @@ public NfcReadAdapter(Intent intent, Activity activity) { switch (BaseNfcActivity.adapterType) { case ModelUtils.defaultType: - nativeNfcReadHelper = new NativeNfcReadHelper(intent, activity); + nativeNfcReadHelper = NativeNfcReadHelper.getInstence(intent, activity); break; } @@ -63,11 +63,16 @@ } } - @Override public String getCardNumber() { + return getCardNumber(false); + } + + + @Override + public String getCardNumber(boolean isChangePS) { switch (BaseNfcActivity.adapterType) { case ModelUtils.defaultType: - return nativeNfcReadHelper.getCardNumber(); + return nativeNfcReadHelper.getCardNumber(isChangePS); } return ""; } diff --git a/baselibrary/src/main/java/com/dayu/baselibrary/tools/nfc/NfcWriteAdapter.java b/baselibrary/src/main/java/com/dayu/baselibrary/tools/nfc/NfcWriteAdapter.java index c3db8f3..d10fedc 100644 --- a/baselibrary/src/main/java/com/dayu/baselibrary/tools/nfc/NfcWriteAdapter.java +++ b/baselibrary/src/main/java/com/dayu/baselibrary/tools/nfc/NfcWriteAdapter.java @@ -20,7 +20,7 @@ public NfcWriteAdapter(Intent intent, Activity activity) { switch (BaseNfcActivity.adapterType) { case ModelUtils.defaultType: - nativeNfcWriteHelper = new NativeNfcWriteHelper(intent, activity); + nativeNfcWriteHelper = NativeNfcWriteHelper.getInstence(intent, activity); break; } } diff --git a/generallibrary/src/main/java/com/dayu/general/activity/BSCardFragment.kt b/generallibrary/src/main/java/com/dayu/general/activity/BSCardFragment.kt index 9cc98ad..408e290 100644 --- a/generallibrary/src/main/java/com/dayu/general/activity/BSCardFragment.kt +++ b/generallibrary/src/main/java/com/dayu/general/activity/BSCardFragment.kt @@ -15,7 +15,7 @@ */ class BSCardFragment :Fragment() { - private var binding: FragmentCardBinding? = null + private lateinit var binding: FragmentCardBinding override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) } @@ -31,22 +31,28 @@ } private fun initView() { - binding?.homeNewCard?.setOnClickListener { + binding.homeNewCard.setOnClickListener { val intent = Intent(context, SearchUserListActivity::class.java).apply { putExtra("type", "newUser") } startActivity(intent) } - binding?.homeManage?.setOnClickListener { + binding.homeManage.setOnClickListener { val intent = Intent(context, ManageListActivity::class.java) startActivity(intent) } - binding?.homeLossLL?.setOnClickListener { + binding.homeLossLL.setOnClickListener { val intent = Intent(context, SearchCardListActivity::class.java).apply{ putExtra("type", "loss") } startActivity(intent) } + binding.homeReplaceLL.setOnClickListener{ + val intent = Intent(context, SearchCardListActivity::class.java).apply{ + putExtra("type", "replace") + } + startActivity(intent) + } } } diff --git a/generallibrary/src/main/java/com/dayu/general/activity/MainActivity.kt b/generallibrary/src/main/java/com/dayu/general/activity/MainActivity.kt index a57c9ef..87af8d5 100644 --- a/generallibrary/src/main/java/com/dayu/general/activity/MainActivity.kt +++ b/generallibrary/src/main/java/com/dayu/general/activity/MainActivity.kt @@ -33,8 +33,8 @@ getUserInfo() } - override fun onNfcBack(intent: Intent?) { - intent?.let { nfcIntent -> + override fun onNfcBack(intent: Intent) { + intent.let { nfcIntent -> // 鑾峰彇褰撳墠鏄剧ず鐨凢ragment val currentFragment = fragments[binding?.viewPager?.currentItem ?: 0] diff --git a/generallibrary/src/main/java/com/dayu/general/activity/NewCard2Activity.kt b/generallibrary/src/main/java/com/dayu/general/activity/NewCard2Activity.kt index 55330fd..dbaf55e 100644 --- a/generallibrary/src/main/java/com/dayu/general/activity/NewCard2Activity.kt +++ b/generallibrary/src/main/java/com/dayu/general/activity/NewCard2Activity.kt @@ -20,7 +20,7 @@ import kotlinx.coroutines.launch /** - * Description: 鐢ㄦ埛寮�鍗$晫闈� + * Description: 鐢ㄦ埛寮�鍗$晫闈�(鍚屾淇敼鐧藉崱瀵嗙爜) * Author: zuo * Date: 2025/4/7 */ diff --git a/generallibrary/src/main/java/com/dayu/general/activity/RechargeFragment.kt b/generallibrary/src/main/java/com/dayu/general/activity/RechargeFragment.kt index 703ab3f..28d6e50 100644 --- a/generallibrary/src/main/java/com/dayu/general/activity/RechargeFragment.kt +++ b/generallibrary/src/main/java/com/dayu/general/activity/RechargeFragment.kt @@ -13,6 +13,7 @@ import com.dayu.general.databinding.FragmentRechargeBinding import com.dayu.general.net.ApiManager import com.dayu.general.net.BaseResponse +import com.dayu.general.tool.NfcReadHelper class RechargeFragment : Fragment() { var binding: FragmentRechargeBinding? = null @@ -56,9 +57,15 @@ fun handleNfcIntent(intent: Intent) { activity?.let { activity -> try { + // 妫�鏌ntent涓槸鍚﹀寘鍚玁FC Tag + if (intent.getParcelableExtra<android.nfc.Tag>(android.nfc.NfcAdapter.EXTRA_TAG) == null) { + ToastUtil.show("鏈娴嬪埌NFC鍗$墖锛岃纭繚鍗$墖宸叉纭斁缃�") + return + } + // 浣跨敤NfcReadAdapter璇诲彇鍗″彿 - val nfcAdapter = NfcReadAdapter(intent, activity) - cardNumber = nfcAdapter.cardNumber + val nfcAdapter = NfcReadHelper.getInstance(intent, activity) + cardNumber = nfcAdapter.getCardNumber() if (cardNumber.isNullOrEmpty()) { ToastUtil.show("璇诲崱澶辫触锛岃閲嶆柊鍒峰崱") diff --git a/generallibrary/src/main/res/layout/activity_manage_list_ge.xml b/generallibrary/src/main/res/layout/activity_manage_list_ge.xml index d8ab4b4..949120e 100644 --- a/generallibrary/src/main/res/layout/activity_manage_list_ge.xml +++ b/generallibrary/src/main/res/layout/activity_manage_list_ge.xml @@ -3,9 +3,8 @@ xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" - android:orientation="vertical" android:background="@color/white" - > + android:orientation="vertical"> <com.dayu.baselibrary.view.TitleBar android:id="@+id/titleBar" @@ -17,140 +16,146 @@ <ScrollView android:layout_width="match_parent" - android:layout_height="match_parent" - > + android:layout_height="match_parent"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" - android:padding="16dp" - android:orientation="vertical"> + android:orientation="vertical" + android:padding="16dp"> + <TextView android:id="@+id/tv_area_card" android:layout_width="match_parent" android:layout_height="wrap_content" - android:text="璁剧疆鍖哄煙琛ㄥ彿鍗�" - android:textSize="16sp" - android:textColor="#333333" - android:padding="16dp" android:layout_marginBottom="12dp" android:background="@drawable/card_ripple_effect" - android:elevation="2dp" - android:drawableEnd="@drawable/ic_arrow_right" - android:gravity="center_vertical" android:clickable="true" - android:focusable="true" /> + android:drawableEnd="@drawable/ic_arrow_right" + android:elevation="2dp" + android:focusable="true" + android:gravity="center_vertical" + android:padding="16dp" + android:text="璁剧疆鍖哄煙琛ㄥ彿鍗�" + android:textColor="#333333" + android:textSize="16sp" /> + <TextView android:id="@+id/tv_check_card" android:layout_width="match_parent" android:layout_height="wrap_content" - android:text="妫�鏌ュ崱" - android:textSize="16sp" - android:textColor="#333333" - android:padding="16dp" android:layout_marginBottom="12dp" android:background="@drawable/card_ripple_effect" - android:elevation="2dp" - android:drawableEnd="@drawable/ic_arrow_right" - android:gravity="center_vertical" android:clickable="true" - android:focusable="true" /> + android:drawableEnd="@drawable/ic_arrow_right" + android:elevation="2dp" + android:focusable="true" + android:gravity="center_vertical" + android:padding="16dp" + android:text="妫�鏌ュ崱" + android:textColor="#333333" + android:textSize="16sp" /> <TextView android:id="@+id/tv_debug_card" android:layout_width="match_parent" android:layout_height="wrap_content" - android:text="璋冭瘯鍗�" - android:textSize="16sp" - android:textColor="#333333" - android:padding="16dp" android:layout_marginBottom="12dp" android:background="@drawable/card_ripple_effect" - android:elevation="2dp" - android:drawableEnd="@drawable/ic_arrow_right" - android:gravity="center_vertical" android:clickable="true" - android:focusable="true" /> + android:drawableEnd="@drawable/ic_arrow_right" + android:elevation="2dp" + android:focusable="true" + android:gravity="center_vertical" + android:padding="16dp" + android:text="璋冭瘯鍗�" + android:textColor="#333333" + android:textSize="16sp" /> <TextView android:id="@+id/tv_clean_card" android:layout_width="match_parent" android:layout_height="wrap_content" - android:text="娓呴浂鍗�" - android:textSize="16sp" - android:textColor="#333333" - android:padding="16dp" android:layout_marginBottom="12dp" android:background="@drawable/card_ripple_effect" - android:elevation="2dp" - android:drawableEnd="@drawable/ic_arrow_right" - android:gravity="center_vertical" android:clickable="true" - android:focusable="true" /> + android:drawableEnd="@drawable/ic_arrow_right" + android:elevation="2dp" + android:focusable="true" + android:gravity="center_vertical" + android:padding="16dp" + android:text="娓呴浂鍗�" + android:textColor="#333333" + android:textSize="16sp" + android:visibility="gone" /> <TextView android:id="@+id/tv_ip_setting_card" android:layout_width="match_parent" android:layout_height="wrap_content" - android:text="IP鍦板潃璁剧疆鍗�" - android:textSize="16sp" - android:textColor="#333333" - android:padding="16dp" android:layout_marginBottom="12dp" android:background="@drawable/card_ripple_effect" - android:elevation="2dp" - android:drawableEnd="@drawable/ic_arrow_right" - android:gravity="center_vertical" android:clickable="true" - android:focusable="true" /> + android:drawableEnd="@drawable/ic_arrow_right" + android:elevation="2dp" + android:focusable="true" + android:gravity="center_vertical" + android:padding="16dp" + android:text="IP鍦板潃璁剧疆鍗�" + android:textColor="#333333" + android:textSize="16sp" + android:visibility="gone" /> <TextView android:id="@+id/tv_domain_setting_card" android:layout_width="match_parent" android:layout_height="wrap_content" - android:text="鍩熷悕璁剧疆鍗�" - android:textSize="16sp" - android:textColor="#333333" - android:padding="16dp" android:layout_marginBottom="12dp" android:background="@drawable/card_ripple_effect" - android:elevation="2dp" - android:drawableEnd="@drawable/ic_arrow_right" - android:gravity="center_vertical" android:clickable="true" - android:focusable="true" /> + android:drawableEnd="@drawable/ic_arrow_right" + android:elevation="2dp" + android:focusable="true" + android:gravity="center_vertical" + android:padding="16dp" + android:text="鍩熷悕璁剧疆鍗�" + android:textColor="#333333" + android:textSize="16sp" + android:visibility="gone" /> <TextView android:id="@+id/tv_gps_card" android:layout_width="match_parent" android:layout_height="wrap_content" - android:text="GPS瀹氫綅鍗�" - android:textSize="16sp" - android:textColor="#333333" - android:padding="16dp" android:layout_marginBottom="12dp" android:background="@drawable/card_ripple_effect" - android:elevation="2dp" - android:drawableEnd="@drawable/ic_arrow_right" - android:gravity="center_vertical" android:clickable="true" - android:focusable="true" /> + android:drawableEnd="@drawable/ic_arrow_right" + android:elevation="2dp" + android:focusable="true" + android:gravity="center_vertical" + android:padding="16dp" + android:text="GPS瀹氫綅鍗�" + android:textColor="#333333" + android:textSize="16sp" + android:visibility="gone" /> <TextView android:id="@+id/tv_valve_time_card" android:layout_width="match_parent" android:layout_height="wrap_content" - android:text="閰嶇疆寮�鍏抽榾鏃堕棿鍗�" - android:textSize="16sp" - android:textColor="#333333" - android:padding="16dp" android:layout_marginBottom="12dp" android:background="@drawable/card_ripple_effect" - android:elevation="2dp" - android:drawableEnd="@drawable/ic_arrow_right" - android:gravity="center_vertical" android:clickable="true" - android:focusable="true" /> + android:drawableEnd="@drawable/ic_arrow_right" + android:elevation="2dp" + android:focusable="true" + android:gravity="center_vertical" + android:padding="16dp" + android:text="閰嶇疆寮�鍏抽榾鏃堕棿鍗�" + android:textColor="#333333" + android:textSize="16sp" + android:visibility="gone" /> </LinearLayout> </ScrollView> </LinearLayout> \ No newline at end of file diff --git a/generallibrary/src/main/res/layout/fragment_card.xml b/generallibrary/src/main/res/layout/fragment_card.xml index b0cff9a..70eef09 100644 --- a/generallibrary/src/main/res/layout/fragment_card.xml +++ b/generallibrary/src/main/res/layout/fragment_card.xml @@ -215,6 +215,7 @@ app:layout_constraintTop_toBottomOf="@+id/home_redCard"> <LinearLayout + android:id="@+id/home_replaceLL" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" @@ -231,7 +232,7 @@ android:layout_height="wrap_content" android:layout_marginTop="6dp" android:gravity="center" - android:text="琛ュ崱" + android:text="瑙f寕銆佽ˉ鍗�" android:textColor="@color/text_selecter_color" android:textSize="14sp" /> </LinearLayout> diff --git a/generallibrary/src/main/res/layout/item_card_replace.xml b/generallibrary/src/main/res/layout/item_card_replace.xml new file mode 100644 index 0000000..c5ca568 --- /dev/null +++ b/generallibrary/src/main/res/layout/item_card_replace.xml @@ -0,0 +1,180 @@ +<?xml version="1.0" encoding="utf-8"?> +<layout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools"> + + <data> + <variable + name="cardInfo" + type="com.dayu.general.bean.net.CardReplaceInfo" /> + </data> + + <androidx.cardview.widget.CardView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginHorizontal="10dp" + android:layout_marginVertical="6dp" + app:cardCornerRadius="10dp" + app:cardElevation="3dp" + app:cardBackgroundColor="@color/white"> + + <androidx.constraintlayout.widget.ConstraintLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:padding="12dp"> + + <!-- 椤堕儴淇℃伅锛氬崱鍙峰拰鐘舵�� --> + <TextView + android:id="@+id/tv_card_label" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="鍗″彿" + android:textColor="@color/title_bar_text" + android:textSize="14sp" + android:textStyle="bold" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/tv_card_number" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:layout_marginEnd="16dp" + android:text="@{cardInfo.cardNum}" + android:textColor="@color/colorPrimary" + android:textSize="16sp" + android:textStyle="bold" + app:layout_constraintStart_toEndOf="@+id/tv_card_label" + app:layout_constraintTop_toTopOf="@+id/tv_card_label" + app:layout_constraintEnd_toStartOf="@+id/tv_status" + tools:text="123456789" /> + + <TextView + android:id="@+id/tv_status" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:background="@drawable/shape_status_bg" + android:paddingHorizontal="10dp" + android:paddingVertical="3dp" + android:text="@{cardInfo.stateName}" + android:textColor="@color/white" + android:textSize="12sp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" + tools:text="宸叉寕澶�" /> + + <!-- 鍒嗛殧绾� --> + <View + android:id="@+id/divider" + android:layout_width="match_parent" + android:layout_height="0.5dp" + android:layout_marginTop="12dp" + android:background="@color/light_grey" + app:layout_constraintTop_toBottomOf="@+id/tv_card_number" /> + + <!-- 瀹㈡埛淇℃伅 --> + <TextView + android:id="@+id/tv_client_label" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="12dp" + android:text="瀹㈡埛" + android:textColor="@color/title_bar_text" + android:textSize="14sp" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/divider" /> + + <TextView + android:id="@+id/tv_client_name" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:text="@{cardInfo.clientName}" + android:textColor="@color/title_bar_text" + android:textSize="14sp" + android:textStyle="bold" + app:layout_constraintStart_toEndOf="@+id/tv_client_label" + app:layout_constraintTop_toTopOf="@+id/tv_client_label" + tools:text="寮犱笁" /> + + <!-- 鍗$被鍨嬩俊鎭紙浜ゆ崲鍒板鎴风紪鍙风殑浣嶇疆锛� --> + <TextView + android:id="@+id/tv_card_type_label" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="30dp" + android:text="鍗$被鍨�" + android:textColor="@color/title_bar_text" + android:textSize="14sp" + app:layout_constraintStart_toEndOf="@+id/tv_client_name" + app:layout_constraintTop_toTopOf="@+id/tv_client_name" /> + + <TextView + android:id="@+id/tv_card_type" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:text="@{cardInfo.cardType}" + android:textColor="@color/title_bar_text" + android:textSize="14sp" + app:layout_constraintStart_toEndOf="@+id/tv_card_type_label" + app:layout_constraintTop_toTopOf="@+id/tv_card_type_label" + tools:text="鏅�氬崱" /> + + <!-- 瀹㈡埛缂栧彿淇℃伅锛堜氦鎹㈠埌鍗$被鍨嬬殑浣嶇疆锛� --> + <TextView + android:id="@+id/tv_client_number_label" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="8dp" + android:text="缂栧彿" + android:textColor="@color/title_bar_text" + android:textSize="14sp" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/tv_client_label" /> + + <TextView + android:id="@+id/tv_client_number" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:text="@{cardInfo.clientNum}" + android:textColor="@color/title_bar_text" + android:textSize="14sp" + app:layout_constraintStart_toEndOf="@+id/tv_client_number_label" + app:layout_constraintTop_toTopOf="@+id/tv_client_number_label" + tools:text="C12345" /> + + <!-- 浣欓淇℃伅锛堟斁澶у瓧浣擄級 --> + <TextView + android:id="@+id/tv_money_label" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="12dp" + android:text="浣欓" + android:textColor="@color/colorAccent" + android:textSize="16sp" + android:textStyle="bold" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/tv_client_number_label" + app:layout_constraintVertical_bias="1.0" /> + + <TextView + android:id="@+id/tv_money" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:text="@{cardInfo.money.concat(" 鍏�")}" + android:textColor="@color/colorAccent" + android:textSize="20sp" + android:textStyle="bold" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintTop_toTopOf="@+id/tv_money_label" + tools:text="100.00 鍏�" /> + + </androidx.constraintlayout.widget.ConstraintLayout> + </androidx.cardview.widget.CardView> +</layout> \ No newline at end of file -- Gitblit v1.8.0