From 99b11059aedf616df4ed3b74300fa59417568bc3 Mon Sep 17 00:00:00 2001 From: zuoxiao <470321431@qq.com> Date: 星期二, 08 四月 2025 16:37:38 +0800 Subject: [PATCH] feat: 添加单选按钮文本颜色资源文件 --- generallibrary/src/main/java/com/dayu/general/bean/card/BaseCard.kt | 55 ++++++++++++++++++++++++++++++++----------------------- 1 files changed, 32 insertions(+), 23 deletions(-) diff --git a/generallibrary/src/main/java/com/dayu/general/bean/card/BaseCard.kt b/generallibrary/src/main/java/com/dayu/general/bean/card/BaseCard.kt index 7e17509..0429fcf 100644 --- a/generallibrary/src/main/java/com/dayu/general/bean/card/BaseCard.kt +++ b/generallibrary/src/main/java/com/dayu/general/bean/card/BaseCard.kt @@ -1,13 +1,22 @@ package com.dayu.general.bean.card -import com.dayu.baselibrary.dao.AppDatabase -import com.dayu.baselibrary.tools.HexUtil +import com.dayu.baselibrary.tools.BaseCard import com.dayu.general.bean.db.CardData import com.dayu.general.dao.AppDataBase +import com.dayu.general.tool.CardCommon import com.tencent.bugly.crashreport.CrashReport -open class BaseCard { +open class BaseCard : BaseCard() { var cardData: String? = null //鏍囪瘑鐮� + + companion object { + + const val IDENTIFY_CODE_A0 = 0xA0.toByte() // 璇嗗埆鐮丄0 + const val IDENTIFY_CODE_B1 = 0xB1.toByte() // 璇嗗埆鐮丅1 + const val IDENTIFY_CODE_C2 = 0xC2.toByte() // 璇嗗埆鐮丆2 + const val IDENTIFY_CODE_89 = 0x89.toByte() // 璇嗗埆鐮�89 + } + fun setCardData(baseDao: AppDataBase, cardType: String?) { try { @@ -24,25 +33,25 @@ } - /** - * 鍓�15涓瓧鑺傜畻鏈疮鍔犲拰 涓嶅惈杩涗綅 - * - * @param data 婧愭暟鎹� - * @return 16杩涘埗 - */ - fun getByteSum(data: ByteArray?): Byte { - if (data != null) { - var sum = 0 - for (b in data) { - sum += b.toInt() and 0xFF // & 0xFF 鍙互灏嗗瓧鑺傛墿灞曚负姝f暣鏁帮紝閬垮厤绗﹀彿浣嶇殑褰卞搷 - } - var hex = HexUtil.get10to16CompleteHex(sum) - hex = HexUtil.spaceHex(hex) - val hexArr = hex.split(" ".toRegex()).dropLastWhile { it.isEmpty() } - .toTypedArray() - return HexUtil.hexToByte(hexArr[hexArr.size - 1]) - } - return 0 - } +// /** +// * 鍓�15涓瓧鑺傜畻鏈疮鍔犲拰 涓嶅惈杩涗綅 +// * +// * @param data 婧愭暟鎹� +// * @return 16杩涘埗 +// */ +// fun getByteSum(data: ByteArray?): Byte { +// if (data != null) { +// var sum = 0 +// for (b in data) { +// sum += b.toInt() and 0xFF // & 0xFF 鍙互灏嗗瓧鑺傛墿灞曚负姝f暣鏁帮紝閬垮厤绗﹀彿浣嶇殑褰卞搷 +// } +// var hex = HexUtil.get10to16CompleteHex(sum) +// hex = HexUtil.spaceHex(hex) +// val hexArr = hex.split(" ".toRegex()).dropLastWhile { it.isEmpty() } +// .toTypedArray() +// return HexUtil.hexToByte(hexArr[hexArr.size - 1]) +// } +// return 0 +// } } \ No newline at end of file -- Gitblit v1.8.0