From 9cffe03d76840520bfbfeaf85933fcb2ed8385b8 Mon Sep 17 00:00:00 2001
From: zuoxiao <470321431@qq.com>
Date: 星期三, 05 三月 2025 10:19:46 +0800
Subject: [PATCH] feat(generallibrary): 新增主界面和相关功能模块 - 新增 MainActivity 作为主界面,包含三个底部导航栏选项卡- 新增 BSCardFragment、RechargeFragment 和 MyFragment 作为三个选项卡对应的页面 - 新增 NewCardActivity 用于新建卡片 - 新增 AreaCard 类用于处理区域表号卡数据 - 新增 BaseCard 类作为卡片数据的基础类 - 新增 TabAdapter 用于管理选项卡页面 - 更新 AndroidManifest.xml 设置主活动为 MainActivity - 更新 build.gradle 添加 generallibrary 依赖
---
generallibrary/src/main/java/com/dayu/general/bean/db/PassWordCardBean.java | 36
generallibrary/src/main/res/drawable/rounded_button_bg.xml | 6
generallibrary/src/main/java/com/dayu/general/bean/card/IpSettingCard.kt | 219 +++
generallibrary/src/main/java/com/dayu/general/activity/MainActivity.kt | 98 +
generallibrary/src/main/java/com/dayu/general/activity/MyFragment.kt | 18
generallibrary/src/main/res/layout/fragment_card.xml | 341 +++++
generallibrary/src/main/res/drawable/ripple_effect.xml | 10
baselibrary/src/main/java/com/dayu/baselibrary/tools/nfc/NfcWriteAdapter.java | 27
generallibrary/src/main/java/com/dayu/general/activity/BaseActivity.kt | 2
generallibrary/src/main/res/layout/activity_main.xml | 12
generallibrary/src/main/res/drawable/bottom_circle_bg.xml | 2
baselibrary/src/main/java/com/dayu/baselibrary/tools/nfc/NativeNfcReadHelper.java | 6
generallibrary/build.gradle | 32
generallibrary/src/main/java/com/dayu/general/bean/card/ClearCard.kt | 93 +
generallibrary/src/main/java/com/dayu/general/bean/card/DebugCard.kt | 157 ++
generallibrary/src/main/res/drawable/nav_item_color.xml | 5
generallibrary/src/main/res/values/colors.xml | 3
generallibrary/src/main/java/com/dayu/general/bean/card/BaseCard.kt | 48
generallibrary/src/main/java/com/dayu/general/bean/card/CheckCard.kt | 93 +
generallibrary/src/main/java/com/dayu/general/bean/card/AreaCard.kt | 105 +
app/build.gradle | 1
generallibrary/src/main/java/com/dayu/general/bean/card/FetchDataCard.kt | 132 ++
generallibrary/src/main/java/com/dayu/general/bean/card/GpsCard.kt | 93 +
generallibrary/CMakeLists.txt | 44
generallibrary/src/main/res/layout/activity_new_card_ge.xml | 311 ++++
generallibrary/src/main/res/drawable/shadow_gradient.xml | 8
generallibrary/src/main/res/drawable/tab_ripple_effect.xml | 10
generallibrary/src/main/java/com/dayu/general/activity/NewCardActivity.kt | 16
baselibrary/src/main/java/com/dayu/baselibrary/tools/nfc/NativeNfcWriteHelper.java | 74 +
generallibrary/src/main/java/com/dayu/general/bean/card/CardCommon.kt | 132 ++
generallibrary/src/main/res/drawable/fab_background.xml | 21
generallibrary/src/main/java/com/dayu/general/bean/card/UserCard.kt | 199 +++
generallibrary/src/main/cpp/general-native-lib.cpp | 135 ++
generallibrary/src/main/java/com/dayu/general/adapter/TabAdapter.kt | 21
generallibrary/src/main/java/com/dayu/general/dao/CardDataDao.kt | 20
generallibrary/src/main/java/com/dayu/general/tool/GeBaseHelper.kt | 43
generallibrary/src/main/java/com/dayu/general/activity/RechargeFragment.kt | 17
generallibrary/src/main/res/layout/fragment_my.xml | 355 +++++
baselibrary/src/main/java/com/dayu/baselibrary/tools/nfc/BaseNfcWriteHelper.java | 2
henanlibrary/src/main/java/com/dayu/henanlibrary/tools/NFCWriteHelper.java | 7
generallibrary/src/main/java/com/dayu/general/bean/card/ValveTimeCard.kt | 118 +
generallibrary/src/main/AndroidManifest.xml | 56
generallibrary/src/main/java/com/dayu/general/bean/db/CardData.kt | 21
generallibrary/src/main/res/drawable/tab_indicator.xml | 7
generallibrary/src/main/res/drawable/bottom_nav_background.xml | 39
generallibrary/src/main/java/com/dayu/general/dao/AppDataBase.kt | 5
generallibrary/src/main/java/com/dayu/general/activity/BSCardFragment.kt | 30
app/src/main/AndroidManifest.xml | 11
baselibrary/src/main/java/com/dayu/baselibrary/tools/nfc/NFCCallBack.java | 17
generallibrary/src/main/res/values/dimens.xml | 6
generallibrary/src/main/res/drawable/shadow_gradient_strong.xml | 8
baselibrary/src/main/java/com/dayu/baselibrary/tools/nfc/BaseNFCHelper.java | 6
generallibrary/src/main/res/layout/fragment_recharge.xml | 400 ++++++
generallibrary/src/main/java/com/dayu/general/dao/BaseDaoSingleton.kt | 10
generallibrary/src/main/java/com/dayu/general/bean/card/DomainSettingCard.kt | 213 +++
55 files changed, 3,847 insertions(+), 54 deletions(-)
diff --git a/app/build.gradle b/app/build.gradle
index 9abadcd..0d96122 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -75,6 +75,7 @@
implementation project(':baselibrary')
implementation project(':qihealonelibrary')
implementation project(':qiheonlinelibrary')
+ implementation project(':generallibrary')
implementation 'com.tencent.bugly:crashreport:4.1.9.3'
// 澶勭悊鍥剧墖
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 32c6434..451c135 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -41,15 +41,22 @@
android:supportsRtl="true"
android:theme="@style/AppTheme">
+<!-- <activity-->
+<!-- android:name="com.dayu.recharge.activity.LoginActivity"-->
+<!-- android:exported="true">-->
+<!-- <intent-filter>-->
+<!-- <action android:name="android.intent.action.MAIN" />-->
+<!-- <category android:name="android.intent.category.LAUNCHER" />-->
+<!-- </intent-filter>-->
+<!-- </activity>-->
<activity
- android:name="com.dayu.recharge.activity.LoginActivity"
+ android:name="com.dayu.general.activity.MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
-
<meta-data
android:name="BUGLY_APP_VERSION"
android:value="7.1" />
diff --git a/baselibrary/src/main/java/com/dayu/baselibrary/tools/nfc/BaseNFCHelper.java b/baselibrary/src/main/java/com/dayu/baselibrary/tools/nfc/BaseNFCHelper.java
index 249b1b0..d344342 100644
--- a/baselibrary/src/main/java/com/dayu/baselibrary/tools/nfc/BaseNFCHelper.java
+++ b/baselibrary/src/main/java/com/dayu/baselibrary/tools/nfc/BaseNFCHelper.java
@@ -22,10 +22,14 @@
public static byte[] companyKey;
/**
- * 瀵嗙爜闆嗗悎
+ * 鎵囧尯閮戒负缁熶竴瀵嗙爜鏃堕泦鍚�
*/
public static List<byte[]> listKeyA = new ArrayList<>();
+ /**
+ * 姣忎釜鎵囧尯瀵嗙爜涓嶅悓鏃堕泦鍚�
+ */
+ public static List<byte[]> listA_PS=new ArrayList<>();
//瀵嗙爜a鍖�
public static String companyKeyA;
diff --git a/baselibrary/src/main/java/com/dayu/baselibrary/tools/nfc/BaseNfcWriteHelper.java b/baselibrary/src/main/java/com/dayu/baselibrary/tools/nfc/BaseNfcWriteHelper.java
index 20ee427..4c7d684 100644
--- a/baselibrary/src/main/java/com/dayu/baselibrary/tools/nfc/BaseNfcWriteHelper.java
+++ b/baselibrary/src/main/java/com/dayu/baselibrary/tools/nfc/BaseNfcWriteHelper.java
@@ -30,6 +30,8 @@
public abstract boolean writeData(byte[] str, int a, int b);
+ public abstract boolean writeData(byte[] str, int a, int b,NFCCallBack callBack);
+
/**
* 淇敼瀵嗙爜
*
diff --git a/baselibrary/src/main/java/com/dayu/baselibrary/tools/nfc/NFCCallBack.java b/baselibrary/src/main/java/com/dayu/baselibrary/tools/nfc/NFCCallBack.java
new file mode 100644
index 0000000..8ca623c
--- /dev/null
+++ b/baselibrary/src/main/java/com/dayu/baselibrary/tools/nfc/NFCCallBack.java
@@ -0,0 +1,17 @@
+package com.dayu.baselibrary.tools.nfc;
+
+/**
+ * NFCCallBack -
+ *
+ * @author zuoxiao
+ * @version 1.0
+ * @since 2025-03-03
+ */
+public interface NFCCallBack {
+ /**
+ * 杩斿洖鏄惁鎴愬姛
+ *
+ * @param msg
+ */
+ void isSusses(boolean flag,String msg);
+}
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 bcad792..95ac200 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
@@ -53,6 +53,7 @@
*
* @return
*/
+ @Override
public BaseUserCardCard getUserCardData(BaseUserCardCard userCardCard) {
if (userCardCard!=null){
BaseUserCardCard userCard = null;
@@ -117,6 +118,7 @@
return null;
}
+ @Override
public String getCradType() {
MifareClassic mfc = MifareClassic.get(tag);
@@ -161,6 +163,7 @@
*
* @param callback
*/
+ @Override
public void getAllData(final NFCCallMapback callback) {
Map<String, List<byte[]>> map = new HashMap<>();
MifareClassic mfc = MifareClassic.get(tag);
@@ -232,6 +235,7 @@
*
* @param callback
*/
+ @Override
public void getOneSectorData(NFCCallListback callback) {
@@ -305,6 +309,7 @@
* @param b 鍧�
* @param callback
*/
+ @Override
public void getData(final int a, final int b, final NFCCallByteback callback) {
new Thread(new Runnable() {
@Override
@@ -543,6 +548,7 @@
*
* @return
*/
+ @Override
public BaseManagerToUserCard getManagerToUserCardData(BaseManagerToUserCard baseManagerToUserCard) {
BaseManagerToUserCard managerToUserCard = null;
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 ef15209..525b5aa 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
@@ -47,6 +47,7 @@
* @param userCard 鐢ㄦ埛鍗″唴瀹�
* @param
*/
+ @Override
public boolean writeUserData(BaseUserCardCard userCard) {
if (userCard != null) {
int a = 1;
@@ -113,7 +114,13 @@
* @param b 涔﹀啓鐨勫潡(浠�0寮�濮嬫暟)
* @param
*/
+ @Override
public boolean writeData(byte[] str, int a, int b) {
+ return writeData(str, a, b, null);
+ }
+
+ @Override
+ public boolean writeData(byte[] str, int a, int b, NFCCallBack callBack) {
Log.i("NFCWreatActivity", "writeData: a=" + a + " b=" + b);
if (str.length <= 16) {
try {
@@ -126,35 +133,87 @@
int count = mfc.getSectorCount();
//濡傛灉浼犺繘鏉ョ殑鎵囧尯澶т簡鎴栬�呭皬浜嗙洿鎺ラ��鍑烘柟娉�
if (a > count - 1 || a < 0) {
+ if (callBack != null) {
+ callBack.isSusses(false, "鎵囧尯閿欒--" + a);
+ }
return false;
}
//鑾峰彇鍐欑殑鎵囧尯鐨勫潡鐨勬暟閲�
int bCount = mfc.getBlockCountInSector(a);
//濡傛灉杈撳叆鐨勫潡澶т簡鎴栬�呭皬浜嗕篃鏄洿鎺ラ��鍑�
if (b > bCount - 1 || b < 0) {
+ if (callBack != null) {
+ callBack.isSusses(false, "鍧楀尯閿欒--" + b);
+ }
return false;
}
//楠岃瘉鎵囧尯瀵嗙爜
boolean isOpen = false;
- for (int i = 0; i < listKeyA.size(); i++) {
- if (mfc.authenticateSectorWithKeyA(0, listKeyA.get(i))) {
+ if (listKeyA.size() != 0) {
+ for (int i = 0; i < listKeyA.size(); i++) {
+ if (mfc.authenticateSectorWithKeyA(0, listKeyA.get(i))) {
+ isOpen = true;
+ if (listKeyA.get(i).equals(defauleKey)) {
+ //褰撳墠涓洪粯璁ょ櫧鍗″瘑鐮佹椂鍐欏崱鏃朵慨鏀瑰瘑鐮�
+ changePasword(a, mfc);
+ }
+ break;
+ }
+ }
+ } else if (listA_PS.size() != 0 && listA_PS.size() > a) {
+ if (mfc.authenticateSectorWithKeyA(0, listA_PS.get(a))) {
isOpen = true;
- if (listKeyA.get(i).equals(defauleKey)) {
+ if (listKeyA.get(a).equals(defauleKey)) {
//褰撳墠涓洪粯璁ょ櫧鍗″瘑鐮佹椂鍐欏崱鏃朵慨鏀瑰瘑鐮�
changePasword(a, mfc);
}
- break;
}
}
+
+
if (isOpen) {
int bIndex = mfc.sectorToBlock(a);
//鍐欏崱
mfc.writeBlock(bIndex + b, str);
- return true;
+ // 鏍¢獙鍐欏叆鏁版嵁鏄惁姝g‘
+ boolean isVerified = true;
+ // 璇诲彇鏁版嵁楠岃瘉
+ byte[] readResult = mfc.readBlock(bIndex + b);
+ if (readResult == null) {
+ if (callBack != null) {
+ callBack.isSusses(false, a + "鎵囧尯鍐欏崱鏃跺啀娆¤鍙栭獙璇佹椂澶辫触");
+ }
+ return false;
+ }
+ for (int i = 0; i < str.length; i++) {
+ if (str[i] != readResult[i]) {
+ isVerified = false;
+ break;
+ }
+ }
+ if (isVerified) {
+ if (callBack != null) {
+ callBack.isSusses(true, "鍐欏叆鎴愬姛骞堕獙璇侀�氳繃");
+ }
+ return true;
+
+ } else {
+ if (callBack != null) {
+ callBack.isSusses(false, "鍐欏叆楠岃瘉澶辫触");
+ }
+ return false;
+ }
+ }
+ if (callBack != null) {
+ callBack.isSusses(false, a + "鎵囧尯瀵嗙爜閿欒");
}
return false;
} catch (Exception e) {
e.printStackTrace();
+ if (callBack != null) {
+ callBack.isSusses(false, a + "鎵囧尯鍐欏崱鎶ラ敊" + e.getMessage());
+
+ }
return false;
} finally {
try {
@@ -179,12 +238,12 @@
* @param a 涔﹀啓鐨勬墖鍖�
* // * @param callback 杩斿洖鐩戝惉
*/
+ @Override
public boolean changePasword(int a, MifareClassic mfc) {
byte[] data = new byte[16];
if (null != mfc) {
try {
-
//灏嗗瘑鐮佽浆鎹负keyA
byte[] dataA = HexUtil.hexToByteArray(companyKeyA);
for (int i = 0; i < dataA.length; i++) {
@@ -218,6 +277,7 @@
*
* @return
*/
+ @Override
public boolean initCard() {
try {
MifareClassic mfc = MifareClassic.get(tag);
@@ -278,4 +338,6 @@
}
return false;
}
+
+
}
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 8eab97b..e8230c9 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
@@ -16,19 +16,20 @@
*/
public class NfcWriteAdapter extends BaseNfcWriteHelper {
NativeNfcWriteHelper nativeNfcWriteHelper;
+
public NfcWriteAdapter(Intent intent, Activity activity) {
- switch (BaseNfcActivity.adapterType){
+ switch (BaseNfcActivity.adapterType) {
case ModelUtils.defaultType:
- nativeNfcWriteHelper=new NativeNfcWriteHelper(intent,activity);
+ nativeNfcWriteHelper = new NativeNfcWriteHelper(intent, activity);
break;
}
}
@Override
public boolean writeUserData(BaseUserCardCard userCard) {
- switch (BaseNfcActivity.adapterType){
+ switch (BaseNfcActivity.adapterType) {
case ModelUtils.defaultType:
- return nativeNfcWriteHelper.writeUserData(userCard);
+ return nativeNfcWriteHelper.writeUserData(userCard);
}
return false;
@@ -36,9 +37,19 @@
@Override
public boolean writeData(byte[] str, int a, int b) {
- switch (BaseNfcActivity.adapterType){
+ switch (BaseNfcActivity.adapterType) {
case ModelUtils.defaultType:
- return nativeNfcWriteHelper.writeData(str,a,b);
+ return nativeNfcWriteHelper.writeData(str, a, b);
+
+ }
+ return false;
+ }
+
+ @Override
+ public boolean writeData(byte[] str, int a, int b, NFCCallBack callBack) {
+ switch (BaseNfcActivity.adapterType) {
+ case ModelUtils.defaultType:
+ return nativeNfcWriteHelper.writeData(str, a, b,callBack);
}
return false;
@@ -46,9 +57,9 @@
@Override
public boolean changePasword(int a, MifareClassic mfc) {
- switch (BaseNfcActivity.adapterType){
+ switch (BaseNfcActivity.adapterType) {
case ModelUtils.defaultType:
- return nativeNfcWriteHelper.changePasword(a,mfc);
+ return nativeNfcWriteHelper.changePasword(a, mfc);
}
return false;
diff --git a/generallibrary/CMakeLists.txt b/generallibrary/CMakeLists.txt
new file mode 100644
index 0000000..ffa3e45
--- /dev/null
+++ b/generallibrary/CMakeLists.txt
@@ -0,0 +1,44 @@
+# For more information about using CMake with Android Studio, read the
+# documentation: https://d.android.com/studio/projects/add-native-code.html
+
+# Sets the minimum version of CMake required to build the native library.
+
+cmake_minimum_required(VERSION 3.4.1)
+
+# Creates and names a library, sets it as either STATIC
+# or SHARED, and provides the relative paths to its source code.
+# You can define multiple libraries, and CMake builds them for you.
+# Gradle automatically packages shared libraries with your APK.
+
+add_library( # Sets the name of the library.
+ general-native-lib
+
+ # Sets the library as a shared library.
+ SHARED
+
+ # Provides a relative path to your source file(s).
+ src/main/cpp/general-native-lib.cpp )
+
+# Searches for a specified prebuilt library and stores the path as a
+# variable. Because CMake includes system libraries in the search path by
+# default, you only need to specify the name of the public NDK library
+# you want to add. CMake verifies that the library exists before
+# completing its build.
+
+find_library( # Sets the name of the path variable.
+ log-lib
+
+ # Specifies the name of the NDK library that
+ # you want CMake to locate.
+ log )
+
+# Specifies libraries CMake should link to your target library. You
+# can link multiple libraries, such as libraries you define in this
+# build script, prebuilt third-party libraries, or system libraries.
+
+target_link_libraries( # Specifies the target library.
+ general-native-lib
+
+ # Links the target library to the log library
+ # included in the NDK.
+ ${log-lib} )
\ No newline at end of file
diff --git a/generallibrary/build.gradle b/generallibrary/build.gradle
index cf692d6..80bf8d8 100644
--- a/generallibrary/build.gradle
+++ b/generallibrary/build.gradle
@@ -8,7 +8,7 @@
compileSdk 34
defaultConfig {
- minSdk 24
+ minSdk 23
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
@@ -27,14 +27,25 @@
kotlinOptions {
jvmTarget = '1.8'
}
+ dataBinding {
+ enabled = true;
+ }
+ viewBinding {
+ enabled = true;
+ }
+ externalNativeBuild {
+ cmake {
+ path "CMakeLists.txt"
+ }
+ }
}
dependencies {
implementation project(":baselibrary")
- implementation 'androidx.core:core-ktx:1.15.0'
- implementation 'androidx.appcompat:appcompat:1.7.0'
- implementation 'com.google.android.material:material:1.12.0'
+ implementation 'androidx.core:core-ktx:1.12.0'
+ implementation 'androidx.appcompat:appcompat:1.6.1'
+ implementation 'com.google.android.material:material:1.11.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
@@ -62,7 +73,14 @@
implementation 'com.pnikosis:materialish-progress:1.7'
//鍒楄〃
- compileOnly 'io.github.scwang90:refresh-layout-kernel:2.0.5'
- compileOnly 'io.github.scwang90:refresh-header-classics:2.0.5'
- compileOnly 'androidx.recyclerview:recyclerview:1.2.0'//缁忓吀鍒锋柊澶�
+ implementation 'io.github.scwang90:refresh-layout-kernel:2.0.5'
+ implementation 'io.github.scwang90:refresh-header-classics:2.0.5'
+ implementation 'androidx.recyclerview:recyclerview:1.3.2'
+
+ //寤鸿娣诲姞 ViewPager2 鐨勬槑纭緷璧�
+ implementation "androidx.viewpager2:viewpager2:1.1.0-beta01"
+ implementation "androidx.fragment:fragment:1.6.2"
+ implementation files('../baselibrary/libs/avi.library-2.1.3.aar')
+
+ implementation 'com.tencent.bugly:crashreport:4.1.9.3'
}
\ No newline at end of file
diff --git a/generallibrary/src/main/AndroidManifest.xml b/generallibrary/src/main/AndroidManifest.xml
index a5918e6..9db0f55 100644
--- a/generallibrary/src/main/AndroidManifest.xml
+++ b/generallibrary/src/main/AndroidManifest.xml
@@ -1,4 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.dayu.henanlibrary">
+
+ <uses-permission android:name="android.permission.NFC" />
+ <!--鐢ㄤ簬璁块棶缃戠粶锛岀綉缁滃畾浣嶉渶瑕佷笂缃�-->
+ <uses-permission android:name="android.permission.INTERNET" />
+ <uses-permission android:name="android.permission.BLUETOOTH" />
+ <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
+ <!-- 瑕佹眰褰撳墠璁惧蹇呴』瑕佹湁NFC鑺墖 -->
+ <uses-feature
+ android:name="android.hardware.nfc"
+ android:required="true" />
+
+ <!-- <intent-filter>-->
+ <!-- <action android:name="android.nfc.action.TAG_DISCOVERED" />-->
+ <!-- <data android:mimeType="text/plain" />-->
+ <!-- </intent-filter>-->
+ <!--鐢ㄤ簬杩涜缃戠粶瀹氫綅-->
+ <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"></uses-permission>
+ <!--鐢ㄤ簬璁块棶GPS瀹氫綅-->
+ <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
+ <!--鐢ㄤ簬鑾峰彇杩愯惀鍟嗕俊鎭紝鐢ㄤ簬鏀寔鎻愪緵杩愯惀鍟嗕俊鎭浉鍏崇殑鎺ュ彛-->
+ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>
+ <!--鐢ㄤ簬璁块棶wifi缃戠粶淇℃伅锛寃ifi淇℃伅浼氱敤浜庤繘琛岀綉缁滃畾浣�-->
+ <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission>
+ <!--鐢ㄤ簬鑾峰彇wifi鐨勮幏鍙栨潈闄愶紝wifi淇℃伅浼氱敤鏉ヨ繘琛岀綉缁滃畾浣�-->
+ <uses-permission android:name="android.permission.CHANGE_WIFI_STATE"></uses-permission>
+ <!--鐢ㄤ簬璇诲彇鎵嬫満褰撳墠鐨勭姸鎬�-->
+ <uses-permission android:name="android.permission.READ_PHONE_STATE"></uses-permission>
+ <!--鐢ㄤ簬鍐欏叆缂撳瓨鏁版嵁鍒版墿灞曞瓨鍌ㄥ崱-->
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
+ <!--鐢ㄤ簬鐢宠璋冪敤A-GPS妯″潡-->
+ <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"></uses-permission>
+
+ <application
+ android:allowBackup="true"
+ android:label="@string/app_name"
+ android:supportsRtl="true"
+ android:theme="@style/AppTheme">
+
+ <!-- <activity-->
+ <!-- android:name="com.dayu.recharge.activity.LoginActivity"-->
+ <!-- android:exported="true">-->
+ <!-- <intent-filter>-->
+ <!-- <action android:name="android.intent.action.MAIN" />-->
+ <!-- <category android:name="android.intent.category.LAUNCHER" />-->
+ <!-- </intent-filter>-->
+ <!-- </activity>-->
+ <activity android:name="com.dayu.general.activity.NewCardActivity" />
+
+
+ <meta-data
+ android:name="BUGLY_APP_VERSION"
+ android:value="7.1" />
+ </application>
</manifest>
\ No newline at end of file
diff --git a/generallibrary/src/main/cpp/general-native-lib.cpp b/generallibrary/src/main/cpp/general-native-lib.cpp
new file mode 100644
index 0000000..fad41ad
--- /dev/null
+++ b/generallibrary/src/main/cpp/general-native-lib.cpp
@@ -0,0 +1,135 @@
+#include <jni.h>
+#include <string>
+#include <android/log.h>
+#include <string.h>
+#include <jni.h>
+
+static jclass contextClass;
+static jclass signatureClass;
+static jclass packageNameClass;
+static jclass packageInfoClass;
+
+const char *RELEASE_SIGN = "308202b8308201a0020101300d06092a864886f70d01010b05003022310f300d06035504030c06e5a4a7e7a6b9310f300d06035504070c06e5a4a9e6b4a5301e170d3233313132303035333131325a170d3438313131333035333131325a3022310f300d06035504030c06e5a4a7e7a6b9310f300d06035504070c06e5a4a9e6b4a530820122300d06092a864886f70d01010105000382010f003082010a0282010100a0924f3d618e4a622def691e16e54ce5bdfd035bd73e7cb947d2bf3bd0c00afa26e52963e0299fc06d76d153be696c5285d630577e1dcb2b740a72b6d904482217de308fb91c8435441ed05e844ced1e5c3446d82cb8f38751049df26a42adcfc33f1f12c2ce03f676e5d148aad800ace89670b87835e2c02a8570a0b6740d9c0669d4cb3c597d0b2dd49fc0904e885773b6d3a87d9f1e73eb526e0d1a9e9e3c48d986938286cd824151b5a6214faf89d3e699524511b23c86d3b110a7f0bb56a6d2436f69816538a62a38cb1fee6eb685d267cc200df8af51b936bd280beaa2023f75678d77a11ac6de734b30af63d394c8b63bccf2115a47ea15c9212c740d0203010001300d06092a864886f70d01010b05000382010100307cafa9b14be91ba6424cfcc6aed75b069a1c4d6eb646eab0de93f372f236f5f0a6097499df99391075d6ced18d419a2b15adb041890e2b56a3bfbd6be40efee99c5c713ba8ea1d45da09b67916106116e96eb735271c4d53e0739f753145cbc42e149ad3d9507d422ec1c6f1a7f792a4542f9a64f0de3d4f4af69f0fb3390ef3577dcf8844cf744426d173b0934d879148062c5ca64022dc99af370dbfeaf2b5d4a279b20c54a361bca12c25bf185c2885519bbbc36e46ddb083080f0cc5b1f2eafe964ebce5071b0ae7d92a34a9193861b996d2c0299b1993f41063a27038199365a6e3cb27a02ffa9facdc48a63713eb5fbf90e9fd73056aba16b28e5fee";
+
+
+// 鍔犲瘑瀵嗛挜
+const unsigned char XOR_KEY[] = {0x7A, 0xB3, 0xC9, 0xD5, 0xE1, 0xF8, 0x42, 0x91, 0x37, 0x8F, 0x5D,
+ 0x2E};
+
+// 鍔犲瘑鍚庣殑M1鍗″瘑鐮佹暟缁�
+const unsigned char ENCRYPTED_SECTOR_KEYS[] = {
+ // 鎵囧尯0瀵嗙爜 (鍔犲瘑鍚�)
+ 0x9C, 0x45, 0x36, 0x55, 0x8C, 0x7F, 0x35, 0x93, 0x4B, 0x78, 0x2A, 0x79,
+ // 鎵囧尯1瀵嗙爜 (鍔犲瘑鍚�)
+ 0xB4, 0x52, 0x91, 0x45, 0x99, 0x87, 0x3C, 0xA3, 0x6E, 0x5F, 0x1D, 0x5E,
+ // 浠ヤ笅绫讳技鏍煎紡瀛樺偍鍏朵粬鎵囧尯瀵嗙爜...
+ 0x1E, 0x85, 0xEB, 0x51, 0xB9, 0x39, 0x02, 0x2E, 0x77, 0x1F, 0x3E, 0x93,
+ 0x22, 0x62, 0xBD, 0x83, 0x99, 0x2A, 0x2F, 0x19, 0x95, 0x07, 0x29, 0x2E,
+ 0x90, 0x18, 0xE0, 0x6A, 0xB7, 0x68, 0x34, 0x89, 0x42, 0x5B, 0x16, 0x47,
+ 0xA8, 0x0B, 0xB5, 0x97, 0xB4, 0x43, 0x1D, 0x62, 0x89, 0x73, 0x33, 0x2E,
+ 0x24, 0x9D, 0xB7, 0x46, 0x8D, 0x64, 0x49, 0x7A, 0x52, 0x41, 0x1C, 0x91,
+ 0x31, 0x78, 0x95, 0x52, 0x95, 0x39, 0x19, 0x4C, 0x81, 0x2A, 0x0D, 0x47,
+ 0xF5, 0x64, 0xA7, 0x93, 0xB9, 0x51, 0x27, 0x82, 0x43, 0x68, 0x31, 0x3F,
+ 0x55, 0x93, 0xB7, 0x68, 0x97, 0x9A, 0x37, 0x71, 0x52, 0x49, 0x17, 0x1E,
+ 0x8E, 0x93, 0xB5, 0x44, 0x8D, 0x42, 0x22, 0x84, 0x95, 0x33, 0x22, 0x93,
+ 0x42, 0x82, 0xA3, 0x35, 0x91, 0x33, 0x13, 0x93, 0x71, 0x21, 0x01, 0x71,
+ 0x37, 0x9F, 0xA6, 0x68, 0x92, 0x86, 0x46, 0x72, 0x43, 0x62, 0x12, 0x52,
+ 0x5D, 0x85, 0x93, 0x86, 0x82, 0x46, 0x31, 0x86, 0x57, 0x48, 0x16, 0x88,
+ 0x97, 0x73, 0xB5, 0x47, 0x95, 0x55, 0x36, 0x69, 0x49, 0x58, 0x18, 0x6A,
+ 0xEA, 0x46, 0x84, 0x93, 0x82, 0x19, 0x29, 0x91, 0x31, 0x1C, 0x0C, 0x7D
+};
+
+// 瑙e瘑鍑芥暟
+void decrypt_key(const unsigned char *encrypted, char *decrypted, size_t len) {
+ for (size_t i = 0; i < len; i++) {
+ decrypted[i] = encrypted[i] ^ XOR_KEY[i % sizeof(XOR_KEY)];
+ }
+ decrypted[len] = '\0';
+}
+
+//extern "C" JNIEXPORT jstring
+//
+//JNICALL
+//Java_com_yglx_testjni_MainActivity_getKey(
+// JNIEnv *env,
+// jobject /* this */) {
+// return env->NewStringUTF(AUTH_KEY);
+//}
+
+JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) {
+
+ JNIEnv *env = NULL;
+ jint result = -1;
+ if (vm->GetEnv((void **) &env, JNI_VERSION_1_4) != JNI_OK)
+ return result;
+
+ contextClass = (jclass) env->NewGlobalRef((env)->FindClass("android/content/Context"));
+ signatureClass = (jclass) env->NewGlobalRef((env)->FindClass("android/content/pm/Signature"));
+ packageNameClass = (jclass) env->NewGlobalRef(
+ (env)->FindClass("android/content/pm/PackageManager"));
+ packageInfoClass = (jclass) env->NewGlobalRef(
+ (env)->FindClass("android/content/pm/PackageInfo"));
+
+ __android_log_print(ANDROID_LOG_DEBUG, "jw", "sss");
+ return JNI_VERSION_1_4;
+}
+
+
+extern "C"
+JNIEXPORT jstring JNICALL
+Java_com_dayu_general_tool_GeBaseHelper_getM1SectorKeySecure(JNIEnv *env, jobject instance,
+ jobject contextObject,
+ jint sectorIndex) {
+ // 鑾峰彇鍖呯鐞嗗櫒鐩稿叧鏂规硶ID
+ jmethodID getPackageManagerId = (env)->GetMethodID(contextClass, "getPackageManager",
+ "()Landroid/content/pm/PackageManager;");
+ jmethodID getPackageNameId = (env)->GetMethodID(contextClass, "getPackageName",
+ "()Ljava/lang/String;");
+ jmethodID signToStringId = (env)->GetMethodID(signatureClass, "toCharsString",
+ "()Ljava/lang/String;");
+ jmethodID getPackageInfoId = (env)->GetMethodID(packageNameClass, "getPackageInfo",
+ "(Ljava/lang/String;I)Landroid/content/pm/PackageInfo;");
+
+ // 鑾峰彇搴旂敤绛惧悕淇℃伅
+ jobject packageManagerObject = (env)->CallObjectMethod(contextObject, getPackageManagerId);
+ jstring packNameString = (jstring) (env)->CallObjectMethod(contextObject, getPackageNameId);
+ jobject packageInfoObject = (env)->CallObjectMethod(packageManagerObject, getPackageInfoId,
+ packNameString, 64);
+ jfieldID signaturefieldID = (env)->GetFieldID(packageInfoClass, "signatures",
+ "[Landroid/content/pm/Signature;");
+ jobjectArray signatureArray = (jobjectArray) (env)->GetObjectField(packageInfoObject,
+ signaturefieldID);
+ jobject signatureObject = (env)->GetObjectArrayElement(signatureArray, 0);
+
+ // 鑾峰彇绛惧悕瀛楃涓�
+ const char *signStrng = (env)->GetStringUTFChars(
+ (jstring) (env)->CallObjectMethod(signatureObject, signToStringId), 0);
+
+ // 璋冭瘯鏃ュ織杈撳嚭
+ __android_log_print(ANDROID_LOG_DEBUG, "M1Card", "Current signature: %s", signStrng);
+
+ // 楠岃瘉绛惧悕骞惰繑鍥炴墍鏈夋墖鍖哄瘑鐮�
+ if (strcmp(signStrng, RELEASE_SIGN) == 0) {
+ size_t numKeys = sizeof(ENCRYPTED_SECTOR_KEYS) / 12; // 姣忎釜瀵嗛挜12瀛楄妭
+ char *allKeys = new char[numKeys * 13]; // 涓烘瘡涓瘑閽ラ鐣�12涓瓧绗�+1涓垎闅旂
+ allKeys[0] = '\0';
+
+ for (size_t i = 0; i < numKeys; i++) {
+ char decrypted[13];
+ decrypt_key(ENCRYPTED_SECTOR_KEYS + (i * 12), decrypted, 12);
+
+ strcat(allKeys, decrypted);
+ if (i < numKeys - 1) {
+ strcat(allKeys, ",");
+ }
+ }
+
+ jstring result = (env)->NewStringUTF(allKeys);
+ delete[] allKeys;
+ return result;
+ } else {
+ return (env)->NewStringUTF("signature_verification_failed");
+ }
+}
+
+
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 b6ac5c1..e19da99 100644
--- a/generallibrary/src/main/java/com/dayu/general/activity/BSCardFragment.kt
+++ b/generallibrary/src/main/java/com/dayu/general/activity/BSCardFragment.kt
@@ -1,9 +1,37 @@
package com.dayu.general.activity
+import android.content.Intent
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
import androidx.fragment.app.Fragment
+import com.dayu.general.databinding.FragmentCardBinding
+import com.tencent.bugly.proguard.v
class BSCardFragment :Fragment() {
+ private var binding: FragmentCardBinding? = null
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ }
+
+ override fun onCreateView(
+ inflater: LayoutInflater,
+ container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View? {
+ binding = FragmentCardBinding.inflate(LayoutInflater.from(context), container, false)
+ initView()
+ return binding?.root
+ }
+
+ private fun initView() {
+ binding?.homeNewCard?.setOnClickListener {
+ val intent = Intent(context, NewCardActivity::class.java)
+ startActivity(intent)
+ }
+ }
+}
-}
\ No newline at end of file
diff --git a/generallibrary/src/main/java/com/dayu/general/activity/BaseActivity.kt b/generallibrary/src/main/java/com/dayu/general/activity/BaseActivity.kt
index 2cc77ae..ea3ac13 100644
--- a/generallibrary/src/main/java/com/dayu/general/activity/BaseActivity.kt
+++ b/generallibrary/src/main/java/com/dayu/general/activity/BaseActivity.kt
@@ -12,7 +12,7 @@
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
- asynchBaseDao=BaseDaoSingleton.getAsynchInstance(this);
+// asynchBaseDao=BaseDaoSingleton.getAsynchInstance(this);
}
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 d30a700..0f8a324 100644
--- a/generallibrary/src/main/java/com/dayu/general/activity/MainActivity.kt
+++ b/generallibrary/src/main/java/com/dayu/general/activity/MainActivity.kt
@@ -1,28 +1,118 @@
package com.dayu.general.activity
import android.os.Bundle
+import android.view.LayoutInflater
+import androidx.core.content.ContextCompat
import androidx.fragment.app.Fragment
+import com.dayu.general.R
+import com.dayu.general.adapter.TabAdapter
+import com.dayu.general.databinding.ActivityMainBinding
-class MainActivity : BaseActivity(){
+class MainActivity : BaseActivity() {
-
+ var binding: ActivityMainBinding? = null
private val fragments: ArrayList<Fragment> = ArrayList()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
- setupFragments();
+ binding = ActivityMainBinding.inflate(LayoutInflater.from(this))
+ setContentView(binding?.root)
+ setupFragments()
+ initView()
+ initTab()
+
+
}
+ private fun initView() {
+ binding!!.BSCardLL.setOnClickListener { v -> changeBottomState(Tab.BSC) }
+ binding!!.rechargeLL.setOnClickListener { v -> changeBottomState(Tab.RECHARGE) }
+ binding!!.myLL.setOnClickListener { v -> changeBottomState(Tab.MY) }
+ }
private fun setupFragments() {
fragments.add(BSCardFragment())
fragments.add(RechargeFragment())
- fragments.add(BSCardFragment())
+ fragments.add(MyFragment())
}
+ private fun initTab() {
+ binding?.viewPager?.adapter = TabAdapter(this, fragments)
+ binding?.viewPager?.currentItem = (1)
+ binding?.viewPager?.offscreenPageLimit = 3
+ binding?.viewPager?.isUserInputEnabled = false
+ }
+ private enum class Tab {
+ BSC, RECHARGE, MY
+ }
+ /**
+ * 淇敼搴曢儴鐘舵��
+ */
+ private fun changeBottomState(tab: Tab) {
+ resetTabState()
+ when (tab) {
+ Tab.BSC -> updateTabUI(0, R.drawable.bottom_card_white, R.color.white)
+ Tab.RECHARGE -> updateTabUI(1, R.drawable.bottom_recharge_white, R.color.white)
+ Tab.MY -> updateTabUI(2, R.drawable.bottom_my_white, R.color.white)
+ }
+ }
+ /**
+ * 閲嶇疆鎵�鏈� Tab 鐨勯粯璁ょ姸鎬�
+ */
+ private fun resetTabState() {
+ binding!!.BSCardImg.setImageDrawable(
+ ContextCompat.getDrawable(
+ this,
+ R.drawable.bottom_card_black
+ )
+ )
+ binding!!.BSCardText.setTextColor(ContextCompat.getColor(this, R.color.black))
+ binding!!.rechargeImg.setImageDrawable(
+ ContextCompat.getDrawable(
+ this,
+ R.drawable.bottom_recharge_black
+ )
+ )
+ binding!!.rechargeText.setTextColor(ContextCompat.getColor(this, R.color.black))
+
+ binding!!.myImg.setImageDrawable(
+ ContextCompat.getDrawable(
+ this,
+ R.drawable.bottom_my_black
+ )
+ )
+ binding!!.myText.setTextColor(ContextCompat.getColor(this, R.color.black))
+ }
+
+ /**
+ * 鏇存柊鏌愪釜 Tab 鐨� UI 鐘舵��
+ */
+ private fun updateTabUI(position: Int, iconResId: Int, textColorResId: Int) {
+ if (position == 1) {
+ binding!!.viewPager.setCurrentItem(position, true)
+ } else {
+ binding!!.viewPager.setCurrentItem(position, false)
+ }
+ when (position) {
+ 0 -> {
+ binding!!.BSCardImg.setImageDrawable(ContextCompat.getDrawable(this, iconResId))
+ binding!!.BSCardText.setTextColor(ContextCompat.getColor(this, textColorResId))
+ }
+
+ 1 -> {
+ binding!!.rechargeImg.setImageDrawable(ContextCompat.getDrawable(this, iconResId))
+ binding!!.rechargeText.setTextColor(ContextCompat.getColor(this, textColorResId))
+ }
+
+ 2 -> {
+ binding!!.myImg.setImageDrawable(ContextCompat.getDrawable(this, iconResId))
+ binding!!.myText.setTextColor(ContextCompat.getColor(this, textColorResId))
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/generallibrary/src/main/java/com/dayu/general/activity/MyFragment.kt b/generallibrary/src/main/java/com/dayu/general/activity/MyFragment.kt
index 53ea87e..cafd478 100644
--- a/generallibrary/src/main/java/com/dayu/general/activity/MyFragment.kt
+++ b/generallibrary/src/main/java/com/dayu/general/activity/MyFragment.kt
@@ -1,8 +1,20 @@
package com.dayu.general.activity
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
import androidx.fragment.app.Fragment
+import com.dayu.general.databinding.FragmentMyBinding
-class MyFragment:Fragment() {
-
-
+class MyFragment : Fragment() {
+ var binding: FragmentMyBinding? = null;
+ override fun onCreateView(
+ inflater: LayoutInflater,
+ container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View? {
+ binding = FragmentMyBinding.inflate(inflater, container, false)
+ return binding?.root
+ }
}
\ No newline at end of file
diff --git a/generallibrary/src/main/java/com/dayu/general/activity/NewCardActivity.kt b/generallibrary/src/main/java/com/dayu/general/activity/NewCardActivity.kt
new file mode 100644
index 0000000..1108cfc
--- /dev/null
+++ b/generallibrary/src/main/java/com/dayu/general/activity/NewCardActivity.kt
@@ -0,0 +1,16 @@
+package com.dayu.general.activity
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import com.dayu.baselibrary.activity.BaseActivity
+import com.dayu.general.databinding.ActivityNewCardGeBinding
+
+class NewCardActivity:BaseActivity() {
+ var binding:ActivityNewCardGeBinding? = null
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ binding= ActivityNewCardGeBinding.inflate(LayoutInflater.from(this))
+ setContentView(binding?.root)
+ }
+
+}
\ No newline at end of file
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 04ad5c5..d1c6a49 100644
--- a/generallibrary/src/main/java/com/dayu/general/activity/RechargeFragment.kt
+++ b/generallibrary/src/main/java/com/dayu/general/activity/RechargeFragment.kt
@@ -1,6 +1,21 @@
package com.dayu.general.activity
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
import androidx.fragment.app.Fragment
+import com.dayu.general.databinding.FragmentRechargeBinding
-class RechargeFragment:Fragment() {
+class RechargeFragment : Fragment() {
+ var binding: FragmentRechargeBinding? = null
+
+ override fun onCreateView(
+ inflater: LayoutInflater,
+ container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View? {
+ binding = FragmentRechargeBinding.inflate(inflater, container, false)
+ return binding?.root;
+ }
}
\ No newline at end of file
diff --git a/generallibrary/src/main/java/com/dayu/general/adapter/TabAdapter.kt b/generallibrary/src/main/java/com/dayu/general/adapter/TabAdapter.kt
new file mode 100644
index 0000000..6bd73af
--- /dev/null
+++ b/generallibrary/src/main/java/com/dayu/general/adapter/TabAdapter.kt
@@ -0,0 +1,21 @@
+package com.dayu.general.adapter
+
+import androidx.fragment.app.Fragment
+import androidx.fragment.app.FragmentActivity
+import androidx.viewpager2.adapter.FragmentStateAdapter
+
+/**
+ * author: zuo
+ * Date: 2023/12/19
+ * Time: 17:53
+ * 澶囨敞锛�
+ */
+class TabAdapter(
+ fragmentActivity: FragmentActivity,
+ private val fragments: List<Fragment>
+) : FragmentStateAdapter(fragmentActivity) {
+
+ override fun createFragment(position: Int): Fragment = fragments[position]
+
+ override fun getItemCount(): Int = fragments.size
+}
\ No newline at end of file
diff --git a/generallibrary/src/main/java/com/dayu/general/bean/card/AreaCard.kt b/generallibrary/src/main/java/com/dayu/general/bean/card/AreaCard.kt
new file mode 100644
index 0000000..4684ee3
--- /dev/null
+++ b/generallibrary/src/main/java/com/dayu/general/bean/card/AreaCard.kt
@@ -0,0 +1,105 @@
+package com.dayu.general.bean.card
+
+import com.dayu.baselibrary.tools.BcdUtil
+import com.dayu.baselibrary.tools.HexUtil
+import java.io.Serializable
+
+/**
+ * 鍖哄煙琛ㄥ彿鍗�
+ * 鐢ㄤ簬閰嶇疆鎺у埗鍣ㄧ殑琛屾斂鍖哄煙鍙凤紝杈惧埌鍙湁鍖哄煙鍐呯敤鎴锋墠鑳藉埛鍗℃搷浣滅殑鐩殑
+ */
+class AreaCard : BaseCard(), Serializable {
+ companion object {
+ const val CARD_TYPE = "B0" // 鍗$被鍨嬪浐瀹氫负0xB0
+ 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
+ }
+
+ var areaNumber: Int = 0 // 鍥藉琛屾斂鍖哄煙鍙�(12浣岯CD,绮剧‘鍒版潙)
+ var projectCode: Int = 0 // 椤圭洰缂栫爜(HEX 1-255)
+
+ /**
+ * 鍐欏崱瀹屾垚鍚庢牎楠屾槸鍚﹀啓鍗℃垚鍔�
+ */
+ fun equalsAreaCard(data: List<ByteArray>?): Boolean {
+ if (data == null || data.isEmpty()) {
+ return false
+ }
+ return data[0].contentEquals(getZeroBytes())
+ }
+
+ /**
+ * 閫氳繃byte杞琤ean
+ */
+ fun getBean(data: List<ByteArray>): AreaCard? {
+ try {
+ val areaCard = AreaCard()
+ // 瑙f瀽绗�0鍧�
+ val zero = data[0]
+
+ // 瑙f瀽鍥藉琛屾斂鍖哄煙鍙�(0-5浣�)
+ val areaCodeBytes = zero.copyOfRange(0, 6)
+ areaCard.areaNumber = BcdUtil.bcdToStr(areaCodeBytes).toInt()
+
+ // 瑙f瀽椤圭洰缂栫爜(6浣�)
+ areaCard.projectCode = HexUtil.get16To10LowHightByBytes(byteArrayOf(zero[6]))
+
+ // 楠岃瘉鍗$被鍨嬪拰璇嗗埆鐮�
+ if (HexUtil.byteToHex(zero[8]) != CARD_TYPE ||
+ zero[9] != IDENTIFY_CODE_A0 ||
+ zero[10] != IDENTIFY_CODE_B1 ||
+ zero[11] != IDENTIFY_CODE_C2 ||
+ zero[12] != IDENTIFY_CODE_89) {
+ return null
+ }
+
+ return areaCard
+ } catch (e: Exception) {
+ e.printStackTrace()
+ return null
+ }
+ }
+
+ /**
+ * 鐢熸垚绗�0鍧楁暟鎹�
+ */
+ inner class Zero : BaseCard() {
+ fun toBytes(): ByteArray {
+ val data = ByteArray(16)
+ try {
+ // 璁剧疆鍥藉琛屾斂鍖哄煙鍙�(BCD鏍煎紡锛�6瀛楄妭锛�0-5浣�)
+ val areaCodeBytes = BcdUtil.strToBcd(String.format("%012d", areaNumber))
+ System.arraycopy(areaCodeBytes, 0, data, 0, 6)
+
+ // 璁剧疆椤圭洰缂栫爜(6浣�)
+ data[6] = projectCode.toByte()
+
+ // 璁剧疆澶囩敤浣�(7浣�)
+ data[7] = 0x00
+
+ // 璁剧疆鍗$被鍨�(8浣�)
+ data[8] = HexUtil.hexToByte(CARD_TYPE)
+
+ // 璁剧疆璇嗗埆鐮�(9-12浣�)
+ data[9] = IDENTIFY_CODE_A0
+ data[10] = IDENTIFY_CODE_B1
+ data[11] = IDENTIFY_CODE_C2
+ data[12] = IDENTIFY_CODE_89
+
+ // 璁剧疆澶囩敤浣�(13-14浣�)
+ data[13] = 0x00
+ data[14] = 0x00
+
+ // 璁剧疆鏍¢獙鍜�(15浣�)
+ data[15] = getByteSum(data)
+ } catch (e: Exception) {
+ e.printStackTrace()
+ }
+ return data
+ }
+ }
+
+ fun getZeroBytes(): ByteArray = Zero().toBytes()
+}
\ No newline at end of file
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
new file mode 100644
index 0000000..7e17509
--- /dev/null
+++ b/generallibrary/src/main/java/com/dayu/general/bean/card/BaseCard.kt
@@ -0,0 +1,48 @@
+package com.dayu.general.bean.card
+
+import com.dayu.baselibrary.dao.AppDatabase
+import com.dayu.baselibrary.tools.HexUtil
+import com.dayu.general.bean.db.CardData
+import com.dayu.general.dao.AppDataBase
+import com.tencent.bugly.crashreport.CrashReport
+
+open class BaseCard {
+ var cardData: String? = null //鏍囪瘑鐮�
+
+ fun setCardData(baseDao: AppDataBase, cardType: String?) {
+ try {
+ val cardDataBean: CardData =
+ baseDao.cardDataDao().findFirst(cardType)
+ cardData = if (cardDataBean != null) {
+ cardDataBean.cardIdentifying
+ } else {
+ CardCommon.getDefaultCardData(cardType)
+ }
+ } catch (e: Exception) {
+ CrashReport.postCatchedException(e)
+ }
+ }
+
+
+ /**
+ * 鍓�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
diff --git a/generallibrary/src/main/java/com/dayu/general/bean/card/CardCommon.kt b/generallibrary/src/main/java/com/dayu/general/bean/card/CardCommon.kt
new file mode 100644
index 0000000..fac205c
--- /dev/null
+++ b/generallibrary/src/main/java/com/dayu/general/bean/card/CardCommon.kt
@@ -0,0 +1,132 @@
+package com.dayu.general.bean.card
+
+class CardCommon {
+
+ val ERROR: Int = -1
+ //杩炴帴涓柇 鎻愮ず鐢ㄦ埛閲嶆柊杩炴帴鎴栨彁绀虹敤鎴烽噸鏂伴潬杩戝崱鐗�
+
+ val ERROR_MOVE: Int = -2
+
+ /**
+ * 鐢ㄦ埛鍒峰崱寮�娉靛墠
+ */
+
+ val USER_CARD_TYPE_1: String = "A1"
+
+ /**
+ * 鐢ㄦ埛鍒峰崱寮�娉靛悗
+ */
+
+ val USER_CARD_TYPE_2: String = "A8"
+
+ /**
+ * 鐢ㄦ埛鍙犲姞鍏呭��
+ */
+
+ val USER_CARD_TYPE_3: String = "A2"
+
+
+ /**
+ * 璁剧疆鍖哄煙琛ㄥ彿鍗�
+ */
+
+ val REGION: String = "B0"
+
+
+ /**
+ * 璁剧疆鐢ㄦ埛鐢甸噺鍗曚环鍗�
+ */
+
+ val ELECTRIC_PRICE: String = "B1"
+
+
+ /**
+ * 绠$悊鍗�
+ */
+
+ val MANAGE_CRAD: String = "B2"
+
+
+ /**
+ * 娓呴浂鍗�
+ */
+
+ val CLEAN_CARD_TYPE: String = "C8"
+
+
+ /**
+ * 瀵嗙爜鍗�
+ */
+
+ val PASS_WORD_CRAD_TYPE: String = "B3"
+
+
+ /**
+ * 閰嶇疆榛戝崱 褰撶敤鎴蜂涪澶卞崱鏃讹紝闇�瑕佸湪瀵瑰簲鐨勬帶鍒跺櫒鎶婃鐢ㄦ埛閰嶇疆涓洪粦鎴凤紝闃叉闈炴硶鐢ㄦ按
+ */
+
+ val BLACK: String = "B4"
+
+
+ /**
+ * 浠ヤ笅鏈敤鍒�
+ * *****************************************************************************************************************************************
+ */
+ /**
+ * 閲嶆柊娉ㄥ唽璁惧鍗�
+ */
+
+ val REGISTERED_CARD_TYPE: String = "BA"
+
+ /**
+ * 鍒犻櫎鍏ㄩ儴鐢ㄦ埛鍗�
+ */
+
+ val CLEAN_ALL_USER_CARD_TYPE: String = "BB"
+
+ /**
+ * 璁剧疆鍩熷悕鍗�
+ */
+
+ val DOMAIN_CARD_TYPE: String = "C1"
+
+ /**
+ * 娴嬭瘯鍗�
+ */
+
+ val TEST_CARD_TYPE: String = "A4"
+
+ /**
+ * 閰嶇疆璁惧娉ㄥ唽淇℃伅鍗�
+ */
+
+ val CONFIGURATION_CARD_TYPE: String = "BC"
+
+ /**
+ * 閰嶇疆姘存车鍔熺巼鍗�
+ */
+
+ val CONFIGURATION_POWER_CARD_TYPE: String = "BD"
+
+ /**
+ * 鑾峰彇榛樿鐨勫崱鏍囪瘑
+ *
+ * @param cardType 鍗$墖绫诲瀷
+ * @return 鍗″唴瀹�
+ */
+ fun getDefaultCardData(cardType: String?): String {
+ var cardData = ""
+ when (cardType) {
+ CLEAN_CARD_TYPE -> cardData = "3668F7A30119"
+ MANAGE_CRAD, REGISTERED_CARD_TYPE, CLEAN_ALL_USER_CARD_TYPE, TEST_CARD_TYPE, CONFIGURATION_CARD_TYPE, CONFIGURATION_POWER_CARD_TYPE, PASS_WORD_CRAD_TYPE, BLACK, ELECTRIC_PRICE -> cardData =
+ "A0B1C289"
+ }
+ return cardData
+ }
+
+ companion object {
+ fun getDefaultCardData(cardType: String?): String? {
+ return getDefaultCardData(cardType)
+ }
+ }
+}
\ No newline at end of file
diff --git a/generallibrary/src/main/java/com/dayu/general/bean/card/CheckCard.kt b/generallibrary/src/main/java/com/dayu/general/bean/card/CheckCard.kt
new file mode 100644
index 0000000..728dba8
--- /dev/null
+++ b/generallibrary/src/main/java/com/dayu/general/bean/card/CheckCard.kt
@@ -0,0 +1,93 @@
+package com.dayu.general.bean.card
+
+import com.dayu.baselibrary.tools.HexUtil
+import java.io.Serializable
+
+/**
+ * 妫�鏌ュ崱
+ * 鐢ㄤ簬鍒峰崱鏄剧ず鎺у埗鍣ㄥ熀鏈俊鎭細鎺у埗鍣↖D鍙枫�佹按閲忓崟浣嶃�佺數閲忓崟浠凤紝鏈笂鎶ョ殑鏁版嵁鏉℃暟绛変俊鎭�
+ */
+class CheckCard : BaseCard(), Serializable {
+ companion object {
+ const val CARD_TYPE = "B3" // 鍗$被鍨嬶細妫�鏌ュ崱
+ 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 equalsCheckCard(data: List<ByteArray>?): Boolean {
+ if (data == null || data.isEmpty()) {
+ return false
+ }
+ return data[0].contentEquals(getZeroBytes())
+ }
+
+ /**
+ * 閫氳繃byte杞琤ean
+ */
+ fun getBean(data: List<ByteArray>): CheckCard? {
+ try {
+ val checkCard = CheckCard()
+ // 瑙f瀽绗�0鍧�
+ val zero = data[0]
+
+ // 楠岃瘉鍗$被鍨�(8浣�)
+ if (HexUtil.byteToHex(zero[8]) != CARD_TYPE) {
+ return null
+ }
+
+ // 楠岃瘉璇嗗埆鐮�(9-12浣�)
+ if (zero[9] != IDENTIFY_CODE_A0 ||
+ zero[10] != IDENTIFY_CODE_B1 ||
+ zero[11] != IDENTIFY_CODE_C2 ||
+ zero[12] != IDENTIFY_CODE_89) {
+ return null
+ }
+
+ return checkCard
+ } catch (e: Exception) {
+ e.printStackTrace()
+ return null
+ }
+ }
+
+ /**
+ * 鐢熸垚绗�0鍧楁暟鎹�
+ */
+ inner class Zero : BaseCard() {
+ fun toBytes(): ByteArray {
+ val data = ByteArray(16)
+ try {
+ // 璁剧疆澶囩敤浣�(0-7浣�)
+ for (i in 0..7) {
+ data[i] = 0x00
+ }
+
+ // 璁剧疆鍗$被鍨�(8浣�)
+ data[8] = HexUtil.hexToByte(CARD_TYPE)
+
+ // 璁剧疆璇嗗埆鐮�(9-12浣�)
+ data[9] = IDENTIFY_CODE_A0
+ data[10] = IDENTIFY_CODE_B1
+ data[11] = IDENTIFY_CODE_C2
+ data[12] = IDENTIFY_CODE_89
+
+ // 璁剧疆澶囩敤浣�(13-14浣�)
+ data[13] = 0x00
+ data[14] = 0x00
+
+ // 璁剧疆鏍¢獙鍜�(15浣�)
+ data[15] = getByteSum(data)
+ } catch (e: Exception) {
+ e.printStackTrace()
+ }
+ return data
+ }
+ }
+
+ fun getZeroBytes(): ByteArray = Zero().toBytes()
+}
\ No newline at end of file
diff --git a/generallibrary/src/main/java/com/dayu/general/bean/card/ClearCard.kt b/generallibrary/src/main/java/com/dayu/general/bean/card/ClearCard.kt
new file mode 100644
index 0000000..938e8f2
--- /dev/null
+++ b/generallibrary/src/main/java/com/dayu/general/bean/card/ClearCard.kt
@@ -0,0 +1,93 @@
+package com.dayu.general.bean.card
+
+import com.dayu.baselibrary.tools.HexUtil
+import java.io.Serializable
+
+/**
+ * 娓呴浂鍗�
+ * 涓昏鐢ㄤ簬鍐呴儴鐢熶骇璋冭瘯鐢�
+ */
+class ClearCard : BaseCard(), Serializable {
+ companion object {
+ const val CARD_TYPE = "C1" // 鍗$被鍨嬶細娓呴浂鍗�
+ 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 equalsClearCard(data: List<ByteArray>?): Boolean {
+ if (data == null || data.isEmpty()) {
+ return false
+ }
+ return data[0].contentEquals(getZeroBytes())
+ }
+
+ /**
+ * 閫氳繃byte杞琤ean
+ */
+ fun getBean(data: List<ByteArray>): ClearCard? {
+ try {
+ val clearCard = ClearCard()
+ // 瑙f瀽绗�0鍧�
+ val zero = data[0]
+
+ // 楠岃瘉鍗$被鍨�(8浣�)
+ if (HexUtil.byteToHex(zero[8]) != CARD_TYPE) {
+ return null
+ }
+
+ // 楠岃瘉璇嗗埆鐮�(9-12浣�)
+ if (zero[9] != IDENTIFY_CODE_A0 ||
+ zero[10] != IDENTIFY_CODE_B1 ||
+ zero[11] != IDENTIFY_CODE_C2 ||
+ zero[12] != IDENTIFY_CODE_89) {
+ return null
+ }
+
+ return clearCard
+ } catch (e: Exception) {
+ e.printStackTrace()
+ return null
+ }
+ }
+
+ /**
+ * 鐢熸垚绗�0鍧楁暟鎹�
+ */
+ inner class Zero : BaseCard() {
+ fun toBytes(): ByteArray {
+ val data = ByteArray(16)
+ try {
+ // 璁剧疆澶囩敤浣�(0-7浣�)
+ for (i in 0..7) {
+ data[i] = 0x00
+ }
+
+ // 璁剧疆鍗$被鍨�(8浣�)
+ data[8] = HexUtil.hexToByte(CARD_TYPE)
+
+ // 璁剧疆璇嗗埆鐮�(9-12浣�)
+ data[9] = IDENTIFY_CODE_A0
+ data[10] = IDENTIFY_CODE_B1
+ data[11] = IDENTIFY_CODE_C2
+ data[12] = IDENTIFY_CODE_89
+
+ // 璁剧疆澶囩敤浣�(13-14浣�)
+ data[13] = 0x00
+ data[14] = 0x00
+
+ // 璁剧疆鏍¢獙鍜�(15浣�)
+ data[15] = getByteSum(data)
+ } catch (e: Exception) {
+ e.printStackTrace()
+ }
+ return data
+ }
+ }
+
+ fun getZeroBytes(): ByteArray = Zero().toBytes()
+}
\ No newline at end of file
diff --git a/generallibrary/src/main/java/com/dayu/general/bean/card/DebugCard.kt b/generallibrary/src/main/java/com/dayu/general/bean/card/DebugCard.kt
new file mode 100644
index 0000000..845125c
--- /dev/null
+++ b/generallibrary/src/main/java/com/dayu/general/bean/card/DebugCard.kt
@@ -0,0 +1,157 @@
+package com.dayu.general.bean.card
+
+import com.dayu.baselibrary.tools.HexUtil
+import java.io.Serializable
+
+/**
+ * 璋冭瘯鍗�
+ * 涓昏鐢ㄤ簬瀹夎璋冭瘯鐢細
+ * 1. 绗竴娆″埛鍗℃椂寮�鍚按娉垫垨闃�闂�
+ * 2. 绗簩娆″埛鍗″叧闂按娉垫垨闃�闂�
+ * 3. 鍒峰崱寮�鍚悗1鍒嗛挓鍐呮病鏈夊埛鍗″叧闂紝鍒欒嚜鍔ㄥ叧闂按娉垫垨闃�闂�
+ */
+class DebugCard : BaseCard(), Serializable {
+ companion object {
+ const val CARD_TYPE = "B4" // 鍗$被鍨嬶細璋冭瘯鍗�
+ 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
+
+ const val AUTO_CLOSE_TIMEOUT = 60_000L // 鑷姩鍏抽棴瓒呮椂鏃堕棿锛�1鍒嗛挓锛�
+ }
+
+ private var pumpOpenTime: Long = 0L // 姘存车寮�鍚椂闂�
+ private var isPumpOpen: Boolean = false // 姘存车鐘舵��
+
+ /**
+ * 鍐欏崱瀹屾垚鍚庢牎楠屾槸鍚﹀啓鍗℃垚鍔�
+ */
+ fun equalsDebugCard(data: List<ByteArray>?): Boolean {
+ if (data == null || data.isEmpty()) {
+ return false
+ }
+ return data[0].contentEquals(getZeroBytes())
+ }
+
+ /**
+ * 閫氳繃byte杞琤ean
+ */
+ fun getBean(data: List<ByteArray>): DebugCard? {
+ try {
+ val debugCard = DebugCard()
+ // 瑙f瀽绗�0鍧�
+ val zero = data[0]
+
+ // 楠岃瘉鍗$被鍨�(8浣�)
+ if (HexUtil.byteToHex(zero[8]) != CARD_TYPE) {
+ return null
+ }
+
+ // 楠岃瘉璇嗗埆鐮�(9-12浣�)
+ if (zero[9] != IDENTIFY_CODE_A0 ||
+ zero[10] != IDENTIFY_CODE_B1 ||
+ zero[11] != IDENTIFY_CODE_C2 ||
+ zero[12] != IDENTIFY_CODE_89) {
+ return null
+ }
+
+ return debugCard
+ } catch (e: Exception) {
+ e.printStackTrace()
+ return null
+ }
+ }
+
+ /**
+ * 鐢熸垚绗�0鍧楁暟鎹�
+ */
+ inner class Zero : BaseCard() {
+ fun toBytes(): ByteArray {
+ val data = ByteArray(16)
+ try {
+ // 璁剧疆澶囩敤浣�(0-7浣�)
+ for (i in 0..7) {
+ data[i] = 0x00
+ }
+
+ // 璁剧疆鍗$被鍨�(8浣�)
+ data[8] = HexUtil.hexToByte(CARD_TYPE)
+
+ // 璁剧疆璇嗗埆鐮�(9-12浣�)
+ data[9] = IDENTIFY_CODE_A0
+ data[10] = IDENTIFY_CODE_B1
+ data[11] = IDENTIFY_CODE_C2
+ data[12] = IDENTIFY_CODE_89
+
+ // 璁剧疆澶囩敤浣�(13-14浣�)
+ data[13] = 0x00
+ data[14] = 0x00
+
+ // 璁剧疆鏍¢獙鍜�(15浣�)
+ data[15] = getByteSum(data)
+ } catch (e: Exception) {
+ e.printStackTrace()
+ }
+ return data
+ }
+ }
+
+ /**
+ * 鍒囨崲姘存车鐘舵��
+ * @return 褰撳墠姘存车鐘舵��
+ */
+ fun togglePumpState(): Boolean {
+ val currentTime = System.currentTimeMillis()
+
+ if (!isPumpOpen) {
+ // 寮�鍚按娉�
+ isPumpOpen = true
+ pumpOpenTime = currentTime
+ } else {
+ // 鍏抽棴姘存车
+ isPumpOpen = false
+ pumpOpenTime = 0L
+ }
+
+ return isPumpOpen
+ }
+
+ /**
+ * 妫�鏌ユ槸鍚﹂渶瑕佽嚜鍔ㄥ叧闂按娉�
+ * @return true 濡傛灉闇�瑕佽嚜鍔ㄥ叧闂紝false 鍚﹀垯
+ */
+ fun shouldAutoClose(): Boolean {
+ if (!isPumpOpen) return false
+
+ val currentTime = System.currentTimeMillis()
+ return currentTime - pumpOpenTime >= AUTO_CLOSE_TIMEOUT
+ }
+
+ /**
+ * 鑷姩鍏抽棴姘存车
+ */
+ fun autoClosePump() {
+ isPumpOpen = false
+ pumpOpenTime = 0L
+ }
+
+ /**
+ * 鑾峰彇姘存车鐘舵��
+ */
+ fun isPumpOpen(): Boolean = isPumpOpen
+
+ /**
+ * 鑾峰彇姘存车寮�鍚墿浣欐椂闂达紙姣锛�
+ * @return 鍓╀綑鏃堕棿锛屽鏋滄按娉靛叧闂垯杩斿洖0
+ */
+ fun getRemainingTime(): Long {
+ if (!isPumpOpen) return 0L
+
+ val currentTime = System.currentTimeMillis()
+ val remainingTime = AUTO_CLOSE_TIMEOUT - (currentTime - pumpOpenTime)
+ return if (remainingTime > 0) remainingTime else 0L
+ }
+
+ fun getZeroBytes(): ByteArray = Zero().toBytes()
+}
\ No newline at end of file
diff --git a/generallibrary/src/main/java/com/dayu/general/bean/card/DomainSettingCard.kt b/generallibrary/src/main/java/com/dayu/general/bean/card/DomainSettingCard.kt
new file mode 100644
index 0000000..c337761
--- /dev/null
+++ b/generallibrary/src/main/java/com/dayu/general/bean/card/DomainSettingCard.kt
@@ -0,0 +1,213 @@
+package com.dayu.general.bean.card
+
+import com.dayu.baselibrary.tools.HexUtil
+import java.io.Serializable
+
+/**
+ * 鍩熷悕璁剧疆鍗�
+ * 鐢ㄤ簬椤圭洰鐜板満淇敼鍩熷悕锛岄�氳繃鍒峰崱鏂瑰紡淇敼鍩熷悕
+ */
+class DomainSettingCard : BaseCard(), Serializable {
+ companion object {
+ const val CARD_TYPE = "B6" // 鍗$被鍨嬶細鍩熷悕璁剧疆鍗�
+ 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
+
+ const val MAX_DOMAIN_ROUTE = 4 // 鏈�澶у煙鍚嶈矾鏁�
+ const val MAX_DOMAIN_LENGTH = 38 // 鏈�澶у煙鍚嶉暱搴�
+ }
+
+ var domainRouteNumber: Int = 1 // 鍩熷悕搴忓垪鍙�(1-4)
+ var domain: String = "" // 鍩熷悕
+ var domainLength: Int = 0 // 鍩熷悕闀垮害
+
+ /**
+ * 鍐欏崱瀹屾垚鍚庢牎楠屾槸鍚﹀啓鍗℃垚鍔�
+ */
+ fun equalsDomainSettingCard(data: List<ByteArray>?): Boolean {
+ if (data == null || data.size < 3) {
+ return false
+ }
+ return data[0].contentEquals(getZeroBytes()) &&
+ data[1].contentEquals(getOneBytes()) &&
+ data[2].contentEquals(getTwoBytes())
+ }
+
+ /**
+ * 閫氳繃byte杞琤ean
+ */
+ fun getBean(data: List<ByteArray>): DomainSettingCard? {
+ try {
+ val domainSettingCard = DomainSettingCard()
+
+ // 瑙f瀽绗�0鍧�
+ val zero = data[0]
+
+ // 楠岃瘉鍗$被鍨�(8浣�)
+ if (HexUtil.byteToHex(zero[8]) != CARD_TYPE) {
+ return null
+ }
+
+ // 楠岃瘉璇嗗埆鐮�(9-12浣�)
+ if (zero[9] != IDENTIFY_CODE_A0 ||
+ zero[10] != IDENTIFY_CODE_B1 ||
+ zero[11] != IDENTIFY_CODE_C2 ||
+ zero[12] != IDENTIFY_CODE_89) {
+ return null
+ }
+
+ // 瑙f瀽鍩熷悕璺暟(13浣�)
+ val routeNumber = zero[13].toInt()
+ if (routeNumber !in 1..MAX_DOMAIN_ROUTE) {
+ return null
+ }
+ domainSettingCard.domainRouteNumber = routeNumber
+
+ // 瑙f瀽鍩熷悕闀垮害(14浣�)
+ domainSettingCard.domainLength = zero[14].toInt()
+
+ // 瑙f瀽鍩熷悕鍓�8涓瓧绗�(0-7浣�)
+ val domainBuilder = StringBuilder()
+ for (i in 0..7) {
+ if (zero[i] != 0.toByte()) {
+ domainBuilder.append(zero[i].toInt().toChar())
+ }
+ }
+
+ // 瑙f瀽绗�1鍧� - 鍩熷悕涓棿15涓瓧绗�
+ val one = data[1]
+ for (i in 0..14) {
+ if (one[i] != 0.toByte()) {
+ domainBuilder.append(one[i].toInt().toChar())
+ }
+ }
+
+ // 瑙f瀽绗�2鍧� - 鍩熷悕鍓╀綑15涓瓧绗�
+ val two = data[2]
+ for (i in 0..14) {
+ if (two[i] != 0.toByte()) {
+ domainBuilder.append(two[i].toInt().toChar())
+ }
+ }
+
+ domainSettingCard.domain = domainBuilder.toString()
+
+ return domainSettingCard
+ } catch (e: Exception) {
+ e.printStackTrace()
+ return null
+ }
+ }
+
+ /**
+ * 鐢熸垚绗�0鍧楁暟鎹�
+ */
+ inner class Zero : BaseCard() {
+ fun toBytes(): ByteArray {
+ val data = ByteArray(16)
+ try {
+ // 鍐欏叆鍩熷悕鍓�8涓瓧绗�(0-7浣�)
+ domain.take(8).forEachIndexed { index, char ->
+ data[index] = char.code.toByte()
+ }
+ // 琛�0
+ for (i in domain.length.coerceAtMost(8) until 8) {
+ data[i] = 0
+ }
+
+ // 璁剧疆鍗$被鍨�(8浣�)
+ data[8] = HexUtil.hexToByte(CARD_TYPE)
+
+ // 璁剧疆璇嗗埆鐮�(9-12浣�)
+ data[9] = IDENTIFY_CODE_A0
+ data[10] = IDENTIFY_CODE_B1
+ data[11] = IDENTIFY_CODE_C2
+ data[12] = IDENTIFY_CODE_89
+
+ // 璁剧疆鍩熷悕璺暟(13浣�)
+ data[13] = domainRouteNumber.toByte()
+
+ // 璁剧疆鍩熷悕闀垮害(14浣�)
+ data[14] = domain.length.toByte()
+
+ // 璁剧疆鏍¢獙鍜�(15浣�)
+ data[15] = getByteSum(data)
+ } catch (e: Exception) {
+ e.printStackTrace()
+ }
+ return data
+ }
+ }
+
+ /**
+ * 鐢熸垚绗�1鍧楁暟鎹� - 鍩熷悕涓棿閮ㄥ垎
+ */
+ inner class One : BaseCard() {
+ fun toBytes(): ByteArray {
+ val data = ByteArray(16)
+ try {
+ // 鍐欏叆鍩熷悕涓棿15涓瓧绗�(0-14浣�)
+ domain.drop(8).take(15).forEachIndexed { index, char ->
+ data[index] = char.code.toByte()
+ }
+ // 琛�0
+ for (i in (domain.length - 8).coerceAtMost(15) until 15) {
+ data[i] = 0
+ }
+
+ // 璁剧疆鏍¢獙鍜�(15浣�)
+ data[15] = getByteSum(data)
+ } catch (e: Exception) {
+ e.printStackTrace()
+ }
+ return data
+ }
+ }
+
+ /**
+ * 鐢熸垚绗�2鍧楁暟鎹� - 鍩熷悕缁撳熬閮ㄥ垎
+ */
+ inner class Two : BaseCard() {
+ fun toBytes(): ByteArray {
+ val data = ByteArray(16)
+ try {
+ // 鍐欏叆鍩熷悕鏈�鍚�15涓瓧绗�(0-14浣�)
+ domain.drop(23).take(15).forEachIndexed { index, char ->
+ data[index] = char.code.toByte()
+ }
+ // 琛�0
+ for (i in (domain.length - 23).coerceAtMost(15) until 15) {
+ data[i] = 0
+ }
+
+ // 璁剧疆鏍¢獙鍜�(15浣�)
+ data[15] = getByteSum(data)
+ } catch (e: Exception) {
+ e.printStackTrace()
+ }
+ return data
+ }
+ }
+
+ /**
+ * 楠岃瘉鍩熷悕鏍煎紡鏄惁姝g‘
+ */
+ fun isValidDomain(): Boolean {
+ return domain.isNotEmpty() &&
+ domain.length <= MAX_DOMAIN_LENGTH &&
+ domain.matches(Regex("^[a-zA-Z0-9.-]+$"))
+ }
+
+ /**
+ * 楠岃瘉鍩熷悕璺暟鏄惁姝g‘
+ */
+ fun isValidRouteNumber(): Boolean {
+ return domainRouteNumber in 1..MAX_DOMAIN_ROUTE
+ }
+
+ fun getZeroBytes(): ByteArray = Zero().toBytes()
+ fun getOneBytes(): ByteArray = One().toBytes()
+ fun getTwoBytes(): ByteArray = Two().toBytes()
+}
\ No newline at end of file
diff --git a/generallibrary/src/main/java/com/dayu/general/bean/card/FetchDataCard.kt b/generallibrary/src/main/java/com/dayu/general/bean/card/FetchDataCard.kt
new file mode 100644
index 0000000..3d5d658
--- /dev/null
+++ b/generallibrary/src/main/java/com/dayu/general/bean/card/FetchDataCard.kt
@@ -0,0 +1,132 @@
+package com.dayu.general.bean.card
+
+import com.dayu.baselibrary.tools.BcdUtil
+import com.dayu.baselibrary.tools.HexUtil
+import java.io.Serializable
+
+/**
+ * 鍙栨暟鍗�
+ * 鐢ㄤ簬鍦ㄧ敤鎴峰崱涓㈠け鍚庯紝璇诲彇褰撳墠鐢ㄦ埛鎴栨寕璧风敤鎴风殑鍗″唴淇℃伅锛屼綔涓鸿ˉ鍗′緷鎹�
+ */
+class FetchDataCard : BaseCard(), Serializable {
+ companion object {
+ const val CARD_TYPE_NEED_FETCH = "B1" // 闇�瑕佸埛鍗″彇鏁�
+ const val CARD_TYPE_FETCH_SUCCESS = "B2" // 鍒峰崱鍙栨暟杩斿啓鎴愬姛
+ 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
+ }
+
+ var areaNumber: Int = 0 // 鍥藉琛屾斂鍖哄煙鍙�(12浣岯CD,绮剧‘鍒版潙)
+ var userNumber: Int = 0 // 鐢ㄦ埛缂栧彿(HEX)
+ var cardType: String = CARD_TYPE_NEED_FETCH // 鍗$被鍨嬶細B1闇�瑕佸埛鍗″彇鏁帮紝B2鍒峰崱鍙栨暟杩斿啓鎴愬姛
+ var projectCode: Int = 0 // 椤圭洰缂栫爜(HEX 1-255)
+
+ /**
+ * 鍐欏崱瀹屾垚鍚庢牎楠屾槸鍚﹀啓鍗℃垚鍔�
+ */
+ fun equalsFetchDataCard(data: List<ByteArray>?): Boolean {
+ if (data == null || data.isEmpty()) {
+ return false
+ }
+ return data[0].contentEquals(getZeroBytes())
+ }
+
+ /**
+ * 閫氳繃byte杞琤ean
+ */
+ fun getBean(data: List<ByteArray>): FetchDataCard? {
+ try {
+ val fetchDataCard = FetchDataCard()
+ // 瑙f瀽绗�0鍧�
+ val zero = data[0]
+
+ // 瑙f瀽鍥藉琛屾斂鍖哄煙鍙�(0-5浣�)
+ val areaCodeBytes = zero.copyOfRange(0, 6)
+ fetchDataCard.areaNumber = BcdUtil.bcdToStr(areaCodeBytes).toInt()
+
+ // 瑙f瀽鐢ㄦ埛缂栧彿(6-7浣�)
+ val userNumberBytes = zero.copyOfRange(6, 8)
+ fetchDataCard.userNumber = HexUtil.get16To10LowHightByBytes(userNumberBytes)
+
+ // 瑙f瀽鍗$被鍨�(8浣�)
+ val cardType = HexUtil.byteToHex(zero[8])
+ if (cardType != CARD_TYPE_NEED_FETCH && cardType != CARD_TYPE_FETCH_SUCCESS) {
+ return null
+ }
+ fetchDataCard.cardType = cardType
+
+ // 楠岃瘉璇嗗埆鐮�(9-12浣�)
+ if (zero[9] != IDENTIFY_CODE_A0 ||
+ zero[10] != IDENTIFY_CODE_B1 ||
+ zero[11] != IDENTIFY_CODE_C2 ||
+ zero[12] != IDENTIFY_CODE_89) {
+ return null
+ }
+
+ // 瑙f瀽椤圭洰缂栫爜(13浣�)
+ fetchDataCard.projectCode = HexUtil.get16To10LowHightByBytes(byteArrayOf(zero[13]))
+
+ return fetchDataCard
+ } catch (e: Exception) {
+ e.printStackTrace()
+ return null
+ }
+ }
+
+ /**
+ * 鐢熸垚绗�0鍧楁暟鎹�
+ */
+ inner class Zero : BaseCard() {
+ fun toBytes(): ByteArray {
+ val data = ByteArray(16)
+ try {
+ // 璁剧疆鍥藉琛屾斂鍖哄煙鍙�(BCD鏍煎紡锛�6瀛楄妭锛�0-5浣�)
+ val areaCodeBytes = BcdUtil.strToBcd(String.format("%012d", areaNumber))
+ System.arraycopy(areaCodeBytes, 0, data, 0, 6)
+
+ // 璁剧疆鐢ㄦ埛缂栧彿(6-7浣�)
+ val userNumberBytes = HexUtil.hexToByteArray(HexUtil.get10To16LowHigh(userNumber))
+ System.arraycopy(userNumberBytes, 0, data, 6, 2)
+
+ // 璁剧疆鍗$被鍨�(8浣�)
+ data[8] = HexUtil.hexToByte(cardType)
+
+ // 璁剧疆璇嗗埆鐮�(9-12浣�)
+ data[9] = IDENTIFY_CODE_A0
+ data[10] = IDENTIFY_CODE_B1
+ data[11] = IDENTIFY_CODE_C2
+ data[12] = IDENTIFY_CODE_89
+
+ // 璁剧疆椤圭洰缂栫爜(13浣�)
+ data[13] = projectCode.toByte()
+
+ // 璁剧疆澶囩敤浣�(14浣�)
+ data[14] = 0x00
+
+ // 璁剧疆鏍¢獙鍜�(15浣�)
+ data[15] = getByteSum(data)
+ } catch (e: Exception) {
+ e.printStackTrace()
+ }
+ return data
+ }
+ }
+
+ /**
+ * 灏嗗崱鐗囩姸鎬佹洿鏂颁负鍙栨暟鎴愬姛
+ */
+ fun markAsFetchSuccess() {
+ cardType = CARD_TYPE_FETCH_SUCCESS
+ }
+
+ /**
+ * 妫�鏌ユ槸鍚﹀凡缁忓彇鏁版垚鍔�
+ */
+ fun isFetchSuccess(): Boolean {
+ return cardType == CARD_TYPE_FETCH_SUCCESS
+ }
+
+ fun getZeroBytes(): ByteArray = Zero().toBytes()
+}
\ No newline at end of file
diff --git a/generallibrary/src/main/java/com/dayu/general/bean/card/GpsCard.kt b/generallibrary/src/main/java/com/dayu/general/bean/card/GpsCard.kt
new file mode 100644
index 0000000..cb6edbf
--- /dev/null
+++ b/generallibrary/src/main/java/com/dayu/general/bean/card/GpsCard.kt
@@ -0,0 +1,93 @@
+package com.dayu.general.bean.card
+
+import com.dayu.baselibrary.tools.HexUtil
+import java.io.Serializable
+
+/**
+ * GPS瀹氫綅鍗�
+ * 涓昏鐢ㄤ簬鍐呴儴鐢熶骇璋冭瘯鐢�
+ */
+class GpsCard : BaseCard(), Serializable {
+ companion object {
+ const val CARD_TYPE = "B7" // 鍗$被鍨嬶細GPS瀹氫綅鍗�
+ 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 equalsGpsCard(data: List<ByteArray>?): Boolean {
+ if (data == null || data.isEmpty()) {
+ return false
+ }
+ return data[0].contentEquals(getZeroBytes())
+ }
+
+ /**
+ * 閫氳繃byte杞琤ean
+ */
+ fun getBean(data: List<ByteArray>): GpsCard? {
+ try {
+ val gpsCard = GpsCard()
+ // 瑙f瀽绗�0鍧�
+ val zero = data[0]
+
+ // 楠岃瘉鍗$被鍨�(8浣�)
+ if (HexUtil.byteToHex(zero[8]) != CARD_TYPE) {
+ return null
+ }
+
+ // 楠岃瘉璇嗗埆鐮�(9-12浣�)
+ if (zero[9] != IDENTIFY_CODE_A0 ||
+ zero[10] != IDENTIFY_CODE_B1 ||
+ zero[11] != IDENTIFY_CODE_C2 ||
+ zero[12] != IDENTIFY_CODE_89) {
+ return null
+ }
+
+ return gpsCard
+ } catch (e: Exception) {
+ e.printStackTrace()
+ return null
+ }
+ }
+
+ /**
+ * 鐢熸垚绗�0鍧楁暟鎹�
+ */
+ inner class Zero : BaseCard() {
+ fun toBytes(): ByteArray {
+ val data = ByteArray(16)
+ try {
+ // 璁剧疆澶囩敤浣�(0-7浣�)
+ for (i in 0..7) {
+ data[i] = 0x00
+ }
+
+ // 璁剧疆鍗$被鍨�(8浣�)
+ data[8] = HexUtil.hexToByte(CARD_TYPE)
+
+ // 璁剧疆璇嗗埆鐮�(9-12浣�)
+ data[9] = IDENTIFY_CODE_A0
+ data[10] = IDENTIFY_CODE_B1
+ data[11] = IDENTIFY_CODE_C2
+ data[12] = IDENTIFY_CODE_89
+
+ // 璁剧疆澶囩敤浣�(13-14浣�)
+ data[13] = 0x00
+ data[14] = 0x00
+
+ // 璁剧疆鏍¢獙鍜�(15浣�)
+ data[15] = getByteSum(data)
+ } catch (e: Exception) {
+ e.printStackTrace()
+ }
+ return data
+ }
+ }
+
+ fun getZeroBytes(): ByteArray = Zero().toBytes()
+}
\ No newline at end of file
diff --git a/generallibrary/src/main/java/com/dayu/general/bean/card/IpSettingCard.kt b/generallibrary/src/main/java/com/dayu/general/bean/card/IpSettingCard.kt
new file mode 100644
index 0000000..7d52309
--- /dev/null
+++ b/generallibrary/src/main/java/com/dayu/general/bean/card/IpSettingCard.kt
@@ -0,0 +1,219 @@
+package com.dayu.general.bean.card
+
+import com.dayu.baselibrary.tools.HexUtil
+import java.io.Serializable
+
+/**
+ * IP鍦板潃璁剧疆鍗�
+ * 鐢ㄤ簬椤圭洰鐜板満淇敼IP鍦板潃锛岄�氳繃鍒峰崱鏂瑰紡淇敼IP鍦板潃
+ */
+class IpSettingCard : BaseCard(), Serializable {
+ companion object {
+ const val CARD_TYPE = "B5" // 鍗$被鍨嬶細IP璁剧疆鍗�
+ 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
+
+ const val MAX_IP_ROUTE = 4 // 鏈�澶P璺暟
+ }
+
+ var ipRouteNumber: Int = 1 // IP鍦板潃搴忓垪鍙�(1-4)
+ var ipAddress: String = "" // IP鍦板潃
+ var port: Int = 0 // 绔彛鍙�
+
+ /**
+ * 鍐欏崱瀹屾垚鍚庢牎楠屾槸鍚﹀啓鍗℃垚鍔�
+ */
+ fun equalsIpSettingCard(data: List<ByteArray>?): Boolean {
+ if (data == null || data.size < 3) {
+ return false
+ }
+ return data[0].contentEquals(getZeroBytes()) &&
+ data[1].contentEquals(getOneBytes()) &&
+ data[2].contentEquals(getTwoBytes())
+ }
+
+ /**
+ * 閫氳繃byte杞琤ean
+ */
+ fun getBean(data: List<ByteArray>): IpSettingCard? {
+ try {
+ val ipSettingCard = IpSettingCard()
+
+ // 瑙f瀽绗�0鍧�
+ val zero = data[0]
+
+ // 楠岃瘉鍗$被鍨�(8浣�)
+ if (HexUtil.byteToHex(zero[8]) != CARD_TYPE) {
+ return null
+ }
+
+ // 楠岃瘉璇嗗埆鐮�(9-12浣�)
+ if (zero[9] != IDENTIFY_CODE_A0 ||
+ zero[10] != IDENTIFY_CODE_B1 ||
+ zero[11] != IDENTIFY_CODE_C2 ||
+ zero[12] != IDENTIFY_CODE_89) {
+ return null
+ }
+
+ // 瑙f瀽IP璺暟(13浣�)
+ val routeNumber = zero[13].toInt()
+ if (routeNumber !in 1..MAX_IP_ROUTE) {
+ return null
+ }
+ ipSettingCard.ipRouteNumber = routeNumber
+
+ // 瑙f瀽绗�1鍧� - IP鍦板潃
+ val one = data[1]
+ val ipBuilder = StringBuilder()
+ for (i in 0..14) {
+ ipBuilder.append(one[i].toInt().toChar())
+ }
+ ipSettingCard.ipAddress = ipBuilder.toString()
+
+ // 瑙f瀽绗�2鍧� - 绔彛鍙�
+ val two = data[2]
+ val portBuilder = StringBuilder()
+ for (i in 0..4) {
+ portBuilder.append(two[i].toInt().toChar())
+ }
+ ipSettingCard.port = portBuilder.toString().toInt()
+
+ return ipSettingCard
+ } catch (e: Exception) {
+ e.printStackTrace()
+ return null
+ }
+ }
+
+ /**
+ * 鐢熸垚绗�0鍧楁暟鎹�
+ */
+ inner class Zero : BaseCard() {
+ fun toBytes(): ByteArray {
+ val data = ByteArray(16)
+ try {
+ // 璁剧疆澶囩敤浣�(0-7浣�)
+ for (i in 0..7) {
+ data[i] = 0x00
+ }
+
+ // 璁剧疆鍗$被鍨�(8浣�)
+ data[8] = HexUtil.hexToByte(CARD_TYPE)
+
+ // 璁剧疆璇嗗埆鐮�(9-12浣�)
+ data[9] = IDENTIFY_CODE_A0
+ data[10] = IDENTIFY_CODE_B1
+ data[11] = IDENTIFY_CODE_C2
+ data[12] = IDENTIFY_CODE_89
+
+ // 璁剧疆IP璺暟(13浣�)
+ data[13] = ipRouteNumber.toByte()
+
+ // 璁剧疆澶囩敤浣�(14浣�)
+ data[14] = 0x00
+
+ // 璁剧疆鏍¢獙鍜�(15浣�)
+ data[15] = getByteSum(data)
+ } catch (e: Exception) {
+ e.printStackTrace()
+ }
+ return data
+ }
+ }
+
+ /**
+ * 鐢熸垚绗�1鍧楁暟鎹� - IP鍦板潃
+ */
+ inner class One : BaseCard() {
+ fun toBytes(): ByteArray {
+ val data = ByteArray(16)
+ try {
+ // 鏍煎紡鍖朓P鍦板潃
+ val formattedIp = formatIpAddress(ipAddress)
+
+ // 鍐欏叆IP鍦板潃(0-14浣�)
+ formattedIp.forEachIndexed { index, char ->
+ data[index] = char.code.toByte()
+ }
+
+ // 璁剧疆鏍¢獙鍜�(15浣�)
+ data[15] = getByteSum(data)
+ } catch (e: Exception) {
+ e.printStackTrace()
+ }
+ return data
+ }
+ }
+
+ /**
+ * 鐢熸垚绗�2鍧楁暟鎹� - 绔彛鍙�
+ */
+ inner class Two : BaseCard() {
+ fun toBytes(): ByteArray {
+ val data = ByteArray(16)
+ try {
+ // 鏍煎紡鍖栫鍙e彿
+ val formattedPort = String.format("%05d", port)
+
+ // 鍐欏叆绔彛鍙�(0-4浣�)
+ formattedPort.forEachIndexed { index, char ->
+ data[index] = char.code.toByte()
+ }
+
+ // 璁剧疆澶囩敤浣�(5-14浣�)
+ for (i in 5..14) {
+ data[i] = 0x00
+ }
+
+ // 璁剧疆鏍¢獙鍜�(15浣�)
+ data[15] = getByteSum(data)
+ } catch (e: Exception) {
+ e.printStackTrace()
+ }
+ return data
+ }
+ }
+
+ /**
+ * 鏍煎紡鍖朓P鍦板潃
+ * 灏咺P鍦板潃鏍煎紡鍖栦负鏍囧噯鏍煎紡锛氭瘡缁�3浣嶏紝涓嶈冻琛�0
+ */
+ private fun formatIpAddress(ip: String): String {
+ val parts = ip.split(".")
+ if (parts.size != 4) throw IllegalArgumentException("Invalid IP address format")
+
+ return parts.joinToString(".") { part ->
+ String.format("%03d", part.toInt())
+ }
+ }
+
+ /**
+ * 楠岃瘉IP鍦板潃鏍煎紡鏄惁姝g‘
+ */
+ fun isValidIpAddress(): Boolean {
+ return try {
+ val parts = ipAddress.split(".")
+ if (parts.size != 4) return false
+
+ parts.all { part ->
+ val num = part.toInt()
+ num in 0..255
+ }
+ } catch (e: Exception) {
+ false
+ }
+ }
+
+ /**
+ * 楠岃瘉绔彛鍙锋槸鍚︽纭�
+ */
+ fun isValidPort(): Boolean {
+ return port in 1..65535
+ }
+
+ fun getZeroBytes(): ByteArray = Zero().toBytes()
+ fun getOneBytes(): ByteArray = One().toBytes()
+ fun getTwoBytes(): ByteArray = Two().toBytes()
+}
\ No newline at end of file
diff --git a/generallibrary/src/main/java/com/dayu/general/bean/card/UserCard.kt b/generallibrary/src/main/java/com/dayu/general/bean/card/UserCard.kt
new file mode 100644
index 0000000..7aa0eed
--- /dev/null
+++ b/generallibrary/src/main/java/com/dayu/general/bean/card/UserCard.kt
@@ -0,0 +1,199 @@
+package com.dayu.general.bean.card
+
+import com.dayu.baselibrary.bean.BaseUserCardCard
+import com.dayu.baselibrary.tools.BcdUtil
+import com.dayu.baselibrary.tools.HexUtil
+import java.io.Serializable
+import java.util.*
+
+/**
+ * 閫氱敤椤圭洰鐢ㄦ埛鍗$粨鏋�
+ */
+class UserCard : BaseCard(), Serializable {
+ var cardType: String = "A1" // 鍗$被鍨嬶細A1缁堢鍐欏崱 A8鍒峰崱寮�娉靛悗鍊� A2鍙犲姞鍏呭��
+ var areaNumber: Int = 0 // 鍥藉琛屾斂鍖哄煙鍙�(12浣岯CD,绮剧‘鍒版潙)
+ var userCode: String = "" // 鐢ㄦ埛缂栧彿BCD
+ var userCodeNumber: Int = 0 // 鐢ㄦ埛鍗$紪鍙�(HEX)
+ var phoneNumber: String = "" // 鎵嬫満鍙�(BCD)
+ var projectCode: Int = 0 // 椤圭洰缂栫爜(HEX 1-255)
+ var balance: Int = 0 // 鍓╀綑閲戦(2浣嶅皬鏁扮偣锛屽崟浣嶅厓)
+ var surplusWater: Int = 0 // 鍓╀綑姘撮噺(2浣嶅皬鏁扮偣锛屽崟浣嶇珛鏂圭背)
+ var waterPrice: Float = 0f // 姘撮噺鍗曚环(鏈�澶�655.35锛�2浣嶅皬鏁扮偣銆傚崟浣嶏細m3/鍏�)
+ var electricPrice: Float = 0f // 鐢甸噺鍗曚环(鏈�澶�655.35锛�2浣嶅皬鏁扮偣銆傚崟浣�: 鍏�/搴�)
+ var rechargeDate: Calendar? = null // 鍏呭�兼椂闂�
+
+ /**
+ * 鍐欏崱瀹屾垚鍚庢牎楠屾槸鍚﹀啓鍗℃垚鍔�
+ */
+ fun equalsUserCard(data: List<ByteArray>?): Boolean {
+ if (data == null || data.size < 3) {
+ return false
+ }
+
+ val expectedBytes = arrayOf(getZeroBytes(), getOneBytes(), getTwoBytes())
+ return data.zip(expectedBytes.toList()).all { (actual, expected) ->
+ actual.contentEquals(expected)
+ }
+ }
+
+ /**
+ * 杩斿洖瀹屾暣鐨勭敤鎴风紪鍙�
+ */
+ fun getMyUserCode(): String {
+ return userCode + String.format("%04d", userCodeNumber)
+ }
+
+ /**
+ * 閫氳繃byte杞琤ean
+ */
+ fun getBean(data: List<ByteArray>): UserCard? {
+ try {
+ val userCard = UserCard()
+ // 瑙f瀽绗�0鍧�
+ val zero = data[0]
+ userCard.apply {
+ // 瑙f瀽鍥藉琛屾斂鍖哄煙鍙�(0-5浣�)
+ val areaCodeBytes = zero.copyOfRange(0, 6)
+ areaNumber = BcdUtil.bcdToStr(areaCodeBytes).toInt()
+
+ // 瑙f瀽鐢ㄦ埛鍗$紪鍙�(6-7浣�)
+ val userCodeNumberBytes = zero.copyOfRange(6, 8)
+ userCodeNumber = HexUtil.get16To10LowHightByBytes(userCodeNumberBytes)
+
+ // 瑙f瀽鍗$被鍨�(8浣�)
+ cardType = HexUtil.byteToHex(zero[8])
+
+ // 瑙f瀽鎵嬫満鍙�(9-14浣�)
+ phoneNumber = BcdUtil.bcdToStr(zero.copyOfRange(9, 15))
+ }
+
+ // 瑙f瀽绗�1鍧�
+ val one = data[1]
+ userCard.apply {
+ projectCode = HexUtil.get16To10LowHightByBytes(byteArrayOf(one[0]))
+ balance = HexUtil.get16To10LowHightByBytes(one.copyOfRange(1, 5))
+ surplusWater = HexUtil.get16To10LowHightByBytes(one.copyOfRange(5, 9))
+ electricPrice = HexUtil.hexToFloatLowHigh(one.copyOfRange(9, 11))
+
+ // 瑙f瀽鍏呭�兼椂闂�
+ val year = HexUtil.getBcdToInt(one[11])
+ val month = HexUtil.getBcdToInt(one[12])
+ val day = HexUtil.getBcdToInt(one[13])
+ val hour = HexUtil.getBcdToInt(one[14])
+ Calendar.getInstance().apply {
+ set(2000 + year, month - 1, day, hour, 0, 0)
+ rechargeDate = this
+ }
+ }
+
+ // 瑙f瀽绗�2鍧�
+ val two = data[2]
+ userCard.apply {
+ waterPrice = HexUtil.hexToFloatLowHigh(two.copyOfRange(9, 11))
+ }
+
+ return userCard
+ } catch (e: Exception) {
+ e.printStackTrace()
+ return null
+ }
+ }
+
+ // 鍐呴儴绫荤敤浜庣敓鎴愬悇涓暟鎹潡
+ inner class Zero : BaseCard() {
+ fun toBytes(): ByteArray {
+ val data = ByteArray(16)
+ try {
+ // 璁剧疆鍥藉琛屾斂鍖哄煙鍙�(BCD鏍煎紡锛�6瀛楄妭锛�0-5浣�)
+ val areaCodeBytes = BcdUtil.strToBcd(String.format("%012d", areaNumber))
+ System.arraycopy(areaCodeBytes, 0, data, 0, 6)
+
+ // 璁剧疆鐢ㄦ埛鍗$紪鍙�(HEX鏍煎紡锛�2瀛楄妭锛�6-7浣�)
+ val userCodeBytes = HexUtil.hexToByteArray(HexUtil.get10To16LowHigh(userCodeNumber))
+ System.arraycopy(userCodeBytes, 0, data, 6, 2)
+
+ // 璁剧疆鍗$被鍨�(8浣�)
+ data[8] = HexUtil.hexToByte(cardType)
+
+ // 璁剧疆鎵嬫満鍙�(BCD鏍煎紡锛�6瀛楄妭锛�9-14浣�)
+ val phoneBytes = BcdUtil.strToBcd(phoneNumber.padStart(12, '0'))
+ System.arraycopy(phoneBytes, 0, data, 9, 6)
+
+ // 璁剧疆鏍¢獙鍜�(15浣�)
+ data[15] = getByteSum(data)
+ } catch (e: Exception) {
+ e.printStackTrace()
+ }
+ return data
+ }
+ }
+
+ inner class One : BaseCard() {
+ fun toBytes(): ByteArray {
+ val data = ByteArray(16)
+ try {
+ data[0] = projectCode.toByte()
+
+ // 璁剧疆浣欓
+ val balanceBytes = HexUtil.hexToByteArray(HexUtil.get10To16LowHigh(balance))
+ System.arraycopy(balanceBytes, 0, data, 1, 4)
+
+ // 璁剧疆鍓╀綑姘撮噺
+ val waterBytes = HexUtil.hexToByteArray(HexUtil.get10To16LowHigh(surplusWater))
+ System.arraycopy(waterBytes, 0, data, 5, 4)
+
+ // 璁剧疆鐢典环
+ val priceBytes = HexUtil.hexToByteArray(HexUtil.floatToHexLowHigh(electricPrice))
+ System.arraycopy(priceBytes, 0, data, 9, 2)
+
+ // 璁剧疆鍏呭�兼椂闂�
+ rechargeDate?.let {
+ data[11] = HexUtil.getIntToBCD(it.get(Calendar.YEAR) % 100)[0]
+ data[12] = HexUtil.getIntToBCD(it.get(Calendar.MONTH) + 1)[0]
+ data[13] = HexUtil.getIntToBCD(it.get(Calendar.DAY_OF_MONTH))[0]
+ data[14] = HexUtil.getIntToBCD(it.get(Calendar.HOUR_OF_DAY))[0]
+ }
+
+ data[15] = getByteSum(data)
+ } catch (e: Exception) {
+ e.printStackTrace()
+ }
+ return data
+ }
+ }
+
+ inner class Two : BaseCard() {
+ fun toBytes(): ByteArray {
+ val data = ByteArray(16)
+ try {
+ // 澶囦唤浣欓鍜屾按閲忔暟鎹�
+ val balanceBytes = HexUtil.hexToByteArray(HexUtil.get10To16LowHigh(balance))
+ System.arraycopy(balanceBytes, 0, data, 1, 4)
+
+ val waterBytes = HexUtil.hexToByteArray(HexUtil.get10To16LowHigh(surplusWater))
+ System.arraycopy(waterBytes, 0, data, 5, 4)
+
+ // 璁剧疆姘翠环
+ val priceBytes = HexUtil.hexToByteArray(HexUtil.floatToHexLowHigh(waterPrice))
+ System.arraycopy(priceBytes, 0, data, 9, 2)
+
+ // 璁剧疆鍏呭�兼椂闂�
+ rechargeDate?.let {
+ data[11] = HexUtil.getIntToBCD(it.get(Calendar.YEAR) % 100)[0]
+ data[12] = HexUtil.getIntToBCD(it.get(Calendar.MONTH) + 1)[0]
+ data[13] = HexUtil.getIntToBCD(it.get(Calendar.DAY_OF_MONTH))[0]
+ data[14] = HexUtil.getIntToBCD(it.get(Calendar.HOUR_OF_DAY))[0]
+ }
+
+ data[15] = getByteSum(data)
+ } catch (e: Exception) {
+ e.printStackTrace()
+ }
+ return data
+ }
+ }
+
+ fun getZeroBytes(): ByteArray = Zero().toBytes()
+ fun getOneBytes(): ByteArray = One().toBytes()
+ fun getTwoBytes(): ByteArray = Two().toBytes()
+}
diff --git a/generallibrary/src/main/java/com/dayu/general/bean/card/ValveTimeCard.kt b/generallibrary/src/main/java/com/dayu/general/bean/card/ValveTimeCard.kt
new file mode 100644
index 0000000..a54298a
--- /dev/null
+++ b/generallibrary/src/main/java/com/dayu/general/bean/card/ValveTimeCard.kt
@@ -0,0 +1,118 @@
+package com.dayu.general.bean.card
+
+import com.dayu.baselibrary.tools.HexUtil
+import java.io.Serializable
+
+/**
+ * 閰嶇疆寮�鍏抽榾鏃堕棿鍗�
+ * 涓昏鐢ㄤ簬鍐呴儴鐢熶骇璋冭瘯鐢紝璁剧疆寮�鍏抽榾鏃堕棿
+ */
+class ValveTimeCard : BaseCard(), Serializable {
+ companion object {
+ const val CARD_TYPE = "B8" // 鍗$被鍨嬶細閰嶇疆寮�鍏抽榾鏃堕棿鍗�
+ 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
+ }
+
+ var valveTime: Int = 0 // 寮�鍏抽榾鏃堕棿(绉�)
+
+ /**
+ * 鍐欏崱瀹屾垚鍚庢牎楠屾槸鍚﹀啓鍗℃垚鍔�
+ */
+ fun equalsValveTimeCard(data: List<ByteArray>?): Boolean {
+ if (data == null || data.isEmpty()) {
+ return false
+ }
+ return data[0].contentEquals(getZeroBytes())
+ }
+
+ /**
+ * 閫氳繃byte杞琤ean
+ */
+ fun getBean(data: List<ByteArray>): ValveTimeCard? {
+ try {
+ val valveTimeCard = ValveTimeCard()
+ // 瑙f瀽绗�0鍧�
+ val zero = data[0]
+
+ // 楠岃瘉鍗$被鍨�(8浣�)
+ if (HexUtil.byteToHex(zero[8]) != CARD_TYPE) {
+ return null
+ }
+
+ // 楠岃瘉璇嗗埆鐮�(9-12浣�)
+ if (zero[9] != IDENTIFY_CODE_A0 ||
+ zero[10] != IDENTIFY_CODE_B1 ||
+ zero[11] != IDENTIFY_CODE_C2 ||
+ zero[12] != IDENTIFY_CODE_89) {
+ return null
+ }
+
+ // 瑙f瀽寮�鍏抽榾鏃堕棿(13-14浣�)
+ val timeBytes = byteArrayOf(zero[13], zero[14])
+ valveTimeCard.valveTime = HexUtil.get16To10LowHightByBytes(timeBytes)
+
+ return valveTimeCard
+ } catch (e: Exception) {
+ e.printStackTrace()
+ return null
+ }
+ }
+
+ /**
+ * 鐢熸垚绗�0鍧楁暟鎹�
+ */
+ inner class Zero : BaseCard() {
+ fun toBytes(): ByteArray {
+ val data = ByteArray(16)
+ try {
+ // 璁剧疆澶囩敤浣�(0-7浣�)
+ for (i in 0..7) {
+ data[i] = 0x00
+ }
+
+ // 璁剧疆鍗$被鍨�(8浣�)
+ data[8] = HexUtil.hexToByte(CARD_TYPE)
+
+ // 璁剧疆璇嗗埆鐮�(9-12浣�)
+ data[9] = IDENTIFY_CODE_A0
+ data[10] = IDENTIFY_CODE_B1
+ data[11] = IDENTIFY_CODE_C2
+ data[12] = IDENTIFY_CODE_89
+
+ // 璁剧疆寮�鍏抽榾鏃堕棿(13-14浣�)锛屼綆浣嶅湪鍓嶉珮浣嶅湪鍚�
+ val timeBytes = HexUtil.hexToByteArray(HexUtil.get10To16LowHigh(valveTime))
+ if (timeBytes.size >= 2) {
+ data[13] = timeBytes[0] // 浣庝綅
+ data[14] = timeBytes[1] // 楂樹綅
+ }
+
+ // 璁剧疆鏍¢獙鍜�(15浣�)
+ data[15] = getByteSum(data)
+ } catch (e: Exception) {
+ e.printStackTrace()
+ }
+ return data
+ }
+ }
+
+ /**
+ * 楠岃瘉寮�鍏抽榾鏃堕棿鏄惁鏈夋晥
+ * @return true 濡傛灉鏃堕棿鏈夋晥锛宖alse 鍚﹀垯
+ */
+ fun isValidValveTime(): Boolean {
+ return valveTime > 0 && valveTime <= 65535 // 涓や釜瀛楄妭鏈�澶у��
+ }
+
+ /**
+ * 鑾峰彇寮�鍏抽榾鏃堕棿鐨勫崄鍏繘鍒跺瓧绗︿覆琛ㄧず
+ * @return 鍗佸叚杩涘埗瀛楃涓诧紝濡�"0087"琛ㄧず135绉�
+ */
+ fun getValveTimeHex(): String {
+ return String.format("%04X", valveTime)
+ }
+
+ fun getZeroBytes(): ByteArray = Zero().toBytes()
+}
\ No newline at end of file
diff --git a/generallibrary/src/main/java/com/dayu/general/bean/db/CardData.kt b/generallibrary/src/main/java/com/dayu/general/bean/db/CardData.kt
new file mode 100644
index 0000000..f094337
--- /dev/null
+++ b/generallibrary/src/main/java/com/dayu/general/bean/db/CardData.kt
@@ -0,0 +1,21 @@
+package com.dayu.general.bean.db
+
+import androidx.room.Entity
+import androidx.room.PrimaryKey
+
+@Entity
+class CardData {
+ @PrimaryKey(autoGenerate = true)
+ var id: Long = 0
+
+ /**
+ * 鍗$墖绫诲瀷
+ */
+ var cardType: String? = null
+
+ /**
+ * 鍗℃爣璇�
+ */
+ var cardIdentifying: String? = null
+
+}
\ No newline at end of file
diff --git a/generallibrary/src/main/java/com/dayu/general/bean/db/PassWordCardBean.java b/generallibrary/src/main/java/com/dayu/general/bean/db/PassWordCardBean.java
new file mode 100644
index 0000000..99acc29
--- /dev/null
+++ b/generallibrary/src/main/java/com/dayu/general/bean/db/PassWordCardBean.java
@@ -0,0 +1,36 @@
+package com.dayu.general.bean.db;
+
+import androidx.room.Entity;
+import androidx.room.PrimaryKey;
+
+/**
+ * author: zuo
+ * Date: 2024-03-01
+ * Time: 17:56
+ * 澶囨敞锛氬瘑鐮佸崱瀵嗙爜
+ */
+@Entity
+public class PassWordCardBean {
+
+ @PrimaryKey(autoGenerate = true)
+ public long id;
+ private String passWord = "";
+
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public String getPassWord() {
+ return passWord;
+ }
+
+ public void setPassWord(String passWord) {
+ this.passWord = passWord;
+ }
+
+
+}
diff --git a/generallibrary/src/main/java/com/dayu/general/dao/AppDataBase.kt b/generallibrary/src/main/java/com/dayu/general/dao/AppDataBase.kt
index dc87c91..ec1b574 100644
--- a/generallibrary/src/main/java/com/dayu/general/dao/AppDataBase.kt
+++ b/generallibrary/src/main/java/com/dayu/general/dao/AppDataBase.kt
@@ -1,6 +1,11 @@
package com.dayu.general.dao
+import androidx.room.Database
import androidx.room.RoomDatabase
+import com.dayu.general.bean.db.CardData
+import com.dayu.general.bean.db.PassWordCardBean
+@Database(entities = [PassWordCardBean::class, CardData::class], version = 1, exportSchema = false)
abstract class AppDataBase : RoomDatabase() {
+ abstract fun cardDataDao(): CardDataDao
}
\ No newline at end of file
diff --git a/generallibrary/src/main/java/com/dayu/general/dao/BaseDaoSingleton.kt b/generallibrary/src/main/java/com/dayu/general/dao/BaseDaoSingleton.kt
index 610bcdc..825209a 100644
--- a/generallibrary/src/main/java/com/dayu/general/dao/BaseDaoSingleton.kt
+++ b/generallibrary/src/main/java/com/dayu/general/dao/BaseDaoSingleton.kt
@@ -38,9 +38,9 @@
return AsynchBaseDao
}
- companion object {
- fun getAsynchInstance(baseActivity: BaseActivity): AppDataBase? {
- return getAsynchInstance(baseActivity)
- }
- }
+// companion object {
+// fun getAsynchInstance(baseActivity: BaseActivity): AppDataBase? {
+// return getAsynchInstance(baseActivity)
+// }
+// }
}
\ No newline at end of file
diff --git a/generallibrary/src/main/java/com/dayu/general/dao/CardDataDao.kt b/generallibrary/src/main/java/com/dayu/general/dao/CardDataDao.kt
new file mode 100644
index 0000000..270b59a
--- /dev/null
+++ b/generallibrary/src/main/java/com/dayu/general/dao/CardDataDao.kt
@@ -0,0 +1,20 @@
+package com.dayu.general.dao
+
+import androidx.room.Dao
+import androidx.room.Insert
+import androidx.room.OnConflictStrategy
+import androidx.room.Query
+import androidx.room.Update
+import com.dayu.general.bean.db.CardData
+
+@Dao
+interface CardDataDao {
+ @Insert(onConflict = OnConflictStrategy.REPLACE)
+ fun insert(cardData: CardData)
+
+ @Update
+ fun update(cardData: CardData)
+
+ @Query("select * from CardData where cardType=:cardType limit 1")
+ fun findFirst(cardType: String?): CardData
+}
\ No newline at end of file
diff --git a/generallibrary/src/main/java/com/dayu/general/tool/GeBaseHelper.kt b/generallibrary/src/main/java/com/dayu/general/tool/GeBaseHelper.kt
new file mode 100644
index 0000000..c3e0916
--- /dev/null
+++ b/generallibrary/src/main/java/com/dayu/general/tool/GeBaseHelper.kt
@@ -0,0 +1,43 @@
+package com.dayu.general.tool
+
+import android.content.Context
+import android.util.Base64
+import com.dayu.baselibrary.tools.HexUtil
+import com.dayu.baselibrary.tools.nfc.BaseNFCHelper
+import java.nio.charset.StandardCharsets
+import javax.crypto.Cipher
+import javax.crypto.spec.SecretKeySpec
+
+class GeBaseHelper(private val context: Context) : BaseNFCHelper() {
+
+
+ companion object {
+ init {
+ System.loadLibrary("general-native-lib")
+ }
+ }
+
+ private external fun getM1SectorKeySecure(context: Context, sectorIndex: Int): String
+
+ init {
+ try {
+ // 鑾峰彇鎵�鏈夋墖鍖哄瘑閽�
+ val allKeys: String = getM1SectorKeySecure(context, 0)
+ val keys: Array<String> =
+ allKeys.split(",").dropLastWhile { it.isEmpty() }.toTypedArray()
+ for (i in keys.indices) {
+ val key = keys[i]
+ listA_PS.add(HexUtil.hexToByteArray(key))
+ }
+ defauleKey = HexUtil.hexToByteArray("FFFFFFFFFFFF")
+
+
+ } catch (e: Exception) {
+ e.printStackTrace()
+ }
+ }
+
+ fun getKeyList(): List<ByteArray> {
+ return listKeyA
+ }
+}
\ No newline at end of file
diff --git a/generallibrary/src/main/res/drawable/bottom_circle_bg.xml b/generallibrary/src/main/res/drawable/bottom_circle_bg.xml
index 4045ed5..5249622 100644
--- a/generallibrary/src/main/res/drawable/bottom_circle_bg.xml
+++ b/generallibrary/src/main/res/drawable/bottom_circle_bg.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/bottom_color" /> <!-- 鎸夐挳鐨勮儗鏅壊 -->
- <corners android:radius="90dp" /> <!-- 璁╂寜閽殑鍥涗釜瑙掑彉鎴愬渾褰� -->
+ <corners android:radius="100dp" /> <!-- 璁╂寜閽殑鍥涗釜瑙掑彉鎴愬渾褰� -->
<size android:width="100dp" android:height="100dp" /> <!-- 璁剧疆鎸夐挳鐨勫楂� -->
</shape>
\ No newline at end of file
diff --git a/generallibrary/src/main/res/drawable/bottom_nav_background.xml b/generallibrary/src/main/res/drawable/bottom_nav_background.xml
new file mode 100644
index 0000000..82853ac
--- /dev/null
+++ b/generallibrary/src/main/res/drawable/bottom_nav_background.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+ <!-- 闃村奖灞� -->
+ <item>
+ <shape>
+ <padding
+ android:bottom="0dp"
+ android:left="0dp"
+ android:right="0dp"
+ android:top="2dp" />
+ <solid android:color="#10000000" />
+ <corners
+ android:topLeftRadius="18dp"
+ android:topRightRadius="18dp" />
+ </shape>
+ </item>
+ <item>
+ <shape>
+ <padding
+ android:bottom="0dp"
+ android:left="0dp"
+ android:right="0dp"
+ android:top="2dp" />
+ <solid android:color="#15000000" />
+ <corners
+ android:topLeftRadius="18dp"
+ android:topRightRadius="18dp" />
+ </shape>
+ </item>
+ <!-- 涓昏儗鏅� -->
+ <item>
+ <shape>
+ <solid android:color="#FFFFFF" />
+ <corners
+ android:topLeftRadius="18dp"
+ android:topRightRadius="18dp" />
+ </shape>
+ </item>
+</layer-list>
\ No newline at end of file
diff --git a/generallibrary/src/main/res/drawable/fab_background.xml b/generallibrary/src/main/res/drawable/fab_background.xml
new file mode 100644
index 0000000..2739156
--- /dev/null
+++ b/generallibrary/src/main/res/drawable/fab_background.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+ <!-- 闃村奖灞� -->
+ <item>
+ <shape android:shape="oval">
+ <solid android:color="#30000000" />
+ <padding android:bottom="1dp" android:left="1dp" android:right="1dp" android:top="1dp" />
+ </shape>
+ </item>
+ <!-- 涓昏儗鏅� -->
+ <item>
+ <shape android:shape="oval">
+ <gradient
+ android:angle="135"
+ android:endColor="#1E88E5"
+ android:centerColor="#4285F4"
+ android:startColor="#5C9CE6"
+ android:type="linear" />
+ </shape>
+ </item>
+</layer-list>
\ No newline at end of file
diff --git a/generallibrary/src/main/res/drawable/nav_item_color.xml b/generallibrary/src/main/res/drawable/nav_item_color.xml
new file mode 100644
index 0000000..089e808
--- /dev/null
+++ b/generallibrary/src/main/res/drawable/nav_item_color.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:color="#4285F4" android:state_selected="true" />
+ <item android:color="#555555" />
+</selector>
\ No newline at end of file
diff --git a/generallibrary/src/main/res/drawable/ripple_effect.xml b/generallibrary/src/main/res/drawable/ripple_effect.xml
new file mode 100644
index 0000000..84b0e71
--- /dev/null
+++ b/generallibrary/src/main/res/drawable/ripple_effect.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ripple xmlns:android="http://schemas.android.com/apk/res/android"
+ android:color="#20000000">
+ <item android:id="@android:id/mask">
+ <shape android:shape="rectangle">
+ <solid android:color="#000000" />
+ <corners android:radius="4dp" />
+ </shape>
+ </item>
+</ripple>
\ No newline at end of file
diff --git a/generallibrary/src/main/res/drawable/rounded_button_bg.xml b/generallibrary/src/main/res/drawable/rounded_button_bg.xml
new file mode 100644
index 0000000..17924ca
--- /dev/null
+++ b/generallibrary/src/main/res/drawable/rounded_button_bg.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="rectangle">
+ <corners android:radius="16dp" />
+ <solid android:color="@color/bottom_color" />
+</shape>
\ No newline at end of file
diff --git a/generallibrary/src/main/res/drawable/shadow_gradient.xml b/generallibrary/src/main/res/drawable/shadow_gradient.xml
new file mode 100644
index 0000000..f3beda5
--- /dev/null
+++ b/generallibrary/src/main/res/drawable/shadow_gradient.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <gradient
+ android:angle="90"
+ android:endColor="#00000000"
+ android:startColor="#20000000"
+ android:type="linear" />
+</shape>
\ No newline at end of file
diff --git a/generallibrary/src/main/res/drawable/shadow_gradient_strong.xml b/generallibrary/src/main/res/drawable/shadow_gradient_strong.xml
new file mode 100644
index 0000000..b3515b8
--- /dev/null
+++ b/generallibrary/src/main/res/drawable/shadow_gradient_strong.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <gradient
+ android:angle="90"
+ android:endColor="#00000000"
+ android:startColor="#30000000"
+ android:type="linear" />
+</shape>
\ No newline at end of file
diff --git a/generallibrary/src/main/res/drawable/tab_indicator.xml b/generallibrary/src/main/res/drawable/tab_indicator.xml
new file mode 100644
index 0000000..ebc4a03
--- /dev/null
+++ b/generallibrary/src/main/res/drawable/tab_indicator.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="rectangle">
+ <solid android:color="#4285F4" />
+ <corners android:radius="2dp" />
+ <size android:height="3dp" android:width="20dp" />
+</shape>
\ No newline at end of file
diff --git a/generallibrary/src/main/res/drawable/tab_ripple_effect.xml b/generallibrary/src/main/res/drawable/tab_ripple_effect.xml
new file mode 100644
index 0000000..85e424b
--- /dev/null
+++ b/generallibrary/src/main/res/drawable/tab_ripple_effect.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ripple xmlns:android="http://schemas.android.com/apk/res/android"
+ android:color="#1A4285F4">
+ <item android:id="@android:id/mask">
+ <shape android:shape="rectangle">
+ <solid android:color="#000000" />
+ <corners android:radius="8dp" />
+ </shape>
+ </item>
+</ripple>
\ No newline at end of file
diff --git a/generallibrary/src/main/res/layout/activity_main.xml b/generallibrary/src/main/res/layout/activity_main.xml
index 44cf5eb..e655d2c 100644
--- a/generallibrary/src/main/res/layout/activity_main.xml
+++ b/generallibrary/src/main/res/layout/activity_main.xml
@@ -24,7 +24,7 @@
android:orientation="horizontal">
<LinearLayout
- android:id="@+id/orderLL"
+ android:id="@+id/BSCardLL"
android:layout_width="0dp"
android:layout_height="50dp"
android:layout_weight="1"
@@ -37,7 +37,7 @@
android:layout_height="33dp">
<ImageView
- android:id="@+id/orderImg"
+ android:id="@+id/BSCardImg"
android:layout_width="wrap_content"
android:layout_height="25dp"
android:layout_marginTop="8dp"
@@ -47,7 +47,7 @@
</RelativeLayout>
<TextView
- android:id="@+id/orderText"
+ android:id="@+id/BSCardText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
@@ -58,7 +58,7 @@
</LinearLayout>
<FrameLayout
- android:id="@+id/mapLL"
+ android:id="@+id/rechargeLL"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
@@ -81,14 +81,14 @@
android:orientation="vertical">
<ImageView
- android:id="@+id/mapImg"
+ android:id="@+id/rechargeImg"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginTop="8dp"
android:src="@drawable/bottom_recharge_white" />
<TextView
- android:id="@+id/mapText"
+ android:id="@+id/rechargeText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="鍏呭��"
diff --git a/generallibrary/src/main/res/layout/activity_new_card_ge.xml b/generallibrary/src/main/res/layout/activity_new_card_ge.xml
new file mode 100644
index 0000000..84560ca
--- /dev/null
+++ b/generallibrary/src/main/res/layout/activity_new_card_ge.xml
@@ -0,0 +1,311 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="#F5F7FA">
+
+ <com.dayu.baselibrary.view.TitleBar
+ android:id="@+id/titleBar"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/dimen_title_height"
+ android:background="@color/title_bar_bg"
+ android:elevation="4dp"
+ app:centerText="鏂板崱寮�鎴�"
+ app:leftImage="@mipmap/icon_back" />
+
+ <ScrollView
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_above="@+id/newCard_registBtn"
+ android:layout_below="@+id/titleBar"
+ android:fillViewport="true"
+ android:scrollbars="none">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:padding="16dp">
+
+ <androidx.cardview.widget.CardView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="16dp"
+ app:cardCornerRadius="8dp"
+ app:cardElevation="2dp">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:padding="16dp">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="16dp"
+ android:text="鍩烘湰淇℃伅"
+ android:textColor="#333333"
+ android:textSize="18sp"
+ android:textStyle="bold" />
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="16dp"
+ android:gravity="center_vertical"
+ android:orientation="horizontal">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/eq_no"
+ android:textColor="#666666"
+ android:textSize="@dimen/new_card_size" />
+
+ <TextView
+ android:id="@+id/newCard_arerNumber"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="8dp"
+ android:inputType="number"
+ android:textColor="#333333"
+ android:textSize="@dimen/new_card_size" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="16dp"
+ android:gravity="center_vertical"
+ android:orientation="horizontal">
+
+ <TextView
+ android:layout_width="80dp"
+ android:layout_height="wrap_content"
+ android:text="濮撳悕"
+ android:textColor="#666666"
+ android:textSize="@dimen/new_card_size" />
+
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:background="#FFFFFF"
+ android:orientation="vertical">
+
+ <EditText
+ android:id="@+id/newCard_name"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="@null"
+ android:hint="璇疯緭鍏ュ鍚�"
+ android:inputType="textPersonName"
+ android:padding="12dp"
+ android:textSize="@dimen/new_card_size" />
+ </LinearLayout>
+
+ <ImageView
+ android:id="@+id/newCard_scanBtn"
+ android:layout_width="45dp"
+ android:layout_height="45dp"
+ android:background="?attr/selectableItemBackgroundBorderless"
+ android:padding="10dp"
+ android:src="@mipmap/icon_scan"
+ android:tint="#4285F4" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="16dp"
+ android:gravity="center_vertical"
+ android:orientation="horizontal">
+
+ <TextView
+ android:layout_width="80dp"
+ android:layout_height="wrap_content"
+ android:text="韬唤璇佸彿"
+ android:textColor="#666666"
+ android:textSize="@dimen/new_card_size" />
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="#FFFFFF"
+ android:orientation="vertical">
+
+ <EditText
+ android:id="@+id/newCard_id"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="@null"
+ android:digits="0123456789Xx"
+ android:hint="璇疯緭鍏ヨ韩浠借瘉鍙�"
+ android:inputType="text"
+ android:maxLength="18"
+ android:padding="12dp"
+ android:textSize="@dimen/new_card_size" />
+ </LinearLayout>
+ </LinearLayout>
+
+ <TextView
+ android:id="@+id/newCard_idTip"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="16dp"
+ android:text="鎵弿鍚庤鏍稿韬唤淇℃伅鏃犺"
+ android:textColor="#FF4500"
+ android:visibility="gone" />
+ </LinearLayout>
+ </androidx.cardview.widget.CardView>
+
+ <androidx.cardview.widget.CardView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="16dp"
+ app:cardCornerRadius="8dp"
+ app:cardElevation="2dp">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:padding="16dp">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="16dp"
+ android:text="鑱旂郴鏂瑰紡"
+ android:textColor="#333333"
+ android:textSize="18sp"
+ android:textStyle="bold" />
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="16dp"
+ android:gravity="center_vertical"
+ android:orientation="horizontal">
+
+ <TextView
+ android:layout_width="80dp"
+ android:layout_height="wrap_content"
+ android:text="鐢佃瘽"
+ android:textColor="#666666"
+ android:textSize="@dimen/new_card_size" />
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="#FFFFFF"
+ android:orientation="vertical">
+
+ <EditText
+ android:id="@+id/newCard_phone"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="@null"
+ android:hint="璇疯緭鍏ユ墜鏈哄彿鐮�"
+ android:inputType="phone"
+ android:maxLength="11"
+ android:padding="12dp"
+ android:textSize="@dimen/new_card_size" />
+ </LinearLayout>
+ </LinearLayout>
+ </LinearLayout>
+ </androidx.cardview.widget.CardView>
+
+ <androidx.cardview.widget.CardView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ app:cardCornerRadius="8dp"
+ app:cardElevation="2dp">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:padding="16dp">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="16dp"
+ android:text="璐圭敤淇℃伅"
+ android:textColor="#333333"
+ android:textSize="18sp"
+ android:textStyle="bold" />
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_vertical"
+ android:orientation="horizontal">
+
+ <TextView
+ android:layout_width="80dp"
+ android:layout_height="wrap_content"
+ android:text="宸ユ湰璐�(鍏�)"
+ android:textColor="#666666"
+ android:textSize="@dimen/new_card_size" />
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="#FFFFFF"
+ android:orientation="vertical">
+
+ <EditText
+ android:id="@+id/newCard_morny"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="@null"
+ android:hint="璇疯緭鍏ュ伐鏈垂"
+ android:inputType="numberDecimal"
+ android:padding="12dp"
+ android:textSize="@dimen/new_card_size" />
+ </LinearLayout>
+ </LinearLayout>
+ </LinearLayout>
+ </androidx.cardview.widget.CardView>
+
+ <!-- 闅愯棌鐨勬按鏉冨唴姘撮噺閮ㄥ垎 -->
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:visibility="gone">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="姘存潈鍐呮按閲忥細"
+ android:textSize="@dimen/new_card_size" />
+
+ <EditText
+ android:id="@+id/newCard_water"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:inputType="number"
+ android:maxLength="5"
+ android:textSize="@dimen/new_card_size" />
+ </LinearLayout>
+ </LinearLayout>
+ </ScrollView>
+
+ <TextView
+ android:id="@+id/newCard_registBtn"
+ android:layout_width="match_parent"
+ android:layout_height="56dp"
+ android:layout_alignParentBottom="true"
+ android:layout_marginStart="16dp"
+ android:layout_marginEnd="16dp"
+ android:layout_marginBottom="16dp"
+ android:background="#4285F4"
+ android:gravity="center"
+ android:text="纭寮�鎴�"
+ android:textColor="#FFFFFF"
+ android:textSize="16sp" />
+</RelativeLayout>
\ 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
new file mode 100644
index 0000000..71aee45
--- /dev/null
+++ b/generallibrary/src/main/res/layout/fragment_card.xml
@@ -0,0 +1,341 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@color/white">
+
+ <androidx.appcompat.widget.Toolbar
+ android:id="@+id/titleBar"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/dimen_title_height"
+ android:background="@color/bottom_color"
+ android:elevation="4dp"
+ app:layout_constraintTop_toTopOf="parent">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:text="鍒跺崱"
+ android:textColor="@color/white"
+ android:textSize="@dimen/title_text_size"
+ android:textStyle="bold" />
+ </androidx.appcompat.widget.Toolbar>
+
+ <ScrollView
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:fillViewport="true"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/titleBar">
+
+ <androidx.constraintlayout.widget.ConstraintLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:padding="16dp">
+
+ <androidx.cardview.widget.CardView
+ android:id="@+id/home_newCard"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="8dp"
+ android:layout_marginTop="16dp"
+ android:layout_marginEnd="8dp"
+ android:clickable="true"
+ android:focusable="true"
+ android:foreground="?android:attr/selectableItemBackground"
+ app:cardCornerRadius="12dp"
+ app:cardElevation="4dp"
+ app:layout_constraintEnd_toStartOf="@+id/home_redCard"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:orientation="vertical"
+ android:padding="16dp">
+
+ <ImageView
+ android:layout_width="70dp"
+ android:layout_height="70dp"
+ android:src="@drawable/home_add" />
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="8dp"
+ android:gravity="center"
+ android:text="鏂板崱寮�鎴�"
+ android:textColor="@color/text_selecter_color"
+ android:textSize="@dimen/home_text_size" />
+ </LinearLayout>
+ </androidx.cardview.widget.CardView>
+
+ <androidx.cardview.widget.CardView
+ android:id="@+id/home_recharge"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="8dp"
+ android:layout_marginTop="16dp"
+ android:layout_marginEnd="8dp"
+ android:clickable="true"
+ android:focusable="true"
+ android:foreground="?android:attr/selectableItemBackground"
+ android:visibility="gone"
+ app:cardCornerRadius="12dp"
+ app:cardElevation="4dp"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:orientation="vertical"
+ android:padding="16dp">
+
+ <ImageView
+ android:layout_width="70dp"
+ android:layout_height="70dp"
+ android:src="@drawable/home_recharge" />
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="8dp"
+ android:gravity="center"
+ android:text="鍏呭��"
+ android:textColor="@color/text_selecter_color"
+ android:textSize="@dimen/home_text_size" />
+ </LinearLayout>
+ </androidx.cardview.widget.CardView>
+
+ <androidx.cardview.widget.CardView
+ android:id="@+id/home_redCard"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="8dp"
+ android:layout_marginTop="16dp"
+ android:layout_marginEnd="8dp"
+ android:clickable="true"
+ android:focusable="true"
+ android:foreground="?android:attr/selectableItemBackground"
+ app:cardCornerRadius="12dp"
+ app:cardElevation="4dp"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toEndOf="@+id/home_newCard"
+ app:layout_constraintTop_toTopOf="parent">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:orientation="vertical"
+ android:padding="16dp">
+
+ <ImageView
+ android:layout_width="70dp"
+ android:layout_height="70dp"
+ android:src="@drawable/home_read" />
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="8dp"
+ android:gravity="center"
+ android:text="璇诲彇鍗$墖"
+ android:textColor="@color/text_selecter_color"
+ android:textSize="@dimen/home_text_size" />
+ </LinearLayout>
+ </androidx.cardview.widget.CardView>
+
+ <androidx.cardview.widget.CardView
+ android:id="@+id/home_loss"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="8dp"
+ android:layout_marginTop="24dp"
+ android:layout_marginEnd="8dp"
+ android:clickable="true"
+ android:focusable="true"
+ android:foreground="?android:attr/selectableItemBackground"
+ app:cardCornerRadius="12dp"
+ app:cardElevation="4dp"
+ app:layout_constraintEnd_toStartOf="@+id/home_replacement"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/home_newCard">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:orientation="vertical"
+ android:padding="16dp">
+
+ <ImageView
+ android:layout_width="70dp"
+ android:layout_height="70dp"
+ android:src="@drawable/home_report" />
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="8dp"
+ android:gravity="center"
+ android:text="鎸傚け"
+ android:textColor="@color/text_selecter_color"
+ android:textSize="@dimen/home_text_size" />
+ </LinearLayout>
+ </androidx.cardview.widget.CardView>
+
+ <TextView
+ android:id="@+id/home_reportLoss"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:text="瑙i櫎鎸傚け"
+ android:textColor="@color/text_selecter_color"
+ android:textSize="@dimen/home_text_size"
+ android:visibility="gone"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+
+ <androidx.cardview.widget.CardView
+ android:id="@+id/home_replacement"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="8dp"
+ android:layout_marginTop="24dp"
+ android:layout_marginEnd="8dp"
+ android:clickable="true"
+ android:focusable="true"
+ android:foreground="?android:attr/selectableItemBackground"
+ app:cardCornerRadius="12dp"
+ app:cardElevation="4dp"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toEndOf="@+id/home_loss"
+ app:layout_constraintTop_toBottomOf="@+id/home_redCard">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:orientation="vertical"
+ android:padding="16dp">
+
+ <ImageView
+ android:layout_width="70dp"
+ android:layout_height="70dp"
+ android:src="@drawable/home_replacement" />
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="8dp"
+ android:gravity="center"
+ android:text="琛ュ崱"
+ android:textColor="@color/text_selecter_color"
+ android:textSize="@dimen/home_text_size" />
+ </LinearLayout>
+ </androidx.cardview.widget.CardView>
+
+ <androidx.cardview.widget.CardView
+ android:id="@+id/home_admin"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="8dp"
+ android:layout_marginTop="24dp"
+ android:layout_marginEnd="8dp"
+ android:layout_marginBottom="16dp"
+ android:clickable="true"
+ android:focusable="true"
+ android:foreground="?android:attr/selectableItemBackground"
+ app:cardCornerRadius="12dp"
+ app:cardElevation="4dp"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/home_loss"
+ app:layout_constraintVertical_bias="0.0">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:orientation="vertical"
+ android:padding="16dp">
+
+ <ImageView
+ android:layout_width="70dp"
+ android:layout_height="70dp"
+ android:src="@drawable/home_system" />
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="8dp"
+ android:gravity="center"
+ android:text="绠$悊绯荤粺"
+ android:textColor="@color/text_selecter_color"
+ android:textSize="@dimen/home_text_size" />
+ </LinearLayout>
+ </androidx.cardview.widget.CardView>
+
+ <TextView
+ android:id="@+id/home_parameter"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:text="鍙傛暟璁剧疆"
+ android:textColor="@color/text_selecter_color"
+ android:textSize="@dimen/home_text_size"
+ android:visibility="gone"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+
+ <androidx.cardview.widget.CardView
+ android:id="@+id/home_my"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="8dp"
+ android:layout_marginTop="24dp"
+ android:layout_marginEnd="8dp"
+ android:clickable="true"
+ android:focusable="true"
+ android:foreground="?android:attr/selectableItemBackground"
+ android:visibility="gone"
+ app:cardCornerRadius="12dp"
+ app:cardElevation="4dp"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/home_admin">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:orientation="vertical"
+ android:padding="16dp">
+
+ <ImageView
+ android:layout_width="70dp"
+ android:layout_height="70dp"
+ android:src="@drawable/home_my" />
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="8dp"
+ android:gravity="center"
+ android:text="涓汉涓績"
+ android:textColor="@color/text_selecter_color"
+ android:textSize="@dimen/home_text_size" />
+ </LinearLayout>
+ </androidx.cardview.widget.CardView>
+ </androidx.constraintlayout.widget.ConstraintLayout>
+ </ScrollView>
+</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
diff --git a/generallibrary/src/main/res/layout/fragment_my.xml b/generallibrary/src/main/res/layout/fragment_my.xml
new file mode 100644
index 0000000..ede78b3
--- /dev/null
+++ b/generallibrary/src/main/res/layout/fragment_my.xml
@@ -0,0 +1,355 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:background="#F5F5F5">
+
+ <RelativeLayout
+ android:id="@+id/header_layout"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/dimen_title_height"
+ android:background="@color/bottom_color"
+ android:elevation="4dp">
+
+ <TextView
+ android:id="@+id/titleBar"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_centerInParent="true"
+ android:text="鎴戠殑"
+ android:textColor="@color/white"
+ android:textSize="@dimen/title_text_size"
+ android:textStyle="bold" />
+ </RelativeLayout>
+
+ <ScrollView
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:fillViewport="true">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:padding="16dp">
+
+ <!-- 鐢ㄦ埛淇℃伅鍗$墖 -->
+ <androidx.cardview.widget.CardView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="16dp"
+ app:cardCornerRadius="8dp"
+ app:cardElevation="2dp"
+ app:contentPadding="16dp">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="鍩烘湰淇℃伅"
+ android:textColor="#333333"
+ android:textSize="16sp"
+ android:textStyle="bold"
+ android:layout_marginBottom="12dp"/>
+
+ <LinearLayout
+ android:id="@+id/my_village"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:visibility="gone"
+ android:layout_marginBottom="8dp">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="璁惧缂栧彿锛�"
+ android:textSize="@dimen/text_size"
+ android:textColor="#666666" />
+
+ <TextView
+ android:id="@+id/my_villageNum"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textSize="@dimen/text_size"
+ android:textColor="#333333" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="8dp">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="鍖哄煙鍚嶇О锛�"
+ android:textColor="#666666"
+ android:textSize="@dimen/text_size" />
+
+ <TextView
+ android:id="@+id/my_adName"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textColor="#333333"
+ android:textSize="@dimen/text_size" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:id="@+id/my_admin"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="8dp"
+ android:orientation="horizontal">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="鍖哄煙鍙凤細"
+ android:textColor="#666666"
+ android:textSize="@dimen/text_size" />
+
+ <TextView
+ android:id="@+id/my_adminName"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textColor="#333333"
+ android:textSize="@dimen/text_size" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:id="@+id/my_waterPriceLL"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="鐢靛崟浠�(鍏�/搴�)锛�"
+ android:textColor="#666666"
+ android:textSize="@dimen/text_size" />
+
+ <TextView
+ android:id="@+id/my_waterPrice"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textColor="#333333"
+ android:textSize="@dimen/text_size" />
+ </LinearLayout>
+ </LinearLayout>
+ </androidx.cardview.widget.CardView>
+
+ <!-- 璁板綍绠$悊鍗$墖 -->
+ <androidx.cardview.widget.CardView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="16dp"
+ app:cardCornerRadius="8dp"
+ app:cardElevation="2dp"
+ app:contentPadding="16dp">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="璁板綍绠$悊"
+ android:textColor="#333333"
+ android:textSize="16sp"
+ android:textStyle="bold"
+ android:layout_marginBottom="12dp"/>
+
+ <RelativeLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="12dp"
+ android:padding="8dp"
+ android:background="#F9F9F9">
+
+ <ImageView
+ android:id="@+id/card_icon"
+ android:layout_width="24dp"
+ android:layout_height="24dp"
+ android:layout_centerVertical="true"
+ android:src="@android:drawable/ic_menu_agenda"
+ android:tint="#666666" />
+
+ <TextView
+ android:id="@+id/my_newCardList_ll"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_centerVertical="true"
+ android:layout_marginStart="8dp"
+ android:layout_toEndOf="@+id/card_icon"
+ android:layout_toStartOf="@+id/my_newCardOut"
+ android:text="寮�鍗¤褰�"
+ android:textColor="#333333"
+ android:textSize="@dimen/text_size" />
+
+ <TextView
+ android:id="@+id/my_newCardOut"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentEnd="true"
+ android:layout_centerVertical="true"
+ android:background="@drawable/rounded_button_bg"
+ android:paddingStart="12dp"
+ android:paddingEnd="12dp"
+ android:paddingTop="4dp"
+ android:paddingBottom="4dp"
+ android:text="瀵煎嚭璁板綍"
+ android:textColor="@color/white"
+ android:textSize="12sp" />
+ </RelativeLayout>
+
+ <RelativeLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:padding="8dp"
+ android:background="#F9F9F9">
+
+ <ImageView
+ android:id="@+id/recharge_icon"
+ android:layout_width="24dp"
+ android:layout_height="24dp"
+ android:layout_centerVertical="true"
+ android:src="@android:drawable/ic_menu_recent_history"
+ android:tint="#666666" />
+
+ <TextView
+ android:id="@+id/my_rechargeList_ll"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_centerVertical="true"
+ android:layout_marginStart="8dp"
+ android:layout_toEndOf="@+id/recharge_icon"
+ android:layout_toStartOf="@+id/my_rechargeOut"
+ android:text="鍏呭�艰褰�"
+ android:textColor="#333333"
+ android:textSize="@dimen/text_size" />
+
+ <TextView
+ android:id="@+id/my_rechargeOut"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentEnd="true"
+ android:layout_centerVertical="true"
+ android:background="@drawable/rounded_button_bg"
+ android:paddingStart="12dp"
+ android:paddingEnd="12dp"
+ android:paddingTop="4dp"
+ android:paddingBottom="4dp"
+ android:text="瀵煎嚭璁板綍"
+ android:textColor="@color/white"
+ android:textSize="12sp" />
+ </RelativeLayout>
+ </LinearLayout>
+ </androidx.cardview.widget.CardView>
+
+ <!-- 璁剧疆鍗$墖 -->
+ <androidx.cardview.widget.CardView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ app:cardCornerRadius="8dp"
+ app:cardElevation="2dp"
+ app:contentPadding="16dp">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="绯荤粺璁剧疆"
+ android:textColor="#333333"
+ android:textSize="16sp"
+ android:textStyle="bold"
+ android:layout_marginBottom="12dp"/>
+
+ <TextView
+ android:id="@+id/sys_ip"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="12dp"
+ android:background="#F9F9F9"
+ android:padding="12dp"
+ android:drawableStart="@android:drawable/ic_menu_manage"
+ android:drawablePadding="8dp"
+ android:drawableTint="#666666"
+ android:text="IP璁剧疆"
+ android:textColor="#333333"
+ android:textSize="@dimen/text_size"
+ android:visibility="gone" />
+
+ <TextView
+ android:id="@+id/card_replacement"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="12dp"
+ android:background="#F9F9F9"
+ android:padding="12dp"
+ android:drawableStart="@android:drawable/ic_menu_edit"
+ android:drawablePadding="8dp"
+ android:drawableTint="#666666"
+ android:text="鐢ㄦ埛琛ュ崱"
+ android:textColor="#333333"
+ android:textSize="@dimen/text_size"
+ android:visibility="gone" />
+
+ <TextView
+ android:id="@+id/my_psw"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="12dp"
+ android:background="#F9F9F9"
+ android:padding="12dp"
+ android:drawableStart="@android:drawable/ic_lock_lock"
+ android:drawablePadding="8dp"
+ android:drawableTint="#666666"
+ android:text="鐧诲綍瀵嗙爜璁剧疆"
+ android:textColor="#333333"
+ android:textSize="@dimen/text_size"
+ android:visibility="gone" />
+
+ <TextView
+ android:id="@+id/my_testConnect"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="#F9F9F9"
+ android:padding="12dp"
+ android:drawableStart="@android:drawable/ic_menu_compass"
+ android:drawablePadding="8dp"
+ android:drawableTint="#666666"
+ android:text="鏈繛鎺ユ暟鎹腑蹇�"
+ android:textColor="#333333"
+ android:textSize="@dimen/text_size"
+ android:visibility="gone" />
+ </LinearLayout>
+ </androidx.cardview.widget.CardView>
+ </LinearLayout>
+ </ScrollView>
+
+ <com.wang.avi.AVLoadingIndicatorView
+ android:id="@+id/avi"
+ style="@style/AVLoadingIndicatorView"
+ android:layout_width="80dp"
+ android:layout_height="80dp"
+ android:layout_centerHorizontal="true"
+ android:layout_centerVertical="true"
+ android:visibility="gone"
+ app:indicatorColor="@color/title_bg"
+ app:indicatorName="BallClipRotatePulseIndicator" />
+
+</LinearLayout>
\ No newline at end of file
diff --git a/generallibrary/src/main/res/layout/fragment_recharge.xml b/generallibrary/src/main/res/layout/fragment_recharge.xml
new file mode 100644
index 0000000..197c37a
--- /dev/null
+++ b/generallibrary/src/main/res/layout/fragment_recharge.xml
@@ -0,0 +1,400 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="#F5F5F5">
+
+ <RelativeLayout
+ android:id="@+id/header_layout"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/dimen_title_height"
+ android:background="@color/bottom_color"
+ android:elevation="4dp">
+
+ <TextView
+ android:id="@+id/titleBar"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_centerInParent="true"
+ android:text="鍏呭��"
+ android:textColor="@color/white"
+ android:textSize="@dimen/title_text_size"
+ android:textStyle="bold" />
+ </RelativeLayout>
+
+ <LinearLayout
+ android:id="@+id/recharge_read_LL"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_below="@+id/header_layout"
+ android:orientation="vertical"
+ android:visibility="visible">
+
+ <androidx.cardview.widget.CardView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_margin="16dp"
+ app:cardCornerRadius="8dp"
+ app:cardElevation="2dp">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:padding="16dp">
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="16dp"
+ android:gravity="center"
+ android:text="璇峰皢鍗¤创鍦ㄨ澶囦笂杩涜璇诲崱"
+ android:textColor="#333333"
+ android:textSize="@dimen/text_size"
+ android:textStyle="bold" />
+
+ <ImageView
+ android:layout_width="200dp"
+ android:layout_height="200dp"
+ android:layout_gravity="center"
+ android:scaleType="fitCenter"
+ android:src="@mipmap/nfc_write" />
+ </LinearLayout>
+ </androidx.cardview.widget.CardView>
+ </LinearLayout>
+
+ <ScrollView
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_above="@+id/recharge_registBtn"
+ android:layout_below="@+id/header_layout"
+ android:fillViewport="true">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:padding="16dp">
+
+ <LinearLayout
+ android:id="@+id/recharge_text_LL"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:visibility="gone">
+ <androidx.cardview.widget.CardView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+
+ app:cardCornerRadius="8dp"
+ app:cardElevation="2dp">
+
+ <LinearLayout
+ android:id="@+id/recharge_LL"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:padding="16dp">
+
+
+
+ <TextView
+ android:id="@+id/red_recharge_water"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="8dp"
+ android:text="鍏呭�兼按閲忥細"
+ android:textColor="#333333"
+ android:textSize="@dimen/text_size"
+ android:visibility="gone" />
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="#F9F9F9"
+ android:padding="12dp"
+ android:orientation="vertical">
+
+ <TextView
+ android:id="@+id/recharge_tx"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="8dp"
+ android:text="鍏呭�奸噾棰濓紙鍏冿級锛�"
+ android:textColor="@color/red"
+ android:textSize="@dimen/new_card_size"
+ android:textStyle="bold" />
+
+ <EditText
+ android:id="@+id/recharge_water"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="@android:color/white"
+ android:hint="璇疯緭鍏ュ厖鍊肩殑閲戦"
+ android:inputType="numberDecimal"
+ android:padding="12dp"
+ android:textSize="@dimen/new_card_size" />
+ </LinearLayout>
+ </LinearLayout>
+ </androidx.cardview.widget.CardView>
+ <androidx.cardview.widget.CardView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="16dp"
+ android:layout_marginTop="15dp"
+ app:cardCornerRadius="8dp"
+ app:cardElevation="2dp">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:padding="16dp">
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="12dp"
+ android:text="鍗$墖淇℃伅"
+ android:textColor="#333333"
+ android:textSize="16sp"
+ android:textStyle="bold" />
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="8dp"
+ android:orientation="horizontal">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="鍗$姸鎬侊細"
+ android:textColor="#666666"
+ android:textSize="@dimen/text_size" />
+
+ <TextView
+ android:id="@+id/red_statu"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textColor="@color/red"
+ android:textSize="@dimen/new_card_size" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="8dp"
+ android:orientation="horizontal">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="濮撳悕锛�"
+ android:textColor="#666666"
+ android:textSize="@dimen/new_card_size" />
+
+ <TextView
+ android:id="@+id/userName"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textColor="#333333"
+ android:textSize="@dimen/new_card_size" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="8dp"
+ android:orientation="horizontal">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="鍗″彿锛�"
+ android:textColor="#666666"
+ android:textSize="@dimen/text_size" />
+
+ <TextView
+ android:id="@+id/red_initCode"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text=""
+ android:textColor="#333333"
+ android:textSize="@dimen/new_card_size" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="8dp"
+ android:orientation="horizontal">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="鐢ㄦ埛缂栧彿锛�"
+ android:textColor="#666666"
+ android:textSize="@dimen/text_size" />
+
+ <TextView
+ android:id="@+id/red_userCode"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text=""
+ android:textColor="#333333"
+ android:textSize="@dimen/new_card_size" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="8dp"
+ android:orientation="horizontal"
+ android:visibility="visible">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="鍏呭�煎悗鍓╀綑閲戦锛�"
+ android:textColor="#666666"
+ android:textSize="@dimen/text_size" />
+
+ <TextView
+ android:id="@+id/red_remainder_blance"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textColor="#333333"
+ android:textSize="@dimen/new_card_size" />
+ </LinearLayout>
+ </LinearLayout>
+ </androidx.cardview.widget.CardView>
+
+ <androidx.cardview.widget.CardView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="16dp"
+ app:cardCornerRadius="8dp"
+ app:cardElevation="2dp">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:padding="16dp">
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="12dp"
+ android:text="鐢甸噺淇℃伅"
+ android:textColor="#333333"
+ android:textSize="16sp"
+ android:textStyle="bold" />
+
+ <TextView
+ android:id="@+id/red_balance_electric"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="8dp"
+ android:background="#F9F9F9"
+ android:padding="12dp"
+ android:text="鍓╀綑鐢甸噺锛�"
+ android:textColor="#333333"
+ android:textSize="@dimen/text_size"
+ android:visibility="visible" />
+
+ <TextView
+ android:id="@+id/red_rechargeDate"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="8dp"
+ android:background="#F9F9F9"
+ android:padding="12dp"
+ android:text="鏈�鍚庤喘姘存棩鏈燂細"
+ android:textColor="#333333"
+ android:textSize="@dimen/text_size"
+ android:visibility="visible" />
+
+ <TextView
+ android:id="@+id/red_rechargeElectric"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="8dp"
+ android:background="#F9F9F9"
+ android:padding="12dp"
+ android:text="鐢甸噺鍗曚环锛�"
+ android:textColor="#333333"
+ android:textSize="@dimen/text_size"
+ android:visibility="visible" />
+
+ <TextView
+ android:id="@+id/red_rechargeNumber"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="8dp"
+ android:background="#F9F9F9"
+ android:padding="12dp"
+ android:text="鍏呭�兼鏁帮細"
+ android:textColor="#333333"
+ android:textSize="@dimen/text_size"
+ android:visibility="gone" />
+
+ <TextView
+ android:id="@+id/red_total_water"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="8dp"
+ android:background="#F9F9F9"
+ android:padding="12dp"
+ android:text="鎬荤敤姘撮噺锛�"
+ android:textColor="#333333"
+ android:textSize="@dimen/text_size"
+ android:visibility="gone" />
+
+ <TextView
+ android:id="@+id/red_total_power"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="8dp"
+ android:background="#F9F9F9"
+ android:padding="12dp"
+ android:text="鎬荤敤鐢甸噺锛�"
+ android:textColor="#333333"
+ android:textSize="@dimen/text_size"
+ android:visibility="gone" />
+
+ <TextView
+ android:id="@+id/red_waterPrice"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="#F9F9F9"
+ android:padding="12dp"
+ android:text="姣忕珛鏂圭背姘翠环鏍硷細"
+ android:textColor="#333333"
+ android:textSize="@dimen/text_size"
+ android:visibility="gone" />
+ </LinearLayout>
+ </androidx.cardview.widget.CardView>
+
+
+ </LinearLayout>
+ </LinearLayout>
+ </ScrollView>
+
+ <Button
+ android:id="@+id/recharge_registBtn"
+ android:layout_width="match_parent"
+ android:layout_height="50dp"
+ android:layout_alignParentBottom="true"
+ android:layout_margin="16dp"
+ android:background="@drawable/rounded_button_bg"
+ android:elevation="2dp"
+ android:gravity="center"
+ android:text="鍏呭��"
+ android:textColor="@color/white"
+ android:textSize="@dimen/new_card_size"
+ android:textStyle="bold"
+ android:visibility="gone" />
+</RelativeLayout>
\ No newline at end of file
diff --git a/generallibrary/src/main/res/values/colors.xml b/generallibrary/src/main/res/values/colors.xml
index 0700b3a..f6ccfac 100644
--- a/generallibrary/src/main/res/values/colors.xml
+++ b/generallibrary/src/main/res/values/colors.xml
@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="bottom_color">#3D8BFF</color>
+ <color name="black">#333</color>
+ <color name="white">#fff</color>
+ <color name="nav_item_color">#555555</color>
</resources>
\ No newline at end of file
diff --git a/generallibrary/src/main/res/values/dimens.xml b/generallibrary/src/main/res/values/dimens.xml
new file mode 100644
index 0000000..73a870b
--- /dev/null
+++ b/generallibrary/src/main/res/values/dimens.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+ <dimen name="title_text_size">20sp</dimen>
+
+</resources>
\ No newline at end of file
diff --git a/henanlibrary/src/main/java/com/dayu/henanlibrary/tools/NFCWriteHelper.java b/henanlibrary/src/main/java/com/dayu/henanlibrary/tools/NFCWriteHelper.java
index 2b71814..4185498 100644
--- a/henanlibrary/src/main/java/com/dayu/henanlibrary/tools/NFCWriteHelper.java
+++ b/henanlibrary/src/main/java/com/dayu/henanlibrary/tools/NFCWriteHelper.java
@@ -2,17 +2,10 @@
import android.app.Activity;
import android.content.Intent;
-import android.nfc.NfcAdapter;
-import android.nfc.Tag;
import android.nfc.tech.MifareClassic;
-import android.util.Log;
-import com.dayu.baselibrary.tools.HexUtil;
-import com.dayu.baselibrary.tools.nfc.BaseNfcWriteHelper;
import com.dayu.baselibrary.tools.nfc.NfcWriteAdapter;
import com.dayu.henanlibrary.card.UserCardHN;
-
-import java.io.IOException;
/**
* @author zx
--
Gitblit v1.8.0