左晓为主开发手持机充值管理机
29个文件已修改
1个文件已删除
1531 ■■■■■ 已修改文件
generallibrary/build.gradle 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
generallibrary/src/main/cpp/general-native-lib.cpp 38 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
generallibrary/src/main/java/com/dayu/general/activity/NewCard2Activity.kt 191 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
generallibrary/src/main/java/com/dayu/general/activity/SearchUserListActivity.kt 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
generallibrary/src/main/java/com/dayu/general/bean/net/SearchCardResult.kt 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
generallibrary/src/main/java/com/dayu/general/bean/net/SearchUserResult.kt 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
generallibrary/src/main/java/com/dayu/general/tool/NfcReadHelper.kt 221 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
generallibrary/src/main/java/com/dayu/general/tool/NfcWreatHelper.kt 149 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
generallibrary/src/main/res/layout/activity_new_card_1_ge.xml 414 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
generallibrary/src/main/res/layout/activity_new_card_ge.xml 461 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pickerviewlibrary/src/main/java/com/wang/avi/indicators/BallBeatIndicator.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pickerviewlibrary/src/main/java/com/wang/avi/indicators/BallClipRotateIndicator.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pickerviewlibrary/src/main/java/com/wang/avi/indicators/BallClipRotateMultipleIndicator.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pickerviewlibrary/src/main/java/com/wang/avi/indicators/BallClipRotatePulseIndicator.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pickerviewlibrary/src/main/java/com/wang/avi/indicators/BallGridBeatIndicator.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pickerviewlibrary/src/main/java/com/wang/avi/indicators/BallGridPulseIndicator.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pickerviewlibrary/src/main/java/com/wang/avi/indicators/BallPulseIndicator.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pickerviewlibrary/src/main/java/com/wang/avi/indicators/BallPulseSyncIndicator.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pickerviewlibrary/src/main/java/com/wang/avi/indicators/BallScaleIndicator.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pickerviewlibrary/src/main/java/com/wang/avi/indicators/BallScaleMultipleIndicator.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pickerviewlibrary/src/main/java/com/wang/avi/indicators/BallScaleRippleIndicator.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pickerviewlibrary/src/main/java/com/wang/avi/indicators/BallScaleRippleMultipleIndicator.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pickerviewlibrary/src/main/java/com/wang/avi/indicators/BallSpinFadeLoaderIndicator.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pickerviewlibrary/src/main/java/com/wang/avi/indicators/BallTrianglePathIndicator.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pickerviewlibrary/src/main/java/com/wang/avi/indicators/BallZigZagDeflectIndicator.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pickerviewlibrary/src/main/java/com/wang/avi/indicators/BallZigZagIndicator.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pickerviewlibrary/src/main/java/com/wang/avi/indicators/CubeTransitionIndicator.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pickerviewlibrary/src/main/java/com/wang/avi/indicators/LineScaleIndicator.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pickerviewlibrary/src/main/java/com/wang/avi/indicators/LineScalePartyIndicator.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pickerviewlibrary/src/main/java/com/wang/avi/indicators/PacmanIndicator.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
generallibrary/build.gradle
@@ -77,6 +77,7 @@
        exclude group: 'com.google.code.gson';
    }
    implementation 'com.squareup.retrofit2:adapter-rxjava3:2.9.0'
    implementation 'io.reactivex.rxjava3:rxjava:3.1.5'
    implementation 'io.reactivex.rxjava3:rxandroid:3.0.0'
    implementation 'com.squareup.okhttp3:logging-interceptor:4.11.0'
    compileOnly 'com.google.code.gson:gson:2.10.1'
generallibrary/src/main/cpp/general-native-lib.cpp
@@ -96,19 +96,19 @@
        return nullptr;
    }
    __android_log_print(ANDROID_LOG_INFO, "GeBaseHelper", "Decrypting sector %d", sector);
    __android_log_print(ANDROID_LOG_INFO, "GeBaseHelper", "Encrypted data: %02X %02X %02X %02X %02X %02X",
                       encrypted_data[0], encrypted_data[1], encrypted_data[2],
                       encrypted_data[3], encrypted_data[4], encrypted_data[5]);
    __android_log_print(ANDROID_LOG_INFO, "GeBaseHelper", "Using XOR key: %02X %02X %02X %02X %02X %02X",
                       XOR_KEYS[sector][0], XOR_KEYS[sector][1], XOR_KEYS[sector][2],
                       XOR_KEYS[sector][3], XOR_KEYS[sector][4], XOR_KEYS[sector][5]);
//    __android_log_print(ANDROID_LOG_INFO, "GeBaseHelper", "Decrypting sector %d", sector);
//    __android_log_print(ANDROID_LOG_INFO, "GeBaseHelper", "Encrypted data: %02X %02X %02X %02X %02X %02X",
//                       encrypted_data[0], encrypted_data[1], encrypted_data[2],
//                       encrypted_data[3], encrypted_data[4], encrypted_data[5]);
//    __android_log_print(ANDROID_LOG_INFO, "GeBaseHelper", "Using XOR key: %02X %02X %02X %02X %02X %02X",
//                       XOR_KEYS[sector][0], XOR_KEYS[sector][1], XOR_KEYS[sector][2],
//                       XOR_KEYS[sector][3], XOR_KEYS[sector][4], XOR_KEYS[sector][5]);
    unsigned char decrypted[6];
    for (int i = 0; i < 6; i++) {
        decrypted[i] = encrypted_data[i] ^ XOR_KEYS[sector][i];
        __android_log_print(ANDROID_LOG_INFO, "GeBaseHelper", "Byte %d: %02X ^ %02X = %02X",
                          i, encrypted_data[i], XOR_KEYS[sector][i], decrypted[i]);
//        __android_log_print(ANDROID_LOG_INFO, "GeBaseHelper", "Byte %d: %02X ^ %02X = %02X",
//                          i, encrypted_data[i], XOR_KEYS[sector][i], decrypted[i]);
    }
    std::string result;
@@ -119,7 +119,7 @@
        result += hex;
    }
    __android_log_print(ANDROID_LOG_INFO, "GeBaseHelper", "Decrypted result: %s", result.c_str());
//    __android_log_print(ANDROID_LOG_INFO, "GeBaseHelper", "Decrypted result: %s", result.c_str());
    return env->NewStringUTF(result.c_str());
}
@@ -187,7 +187,7 @@
    jobject packageInfoObject = env->CallObjectMethod(packageManagerObject, getPackageInfoId,
                                                    packNameString, 64);
    if (!packageInfoObject) {
        __android_log_print(ANDROID_LOG_ERROR, "M1Card", "Failed to get PackageInfo");
//        __android_log_print(ANDROID_LOG_ERROR, "M1Card", "Failed to get PackageInfo");
        return env->NewStringUTF("");
    }
@@ -195,7 +195,7 @@
    jfieldID signaturefieldID = env->GetFieldID(packageInfoClass, "signatures",
                                              "[Landroid/content/pm/Signature;");
    if (!signaturefieldID) {
        __android_log_print(ANDROID_LOG_ERROR, "M1Card", "Failed to get signature field ID");
//        __android_log_print(ANDROID_LOG_ERROR, "M1Card", "Failed to get signature field ID");
        return env->NewStringUTF("");
    }
@@ -203,28 +203,28 @@
    jobjectArray signatureArray = (jobjectArray) env->GetObjectField(packageInfoObject,
                                                                   signaturefieldID);
    if (!signatureArray || env->GetArrayLength(signatureArray) == 0) {
        __android_log_print(ANDROID_LOG_ERROR, "M1Card", "No signatures found");
//        __android_log_print(ANDROID_LOG_ERROR, "M1Card", "No signatures found");
        return env->NewStringUTF("");
    }
    // 获取第一个签名对象
    jobject signatureObject = env->GetObjectArrayElement(signatureArray, 0);
    if (!signatureObject) {
        __android_log_print(ANDROID_LOG_ERROR, "M1Card", "Failed to get signature object");
//        __android_log_print(ANDROID_LOG_ERROR, "M1Card", "Failed to get signature object");
        return env->NewStringUTF("");
    }
    // 获取签名字符串
    jstring signatureString = (jstring) env->CallObjectMethod(signatureObject, signToStringId);
    if (!signatureString) {
        __android_log_print(ANDROID_LOG_ERROR, "M1Card", "Failed to get signature string");
//        __android_log_print(ANDROID_LOG_ERROR, "M1Card", "Failed to get signature string");
        return env->NewStringUTF("");
    }
    // 获取签名字符串的UTF-8字符
    const char *signStrng = env->GetStringUTFChars(signatureString, 0);
    if (!signStrng) {
        __android_log_print(ANDROID_LOG_ERROR, "M1Card", "Failed to get signature UTF chars");
//        __android_log_print(ANDROID_LOG_ERROR, "M1Card", "Failed to get signature UTF chars");
        return env->NewStringUTF("");
    }
@@ -240,11 +240,11 @@
        // 解密并转换每个扇区密钥
        for (size_t i = 0; i < numKeys; i++) {
           __android_log_print(ANDROID_LOG_DEBUG, "M1Card", "处理扇区 %zu 的密钥", i);
//           __android_log_print(ANDROID_LOG_DEBUG, "M1Card", "处理扇区 %zu 的密钥", i);
            
            // 确保不会越界访问
            if (i * 12 + 6 > sizeof(ENCRYPTED_SECTOR_KEYS)) {
                __android_log_print(ANDROID_LOG_ERROR, "M1Card", "Index out of bounds");
//                __android_log_print(ANDROID_LOG_ERROR, "M1Card", "Index out of bounds");
                break;
            }
            
@@ -252,7 +252,7 @@
            jstring decrypted_str = decrypt_key(env, ENCRYPTED_SECTOR_KEYS + (i * 12), 6);
            
            if (!decrypted_str) {
               __android_log_print(ANDROID_LOG_ERROR, "M1Card", "Failed to decrypt key for sector %zu", i);
//               __android_log_print(ANDROID_LOG_ERROR, "M1Card", "Failed to decrypt key for sector %zu", i);
                continue;
            }
            
generallibrary/src/main/java/com/dayu/general/activity/NewCard2Activity.kt
@@ -4,25 +4,24 @@
import android.os.Bundle
import android.text.Editable
import android.text.TextWatcher
import android.util.TypedValue
import android.view.View
import android.widget.RadioButton
import android.widget.Toast
import androidx.lifecycle.lifecycleScope
import com.dayu.baselibrary.net.subscribers.SubscriberListener
import com.dayu.baselibrary.tools.nfc.NFCCallBack
import com.dayu.baselibrary.view.TitleBar.ClickType_LEFT_IMAGE
import com.dayu.general.BaseApplication
import com.dayu.general.R
import com.dayu.general.bean.db.CardRegistrationBean
import com.dayu.general.dao.BaseDaoSingleton
import com.dayu.general.databinding.ActivityNewCard1GeBinding
import com.dayu.general.databinding.ActivityNewCardGeBinding
import com.dayu.general.net.ApiManager
import com.dayu.general.net.BaseResponse
import com.dayu.general.tool.NfcReadHelper
import com.dayu.general.tool.NfcWreatHelper
import com.tencent.bugly.crashreport.CrashReport
import kotlinx.coroutines.launch
import android.util.TypedValue
/**
 * Description: 用户开卡界面(同步修改白卡密码)
@@ -31,11 +30,11 @@
 */
class NewCard2Activity : BaseNfcActivity() {
    private lateinit var binding: ActivityNewCard1GeBinding
    private lateinit var binding: ActivityNewCardGeBinding
    // 支付方式
    private var paymentMethod: String = "现金"
    // 支付方式ID
    private var paymentId: Long = 0
@@ -47,6 +46,12 @@
    // 用户ID
    private var userId: String = ""
    // 客户ID
    private var clientId: String = ""
    // 是否已读卡
    private var isReadCard: Boolean = false
    companion object {
        private const val TAG = "NewCard2Activity"
@@ -69,17 +74,39 @@
        val pageTotal: Any?
    )
    // 用户信息数据类
    data class ClientInfo(
        val clientId: String,
        val clientNum: String,
        val name: String,
        val districtNum: String,
        val phone: String,
        val idCard: String,
        val villageName: String,
        val address: String,
        val cardCount: Int,
        val operateDt: String
    )
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = ActivityNewCard1GeBinding.inflate(layoutInflater)
        binding = ActivityNewCardGeBinding.inflate(layoutInflater)
        setContentView(binding.root)
        // 获取传递的clientId参数
        clientId = intent.getStringExtra("clientId") ?: ""
        initView()
        // 如果有clientId,获取客户信息
        if (clientId.isNotEmpty()) {
            getClientInfo(clientId)
        }
        // 获取支付方式
        getPaymentMethods()
        initListener()
    }
    private fun initView() {
        // 初始化标题栏返回按钮
@@ -90,21 +117,66 @@
        // 初始化NFC读卡容器,初始隐藏
        binding.nfcContainer.visibility = View.VISIBLE
        // 从Intent中获取用户信息(如果有)
        val userName = intent.getStringExtra("userName") ?: ""
        val rawIdCard = intent.getStringExtra("idCard")
        val idCard = if (rawIdCard.isNullOrBlank()) "无" else rawIdCard
        val farmerCode = intent.getStringExtra("farmerCode") ?: ""
        userId = intent.getStringExtra("userId") ?: ""
        // 设置用户信息
        binding.newCardUserName.text = userName
        binding.newCardIdCard.text = idCard
        binding.newCardFarmerCode.text = farmerCode
        // 设置金额输入限制为两位小数
        binding.newCardRechargeAmount.addTextChangedListener(createDecimalTextWatcher())
        binding.newCardCardFee.addTextChangedListener(createDecimalTextWatcher())
    }
    /**
     * 获取客户详细信息
     */
    private fun getClientInfo(clientId: String) {
        ApiManager.getInstance().requestGetLoading(
            this,
            "terminal/client/getTermOne/$clientId",
            ClientInfo::class.java,
            null,
            object : SubscriberListener<BaseResponse<ClientInfo>>() {
                override fun onNext(response: BaseResponse<ClientInfo>) {
                    if (response.success) {
                        val clientInfo = response.content
                        if (clientInfo != null) {
                            // 显示客户信息到界面
                            displayClientInfo(clientInfo)
                        } else {
                            Toast.makeText(
                                this@NewCard2Activity,
                                "获取客户信息失败: 返回数据为空",
                                Toast.LENGTH_SHORT
                            ).show()
                        }
                    } else {
                        Toast.makeText(
                            this@NewCard2Activity,
                            "获取客户信息失败: ${response.msg}",
                            Toast.LENGTH_SHORT
                        ).show()
                    }
                }
                override fun onError(e: Throwable?) {
                    super.onError(e)
                    Toast.makeText(
                        this@NewCard2Activity,
                        "获取客户信息失败: ${e?.message ?: "网络异常"}",
                        Toast.LENGTH_SHORT
                    ).show()
                }
            }
        )
    }
    /**
     * 显示客户信息到界面
     */
    private fun displayClientInfo(clientInfo: ClientInfo) {
        // 保存用户ID供后续使用
        userId = clientInfo.clientId
        // 显示用户基本信息
        binding.newCardUserName.text = clientInfo.name
        binding.newCardIdCard.text = if (clientInfo.idCard.isBlank()) "无" else clientInfo.idCard
        binding.newCardFarmerCode.text = clientInfo.clientNum
    }
    /**
@@ -163,23 +235,23 @@
                resources.getDimensionPixelSize(R.dimen.dimen_40),
                1.0f
            )
            // 如果不是最后一个按钮,添加右边距
            if (index < paymentMethodList.size - 1) {
                (radioButton.layoutParams as android.widget.LinearLayout.LayoutParams).rightMargin =
                (radioButton.layoutParams as android.widget.LinearLayout.LayoutParams).rightMargin =
                    resources.getDimensionPixelSize(R.dimen.dimen_15)
            }
            radioButton.text = method.name
            radioButton.background = resources.getDrawable(R.drawable.radio_selector)
            radioButton.buttonDrawable = null
            radioButton.gravity = android.view.Gravity.CENTER
            radioButton.setTextColor(resources.getColorStateList(R.color.radio_button_text_color))
            radioButton.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14f)
            // 添加到RadioGroup
            binding.newCardPaymentMethod.addView(radioButton)
            // 默认选中第一个
            if (index == 0) {
                radioButton.isChecked = true
@@ -244,6 +316,9 @@
        }
    }
    /**
     * 注册新卡
     */
    private fun registerNewCard() {
        // 获取充值金额
        val rechargeAmountStr = binding.newCardRechargeAmount.text.toString()
@@ -348,17 +423,25 @@
    }
    override fun onNfcBack(intent: Intent) {
        var cardNumber = NfcReadHelper.getInstance(intent, this).getCardNumberNoClose()
        if (!cardNumber.isEmpty()) {
            try {
                // 创建密钥列表的副本,避免ConcurrentModificationException
                val keyList = ArrayList(NfcReadHelper.getInstance(intent, this).getKeyList())
        if (!isReadCard) {
            val cardNumber = NfcReadHelper.getInstance(intent, this).getCardNumberNoClose()
            if (cardNumber.isNotEmpty()) {
                try {
                    // 创建密钥列表的副本,避免ConcurrentModificationException
                    val keyList = ArrayList(NfcReadHelper.getInstance(intent, this).getKeyList())
                NfcWreatHelper.getInstance(intent, this).changePS(keyList, false, true, object :
                    NFCCallBack {
                    // 使用美化的加载动画来显示NFC操作的加载状态
                    val nfcHelper = NfcWreatHelper.getInstance(intent, this)
                    nfcHelper.setLoadingView(binding.loadingContainer, binding.nfcProgressWheel)
                    override fun isSusses(flag: Boolean, msg: String?) {
                        if (flag) {
                    // 异步修改密码
                    nfcHelper.changePSAsync(
                        keyList,
                        false,
                        true
                    ) { success: Boolean, msg: String? ->
                        if (success) {
                            isReadCard = true
                            // 保存卡物理ID
                            cardPhysicalId = cardNumber
                            // 更新UI
@@ -371,22 +454,44 @@
                            // 密码修改失败,处理错误情况
                            Toast.makeText(
                                this@NewCard2Activity,
                                "卡片初始化失败:" + msg,
                                "卡片初始化失败:$msg",
                                Toast.LENGTH_LONG
                            )
                                .show()
                            ).show()
                        }
                    }
                })
            } catch (e: Exception) {
                // 处理异常情况
                CrashReport.postCatchedException(e)
                e.printStackTrace()
                } catch (e: Exception) {
                    // 处理异常情况
                    CrashReport.postCatchedException(e)
                    e.printStackTrace()
                }
            } else {
                Toast.makeText(
                    this@NewCard2Activity,
                    "获取卡号失败",
                    Toast.LENGTH_SHORT
                ).show()
            }
        } else {
            Toast.makeText(
                this@NewCard2Activity,
                "当前已读卡,不可再次读卡",
                Toast.LENGTH_SHORT
            ).show()
        }
    }
    override fun onDestroy() {
        super.onDestroy()
        // 清理NFC工具类中的RxJava订阅,防止内存泄漏
        try {
            NfcReadHelper.getInstance(intent, this).clearDisposables()
            NfcWreatHelper.getInstance(intent, this).clearDisposables()
            // 确保停止动画,避免内存泄漏
            binding.nfcProgressWheel.stopSpinning()
        } catch (e: Exception) {
            e.printStackTrace()
        }
    }
}
generallibrary/src/main/java/com/dayu/general/activity/SearchUserListActivity.kt
@@ -86,10 +86,7 @@
            // 处理用户点击事件
            // 传递用户信息到开卡界面
            val intent = Intent(this, NewCard2Activity::class.java)
            intent.putExtra("userName", user.name)
            intent.putExtra("idCard", user.idCard)
            intent.putExtra("farmerCode", user.clientNum)
            intent.putExtra("userId", user.id)
            intent.putExtra("clientId", user.clientId)
            startActivity(intent)
        }
generallibrary/src/main/java/com/dayu/general/bean/net/SearchCardResult.kt
@@ -24,6 +24,7 @@
        val idCard: String? = null,        // 身份证号
        val money: String? = null,         // 卡余额
        val phone: String? = null,         // 电话号码
        val stateName: String? = null      // 状态名称
        val stateName: String? = null,     // 状态名称
        val clientId: String? = null       // 客户ID
    )
generallibrary/src/main/java/com/dayu/general/bean/net/SearchUserResult.kt
@@ -17,7 +17,7 @@
    /**
     * 用户信息
     */
    data class UserInfo (
    data class UserInfo(
        val address: String? = null,   // 地址
        val cardCount: Int? = null,    // 卡数量
        val clientNum: String? = null, // 客户编号
@@ -25,6 +25,7 @@
        val idCard: String? = null,    // 身份证
        val name: String? = null,      // 姓名
        val operateDt: String? = null, // 操作日期
        val phone: String? = null      // 电话
        val phone: String? = null,      // 电话
        val clientId: String? = null       // 客户ID
    )
}
generallibrary/src/main/java/com/dayu/general/tool/NfcReadHelper.kt
@@ -2,8 +2,16 @@
import android.app.Activity
import android.content.Intent
import android.view.View
import android.widget.RelativeLayout
import com.dayu.baselibrary.tools.nfc.BaseNfcReadHelper
import com.dayu.baselibrary.tools.nfc.NfcReadAdapter
import com.pnikosis.materialishprogress.ProgressWheel
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.core.Observable
import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.disposables.Disposable
import io.reactivex.rxjava3.schedulers.Schedulers
/**
 * NFC读取工具类的Kotlin实现
@@ -11,6 +19,9 @@
class NfcReadHelper private constructor(intent: Intent, activity: Activity) : GeBaseHelper(activity) {
    
    private val adapter: NfcReadAdapter = NfcReadAdapter(intent, activity)
    private val compositeDisposable = CompositeDisposable()
    private var loadingContainer: RelativeLayout? = null
    private var progressWheel: ProgressWheel? = null
    companion object {
        private var helper: NfcReadHelper? = null
@@ -27,7 +38,83 @@
        }
    }
    /**
     * 设置加载动画视图
     */
    fun setLoadingView(loadingContainer: RelativeLayout, progressWheel: ProgressWheel) {
        this.loadingContainer = loadingContainer
        this.progressWheel = progressWheel
    }
    /**
     * 显示加载动画
     */
    private fun showLoading() {
        loadingContainer?.let {
            it.visibility = View.VISIBLE
        }
        progressWheel?.let {
            it.spin()
        }
    }
    /**
     * 隐藏加载动画
     */
    private fun hideLoading() {
        loadingContainer?.let {
            it.visibility = View.GONE
        }
        progressWheel?.let {
            it.stopSpinning()
        }
    }
    /**
     * 获取卡号(异步)
     */
    fun getCardNumberAsync(callback: (String) -> Unit): Disposable {
        showLoading()
        val disposable = Observable.fromCallable {
            getCardNumber()
        }
        .subscribeOn(Schedulers.io())
        .observeOn(AndroidSchedulers.mainThread())
        .subscribe({ result ->
            hideLoading()
            callback(result)
        }, { error ->
            hideLoading()
            error.printStackTrace()
            callback("")
        })
        compositeDisposable.add(disposable)
        return disposable
    }
    /**
     * 获取卡号(不关闭连接,异步)
     */
    fun getCardNumberNoCloseAsync(callback: (String) -> Unit): Disposable {
        showLoading()
        val disposable = Observable.fromCallable {
            getCardNumberNoClose()
        }
        .subscribeOn(Schedulers.io())
        .observeOn(AndroidSchedulers.mainThread())
        .subscribe({ result ->
            hideLoading()
            callback(result)
        }, { error ->
            hideLoading()
            error.printStackTrace()
            callback("")
        })
        compositeDisposable.add(disposable)
        return disposable
    }
    /**
     * 获取卡号
@@ -50,8 +137,28 @@
        }
    }
    /**
     * 获取卡片类型和卡号(异步)
     */
    fun getCardTypeAndCardNumberAsync(callback: (String) -> Unit): Disposable {
        showLoading()
        val disposable = Observable.fromCallable {
            getCardTypeAndCardNumber()
        }
        .subscribeOn(Schedulers.io())
        .observeOn(AndroidSchedulers.mainThread())
        .subscribe({ result ->
            hideLoading()
            callback(result)
        }, { error ->
            hideLoading()
            error.printStackTrace()
            callback("")
        })
        compositeDisposable.add(disposable)
        return disposable
    }
    /**
     * 获取卡片类型和卡号
@@ -66,6 +173,46 @@
    }
    /**
     * 读取NFC卡的全部信息(异步)
     */
    fun getAllDataAsync(callback: BaseNfcReadHelper.NFCCallMapback) {
        showLoading()
        val disposable = Observable.fromCallable {
            try {
                adapter.getAllData(object : BaseNfcReadHelper.NFCCallMapback {
                    override fun callBack(data: Map<String, List<ByteArray>>) {
                        hideLoading()
                        callback.callBack(data)
                    }
                    override fun error(code: Int) {
                        hideLoading()
                        callback.error(code)
                    }
                })
                true
            } catch (e: Exception) {
                e.printStackTrace()
                false
            }
        }
        .subscribeOn(Schedulers.io())
        .observeOn(AndroidSchedulers.mainThread())
        .subscribe({ success ->
            if (!success) {
                hideLoading()
                callback.error(-1)
            }
        }, { error ->
            hideLoading()
            error.printStackTrace()
            callback.error(-1)
        })
        compositeDisposable.add(disposable)
    }
    /**
     * 读取NFC卡的全部信息
     */
    fun getAllData(callback: BaseNfcReadHelper.NFCCallMapback) {
@@ -74,6 +221,29 @@
        } catch (e: Exception) {
            e.printStackTrace()
        }
    }
    /**
     * 获取一个扇区的数据(异步)
     */
    fun getOneSectorDataAsync(callback: (List<ByteArray>?) -> Unit): Disposable {
        showLoading()
        val disposable = Observable.fromCallable<Any> {
            getOneSectorData() as Any
        }
        .subscribeOn(Schedulers.io())
        .observeOn(AndroidSchedulers.mainThread())
        .subscribe({ result ->
            hideLoading()
            callback(result as? List<ByteArray>)
        }, { error ->
            hideLoading()
            error.printStackTrace()
            callback(null)
        })
        compositeDisposable.add(disposable)
        return disposable
    }
    /**
@@ -89,6 +259,46 @@
    }
    /**
     * 读取NFC卡的特定扇区信息(异步)
     */
    fun getDataAsync(a: Int, b: Int, callback: BaseNfcReadHelper.NFCCallByteback) {
        showLoading()
        val disposable = Observable.fromCallable {
            try {
                adapter.getData(a, b, object : BaseNfcReadHelper.NFCCallByteback {
                    override fun callBack(data: ByteArray) {
                        hideLoading()
                        callback.callBack(data)
                    }
                    override fun error(code: Int) {
                        hideLoading()
                        callback.error(code)
                    }
                })
                true
            } catch (e: Exception) {
                e.printStackTrace()
                false
            }
        }
        .subscribeOn(Schedulers.io())
        .observeOn(AndroidSchedulers.mainThread())
        .subscribe({ success ->
            if (!success) {
                hideLoading()
                callback.error(-1)
            }
        }, { error ->
            hideLoading()
            error.printStackTrace()
            callback.error(-1)
        })
        compositeDisposable.add(disposable)
    }
    /**
     * 读取NFC卡的特定扇区信息
     */
    fun getData(a: Int, b: Int, callback: BaseNfcReadHelper.NFCCallByteback) {
@@ -99,5 +309,10 @@
        }
    }
    /**
     * 清除所有订阅,防止内存泄漏
     */
    fun clearDisposables() {
        compositeDisposable.clear()
    }
}
generallibrary/src/main/java/com/dayu/general/tool/NfcWreatHelper.kt
@@ -2,14 +2,25 @@
import android.app.Activity
import android.content.Intent
import android.view.View
import android.widget.RelativeLayout
import com.dayu.baselibrary.tools.nfc.NFCCallBack
import com.dayu.baselibrary.tools.nfc.NfcWriteAdapter
import com.dayu.general.bean.card.UserCard
import com.pnikosis.materialishprogress.ProgressWheel
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.core.Observable
import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.disposables.Disposable
import io.reactivex.rxjava3.schedulers.Schedulers
class NfcWreatHelper private constructor(intent: Intent, activity: Activity) :
    GeBaseHelper(activity) {
    private val adapter: NfcWriteAdapter = NfcWriteAdapter(intent, activity)
    private val compositeDisposable = CompositeDisposable()
    private var loadingContainer: RelativeLayout? = null
    private var progressWheel: ProgressWheel? = null
    companion object {
        private var helper: NfcWreatHelper? = null
@@ -27,6 +38,69 @@
        }
    }
    /**
     * 设置加载动画视图
     */
    fun setLoadingView(loadingContainer: RelativeLayout, progressWheel: ProgressWheel) {
        this.loadingContainer = loadingContainer
        this.progressWheel = progressWheel
    }
    /**
     * 显示加载动画
     */
    private fun showLoading() {
        loadingContainer?.let {
            it.visibility = View.VISIBLE
        }
        progressWheel?.let {
            it.spin()
        }
    }
    /**
     * 隐藏加载动画
     */
    private fun hideLoading() {
        loadingContainer?.let {
            it.visibility = View.GONE
        }
        progressWheel?.let {
            it.stopSpinning()
        }
    }
    /**
     * 写卡(异步)
     *
     * @param str 书写内容,16个字节
     * @param a   书写的扇区 (从0开始数)
     * @param b   书写的块(从0开始数)
     * @param callback 操作结果回调
     */
    fun writeDataAsync(str: ByteArray?, a: Int, b: Int, callback: (Boolean) -> Unit): Disposable {
        showLoading()
        val disposable = Observable.fromCallable {
            writeData(str, a, b, object : NFCCallBack {
                override fun isSusses(flag: Boolean, msg: String?) {
                    // 这个回调在IO线程中,不处理UI相关操作
                }
            })
        }
        .subscribeOn(Schedulers.io())
        .observeOn(AndroidSchedulers.mainThread())
        .subscribe({ result ->
            hideLoading()
            callback(result)
        }, { error ->
            hideLoading()
            error.printStackTrace()
            callback(false)
        })
        compositeDisposable.add(disposable)
        return disposable
    }
    /**
     * 写卡
@@ -46,6 +120,32 @@
    }
    /**
     * 写卡(异步)
     *
     * @param userCard 用户卡内容
     * @param callback 操作结果回调
     */
    fun writeUserDataAsync(userCard: UserCard, callback: (Boolean) -> Unit): Disposable {
        showLoading()
        val disposable = Observable.fromCallable {
            writeUserData(userCard)
        }
        .subscribeOn(Schedulers.io())
        .observeOn(AndroidSchedulers.mainThread())
        .subscribe({ result ->
            hideLoading()
            callback(result)
        }, { error ->
            hideLoading()
            error.printStackTrace()
            callback(false)
        })
        compositeDisposable.add(disposable)
        return disposable
    }
    /**
     * 写卡
     *
     * @param userCard 用户卡内容
@@ -60,14 +160,57 @@
        return false
    }
    fun changePS( ps: List<ByteArray>, isConnect: Boolean, isClose: Boolean,nfcCallBack: NFCCallBack): Boolean {
    /**
     * 修改密码(异步)
     *
     * @param ps 密码列表
     * @param isConnect 是否保持连接
     * @param isClose 是否关闭
     * @param callback 结果回调
     */
    fun changePSAsync(ps: List<ByteArray>, isConnect: Boolean, isClose: Boolean, callback: (Boolean, String?) -> Unit): Disposable {
        showLoading()
        val disposable = Observable.fromCallable {
            var resultSuccess = false
            var resultMessage: String? = null
            changePS(ps, isConnect, isClose, object : NFCCallBack {
                override fun isSusses(flag: Boolean, msg: String?) {
                    resultSuccess = flag
                    resultMessage = msg
                }
            })
            Pair(resultSuccess, resultMessage)
        }
        .subscribeOn(Schedulers.io())
        .observeOn(AndroidSchedulers.mainThread())
        .subscribe({ result ->
            hideLoading()
            callback(result.first, result.second)
        }, { error ->
            hideLoading()
            error.printStackTrace()
            callback(false, error.message)
        })
        compositeDisposable.add(disposable)
        return disposable
    }
    fun changePS(ps: List<ByteArray>, isConnect: Boolean, isClose: Boolean, nfcCallBack: NFCCallBack): Boolean {
        try {
            return adapter.changePasword( ps, isConnect, isClose,nfcCallBack)
            return adapter.changePasword(ps, isConnect, isClose, nfcCallBack)
        } catch (e: java.lang.Exception) {
            e.printStackTrace()
        }
        return false
    }
    /**
     * 清除所有订阅,防止内存泄漏
     */
    fun clearDisposables() {
        compositeDisposable.clear()
    }
}
generallibrary/src/main/res/layout/activity_new_card_1_ge.xml
File was deleted
generallibrary/src/main/res/layout/activity_new_card_ge.xml
@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#F5F7FA">
    android:background="@color/base_list_bg">
    <com.dayu.baselibrary.view.TitleBar
        android:id="@+id/titleBar"
@@ -11,31 +12,136 @@
        android:layout_height="@dimen/dimen_title_height"
        android:background="@color/title_bar_bg"
        android:elevation="4dp"
        app:centerText="新卡开户"
        app:leftImage="@mipmap/icon_back" />
        app:centerText="用户开卡"
        app:leftImage="@mipmap/icon_back"
        tools:ignore="MissingConstraints" />
    <androidx.cardview.widget.CardView
        android:id="@+id/nfcContainer"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_marginStart="16dp"
        android:layout_marginTop="24dp"
        android:layout_marginEnd="16dp"
        android:layout_marginBottom="24dp"
        android:visibility="visible"
        app:cardBackgroundColor="@android:color/white"
        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/titleBar">
        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:gravity="center"
                android:orientation="vertical"
                android:padding="16dp">
                <TextView
                    android:id="@+id/textView"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:gravity="center"
                    android:text="请将新卡贴在设备上进行读卡"
                    android:textColor="#333333"
                    android:textSize="18sp"
                    android:textStyle="bold" />
                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:gravity="center"
                    android:text="将进行初始化卡片\n耗时较长请不要移动卡片"
                    android:textColor="@color/base_blue_bg"
                    android:textSize="18sp"
                    android:layout_marginTop="20dp"
                    android:textStyle="bold" />
                <ImageView
                    android:id="@+id/nfcImageView"
                    android:layout_width="200dp"
                    android:layout_height="200dp"
                    android:layout_marginTop="24dp"
                    android:scaleType="fitCenter"
                    android:src="@mipmap/nfc_write" />
                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="16dp"
                    android:gravity="center"
                    android:text="请保持手持机和卡片不要移动"
                    android:textColor="#666666"
                    android:textSize="14sp" />
            </LinearLayout>
            <RelativeLayout
                android:id="@+id/loadingContainer"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="#80000000"
                android:visibility="gone">
                <com.pnikosis.materialishprogress.ProgressWheel
                    android:id="@+id/nfcProgressWheel"
                    android:layout_width="100dp"
                    android:layout_height="100dp"
                    android:layout_centerInParent="true"
                    app:matProg_barColor="@color/base_blue_bg"
                    app:matProg_progressIndeterminate="true"
                    app:matProg_barWidth="8dp"
                    app:matProg_rimColor="#33000000"
                    app:matProg_rimWidth="8dp"
                    app:matProg_spinSpeed="0.5"/>
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_below="@id/nfcProgressWheel"
                    android:layout_centerHorizontal="true"
                    android:layout_marginTop="12dp"
                    android:text="正在处理NFC卡片..."
                    android:textColor="#FFFFFF"
                    android:textSize="16sp"/>
            </RelativeLayout>
        </FrameLayout>
    </androidx.cardview.widget.CardView>
    <ScrollView
        android:id="@+id/center_scroll"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@+id/newCard_registBtn"
        android:layout_below="@+id/titleBar"
        android:layout_height="0dp"
        android:fillViewport="true"
        android:scrollbars="none">
        android:scrollbars="none"
        android:visibility="gone"
        app:layout_constraintBottom_toTopOf="@+id/newCard_registBtn"
        app:layout_constraintTop_toBottomOf="@+id/titleBar">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:padding="16dp">
            android:paddingBottom="16dp"
            android:paddingLeft="16dp"
            android:paddingRight="16dp"
            android:paddingTop="10dp">
            <androidx.cardview.widget.CardView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="16dp"
                android:layout_marginBottom="10dp"
                app:cardCornerRadius="8dp"
                app:cardElevation="2dp">
                <LinearLayout
                    android:id="@+id/center_data"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
@@ -44,7 +150,7 @@
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginBottom="16dp"
                        android:layout_marginBottom="10dp"
                        android:text="基本信息"
                        android:textColor="#333333"
                        android:textSize="18sp"
@@ -53,14 +159,14 @@
                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginBottom="16dp"
                        android:layout_marginBottom="6dp"
                        android:gravity="center_vertical"
                        android:orientation="horizontal">
                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_width="105dp"
                            android:layout_height="wrap_content"
                            android:text="@string/eq_no"
                            android:text="卡号:"
                            android:textColor="#666666"
                            android:textSize="@dimen/new_card_size" />
@@ -69,7 +175,6 @@
                            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>
@@ -77,94 +182,78 @@
                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginBottom="16dp"
                        android:layout_marginBottom="6dp"
                        android:gravity="center_vertical"
                        android:orientation="horizontal">
                        <TextView
                            android:layout_width="80dp"
                            android:layout_width="105dp"
                            android:layout_height="wrap_content"
                            android:text="姓名"
                            android:text="姓名:"
                            android:textColor="#666666"
                            android:textSize="@dimen/new_card_size" />
                        <LinearLayout
                            android:layout_width="0dp"
                        <TextView
                            android:id="@+id/newCard_userName"
                            android:layout_width="match_parent"
                            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:layout_marginStart="8dp"
                            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:layout_marginBottom="6dp"
                        android:gravity="center_vertical"
                        android:orientation="horizontal">
                        <TextView
                            android:layout_width="80dp"
                            android:layout_width="105dp"
                            android:layout_height="wrap_content"
                            android:text="身份证号"
                            android:text="身份证号:"
                            android:textColor="#666666"
                            android:textSize="@dimen/new_card_size" />
                        <LinearLayout
                        <TextView
                            android:id="@+id/newCard_idCard"
                            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>
                            android:layout_marginStart="8dp"
                            android:textColor="#333333"
                            android:textSize="@dimen/new_card_size" />
                    </LinearLayout>
                    <TextView
                        android:id="@+id/newCard_idTip"
                        android:layout_width="wrap_content"
                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginBottom="16dp"
                        android:text="扫描后请核对身份信息无误"
                        android:textColor="#FF4500"
                        android:visibility="gone" />
                        android:layout_marginBottom="5dp"
                        android:gravity="center_vertical"
                        android:orientation="horizontal">
                        <TextView
                            android:layout_width="105dp"
                            android:layout_height="wrap_content"
                            android:text="农户编号:"
                            android:textColor="#666666"
                            android:textSize="@dimen/new_card_size" />
                        <TextView
                            android:id="@+id/newCard_farmerCode"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_marginStart="8dp"
                            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"
                android:layout_marginBottom="10dp"
                app:cardCornerRadius="8dp"
                app:cardElevation="2dp">
@@ -177,135 +266,187 @@
                    <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:layout_marginBottom="10dp"
                        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="12dp"
                        android:gravity="center_vertical"
                        android:orientation="horizontal">
                        <TextView
                            android:layout_width="80dp"
                            android:layout_width="105dp"
                            android:layout_height="wrap_content"
                            android:text="工本费(元)"
                            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">
                            android:background="@drawable/edit_text_bg_selector"
                            android:orientation="horizontal"
                            android:gravity="center_vertical"
                            android:paddingStart="10dp"
                            android:paddingEnd="10dp"
                            android:paddingTop="8dp"
                            android:paddingBottom="8dp">
                            <EditText
                                android:id="@+id/newCard_morny"
                                android:id="@+id/newCard_cardFee"
                                android:layout_width="0dp"
                                android:layout_weight="1"
                                android:layout_height="wrap_content"
                                android:background="@null"
                                android:hint="请输入工本费(选填)"
                                android:inputType="numberDecimal"
                                android:textColor="#333333"
                                android:textColorHint="#BBBBBB"
                                android:textSize="@dimen/new_card_size" />
                            <TextView
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="元"
                                android:textColor="#666666"
                                android:textSize="@dimen/new_card_size" />
                        </LinearLayout>
                    </LinearLayout>
                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginBottom="12dp"
                        android:gravity="center_vertical"
                        android:orientation="horizontal">
                        <TextView
                            android:layout_width="105dp"
                            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="@drawable/edit_text_bg_selector"
                            android:orientation="horizontal"
                            android:gravity="center_vertical"
                            android:paddingStart="10dp"
                            android:paddingEnd="10dp"
                            android:paddingTop="8dp"
                            android:paddingBottom="8dp">
                            <EditText
                                android:id="@+id/newCard_rechargeAmount"
                                android:layout_width="0dp"
                                android:layout_weight="1"
                                android:layout_height="wrap_content"
                                android:background="@null"
                                android:hint="请输入充值金额(选填)"
                                android:inputType="numberDecimal"
                                android:textColor="#333333"
                                android:textColorHint="#BBBBBB"
                                android:textSize="@dimen/new_card_size" />
                            <TextView
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="元"
                                android:textColor="#666666"
                                android:textSize="@dimen/new_card_size" />
                        </LinearLayout>
                    </LinearLayout>
                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginBottom="5dp"
                        android:gravity="center_vertical"
                        android:orientation="horizontal">
                        <TextView
                            android:layout_width="105dp"
                            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="@drawable/edit_text_bg_selector"
                            android:orientation="vertical"
                            android:paddingStart="10dp"
                            android:paddingEnd="10dp"
                            android:paddingTop="8dp"
                            android:paddingBottom="8dp">
                            <EditText
                                android:id="@+id/newCard_remark"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:background="@null"
                                android:hint="请输入工本费"
                                android:inputType="numberDecimal"
                                android:padding="12dp"
                                android:hint="请输入备注(选填)"
                                android:textColor="#333333"
                                android:textColorHint="#BBBBBB"
                                android:textSize="@dimen/new_card_size" />
                        </LinearLayout>
                    </LinearLayout>
                </LinearLayout>
            </androidx.cardview.widget.CardView>
            <!-- 隐藏的水权内水量部分 -->
            <LinearLayout
            <androidx.cardview.widget.CardView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:visibility="gone">
                app:cardCornerRadius="8dp"
                app:cardElevation="2dp">
                <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"
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:inputType="number"
                    android:maxLength="5"
                    android:textSize="@dimen/new_card_size" />
            </LinearLayout>
                    android:orientation="vertical"
                    android:padding="16dp">
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginBottom="10dp"
                        android:text="支付方式"
                        android:textColor="#333333"
                        android:textSize="18sp"
                        android:textStyle="bold" />
                    <RadioGroup
                        android:id="@+id/newCard_paymentMethod"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:orientation="horizontal">
                        <!-- 动态添加RadioButton,移除固定的RadioButton -->
                    </RadioGroup>
                </LinearLayout>
            </androidx.cardview.widget.CardView>
        </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:background="@color/bottom_color"
        android:gravity="center"
        android:text="确认开户"
        android:text="确认开卡"
        android:textColor="#FFFFFF"
        android:textSize="16sp" />
</RelativeLayout>
        android:textSize="16sp"
        android:visibility="gone"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
pickerviewlibrary/src/main/java/com/wang/avi/indicators/BallBeatIndicator.java
@@ -1,9 +1,9 @@
package com.wang.avi.indicators;
import android.animation.ValueAnimator;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.animation.ValueAnimator;
import com.wang.avi.Indicator;
import java.util.ArrayList;
pickerviewlibrary/src/main/java/com/wang/avi/indicators/BallClipRotateIndicator.java
@@ -1,10 +1,10 @@
package com.wang.avi.indicators;
import android.animation.ValueAnimator;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;
import android.animation.ValueAnimator;
import com.wang.avi.Indicator;
import java.util.ArrayList;
pickerviewlibrary/src/main/java/com/wang/avi/indicators/BallClipRotateMultipleIndicator.java
@@ -1,10 +1,10 @@
package com.wang.avi.indicators;
import android.animation.ValueAnimator;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;
import android.animation.ValueAnimator;
import com.wang.avi.Indicator;
import java.util.ArrayList;
pickerviewlibrary/src/main/java/com/wang/avi/indicators/BallClipRotatePulseIndicator.java
@@ -1,10 +1,10 @@
package com.wang.avi.indicators;
import android.animation.ValueAnimator;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;
import android.animation.ValueAnimator;
import com.wang.avi.Indicator;
import java.util.ArrayList;
pickerviewlibrary/src/main/java/com/wang/avi/indicators/BallGridBeatIndicator.java
@@ -1,9 +1,9 @@
package com.wang.avi.indicators;
import android.animation.ValueAnimator;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.animation.ValueAnimator;
import com.wang.avi.Indicator;
import java.util.ArrayList;
pickerviewlibrary/src/main/java/com/wang/avi/indicators/BallGridPulseIndicator.java
@@ -1,9 +1,9 @@
package com.wang.avi.indicators;
import android.animation.ValueAnimator;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.animation.ValueAnimator;
import com.wang.avi.Indicator;
import java.util.ArrayList;
pickerviewlibrary/src/main/java/com/wang/avi/indicators/BallPulseIndicator.java
@@ -1,9 +1,9 @@
package com.wang.avi.indicators;
import android.animation.ValueAnimator;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.animation.ValueAnimator;
import com.wang.avi.Indicator;
import java.util.ArrayList;
pickerviewlibrary/src/main/java/com/wang/avi/indicators/BallPulseSyncIndicator.java
@@ -1,9 +1,9 @@
package com.wang.avi.indicators;
import android.animation.ValueAnimator;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.animation.ValueAnimator;
import com.wang.avi.Indicator;
import java.util.ArrayList;
pickerviewlibrary/src/main/java/com/wang/avi/indicators/BallScaleIndicator.java
@@ -1,10 +1,10 @@
package com.wang.avi.indicators;
import android.animation.ValueAnimator;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.view.animation.LinearInterpolator;
import android.animation.ValueAnimator;
import com.wang.avi.Indicator;
import java.util.ArrayList;
pickerviewlibrary/src/main/java/com/wang/avi/indicators/BallScaleMultipleIndicator.java
@@ -1,10 +1,10 @@
package com.wang.avi.indicators;
import android.animation.ValueAnimator;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.view.animation.LinearInterpolator;
import android.animation.ValueAnimator;
import com.wang.avi.Indicator;
import java.util.ArrayList;
pickerviewlibrary/src/main/java/com/wang/avi/indicators/BallScaleRippleIndicator.java
@@ -1,10 +1,9 @@
package com.wang.avi.indicators;
import android.animation.ValueAnimator;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.view.animation.LinearInterpolator;
import android.animation.ValueAnimator;
import java.util.ArrayList;
pickerviewlibrary/src/main/java/com/wang/avi/indicators/BallScaleRippleMultipleIndicator.java
@@ -1,10 +1,9 @@
package com.wang.avi.indicators;
import android.animation.ValueAnimator;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.view.animation.LinearInterpolator;
import android.animation.ValueAnimator;
import java.util.ArrayList;
pickerviewlibrary/src/main/java/com/wang/avi/indicators/BallSpinFadeLoaderIndicator.java
@@ -1,9 +1,9 @@
package com.wang.avi.indicators;
import android.animation.ValueAnimator;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.animation.ValueAnimator;
import com.wang.avi.Indicator;
import java.util.ArrayList;
pickerviewlibrary/src/main/java/com/wang/avi/indicators/BallTrianglePathIndicator.java
@@ -1,10 +1,10 @@
package com.wang.avi.indicators;
import android.animation.ValueAnimator;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.view.animation.LinearInterpolator;
import android.animation.ValueAnimator;
import com.wang.avi.Indicator;
import java.util.ArrayList;
pickerviewlibrary/src/main/java/com/wang/avi/indicators/BallZigZagDeflectIndicator.java
@@ -1,8 +1,9 @@
package com.wang.avi.indicators;
import android.view.animation.LinearInterpolator;
import android.animation.ValueAnimator;
import android.view.animation.LinearInterpolator;
import java.util.ArrayList;
/**
pickerviewlibrary/src/main/java/com/wang/avi/indicators/BallZigZagIndicator.java
@@ -1,10 +1,10 @@
package com.wang.avi.indicators;
import android.animation.ValueAnimator;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.view.animation.LinearInterpolator;
import android.animation.ValueAnimator;
import com.wang.avi.Indicator;
import java.util.ArrayList;
pickerviewlibrary/src/main/java/com/wang/avi/indicators/CubeTransitionIndicator.java
@@ -1,11 +1,11 @@
package com.wang.avi.indicators;
import android.animation.ValueAnimator;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;
import android.view.animation.LinearInterpolator;
import android.animation.ValueAnimator;
import com.wang.avi.Indicator;
import java.util.ArrayList;
pickerviewlibrary/src/main/java/com/wang/avi/indicators/LineScaleIndicator.java
@@ -1,10 +1,10 @@
package com.wang.avi.indicators;
import android.animation.ValueAnimator;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;
import android.animation.ValueAnimator;
import com.wang.avi.Indicator;
import java.util.ArrayList;
pickerviewlibrary/src/main/java/com/wang/avi/indicators/LineScalePartyIndicator.java
@@ -1,10 +1,10 @@
package com.wang.avi.indicators;
import android.animation.ValueAnimator;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;
import android.animation.ValueAnimator;
import com.wang.avi.Indicator;
import java.util.ArrayList;
pickerviewlibrary/src/main/java/com/wang/avi/indicators/PacmanIndicator.java
@@ -1,11 +1,11 @@
package com.wang.avi.indicators;
import android.animation.ValueAnimator;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;
import android.view.animation.LinearInterpolator;
import android.animation.ValueAnimator;
import com.wang.avi.Indicator;
import java.util.ArrayList;