From 80eb39909e0d5c181dc8d6e282a292146ec51e21 Mon Sep 17 00:00:00 2001
From: zuoxiao <lf_zuo@163.com>
Date: 星期三, 25 六月 2025 14:36:04 +0800
Subject: [PATCH] refactor(card): 重构卡片制作流程并添加项目号支持

---
 generallibrary/src/main/java/com/dayu/general/activity/CardReplaceActivity.kt |   94 -----------------------------------------------
 1 files changed, 0 insertions(+), 94 deletions(-)

diff --git a/generallibrary/src/main/java/com/dayu/general/activity/CardReplaceActivity.kt b/generallibrary/src/main/java/com/dayu/general/activity/CardReplaceActivity.kt
index e20cec0..a2a3283 100644
--- a/generallibrary/src/main/java/com/dayu/general/activity/CardReplaceActivity.kt
+++ b/generallibrary/src/main/java/com/dayu/general/activity/CardReplaceActivity.kt
@@ -66,8 +66,6 @@
         cardNum = intent.getStringExtra("cardNum")
 
         initView()
-        // 鑾峰彇鏀粯鏂瑰紡
-        getPaymentMethods()
 
         // 鏃犺鏄惁鏈塩lientNum锛岄兘鍏堟樉绀鸿鍗$晫闈紝绛夊緟鐢ㄦ埛鍒锋柊鍗�
         resetToReadingState()
@@ -85,100 +83,8 @@
         }
     }
 
-    /**
-     * 鑾峰彇鏀粯鏂瑰紡鍒楄〃
-     */
-    private fun getPaymentMethods() {
-        ApiManager.getInstance().requestGetLoading(
-            this,
-            "sell/paymentmethod/get",
-            PaymentMethodResponse::class.java,
-            null,
-            object : SubscriberListener<BaseResponse<PaymentMethodResponse>>() {
-                override fun onNext(response: BaseResponse<PaymentMethodResponse>) {
-                    if (response.success) {
-                        // 鑾峰彇鏀粯鏂瑰紡鍒楄〃
-                        val paymentMethods = response.content?.obj ?: listOf()
-                        if (paymentMethods.isNotEmpty()) {
-                            paymentMethodList = paymentMethods
-                            // 鏇存柊鏀粯鏂瑰紡鏄剧ず
-                            updatePaymentMethodRadioGroup()
-                        }
-                    } else {
-                        Toast.makeText(
-                            this@CardReplaceActivity,
-                            "鑾峰彇鏀粯鏂瑰紡澶辫触: ${response.msg}",
-                            Toast.LENGTH_SHORT
-                        ).show()
-                    }
-                }
 
-                override fun onError(e: Throwable?) {
-                    super.onError(e)
-                    Toast.makeText(
-                        this@CardReplaceActivity,
-                        "鑾峰彇鏀粯鏂瑰紡澶辫触: ${e?.message ?: "缃戠粶寮傚父"}",
-                        Toast.LENGTH_SHORT
-                    ).show()
-                }
-            }
-        )
-    }
 
-    /**
-     * 鏇存柊鏀粯鏂瑰紡RadioGroup
-     */
-    private fun updatePaymentMethodRadioGroup() {
-        // 娓呯┖鍘熸湁RadioButton
-        binding.paymentMethodGroup.removeAllViews()
-
-        // 鍔ㄦ�佹坊鍔燫adioButton
-        paymentMethodList.forEachIndexed { index, method ->
-            val radioButton = RadioButton(this)
-            radioButton.id = View.generateViewId() // 鐢熸垚鍞竴ID
-            radioButton.layoutParams = android.widget.LinearLayout.LayoutParams(
-                0,
-                resources.getDimensionPixelSize(R.dimen.dimen_40),
-                1.0f
-            )
-
-            // 濡傛灉涓嶆槸鏈�鍚庝竴涓寜閽紝娣诲姞鍙宠竟璺�
-            if (index < paymentMethodList.size - 1) {
-                (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)
-
-            // 娣诲姞鍒癛adioGroup
-            binding.paymentMethodGroup.addView(radioButton)
-
-            // 榛樿閫変腑绗竴涓�
-            if (index == 0) {
-                radioButton.isChecked = true
-                paymentMethod = method.name
-                paymentId = method.id
-            }
-        }
-
-        // 璁剧疆鏀粯鏂瑰紡閫夋嫨鐩戝惉
-        binding.paymentMethodGroup.setOnCheckedChangeListener { group, checkedId ->
-            // 鏍规嵁閫変腑鐨処D鑾峰彇鏀粯鏂瑰紡
-            for (i in 0 until group.childCount) {
-                val radioButton = group.getChildAt(i) as RadioButton
-                if (radioButton.id == checkedId) {
-                    paymentMethod = radioButton.text.toString()
-                    paymentId = paymentMethodList[i].id
-                    break
-                }
-            }
-        }
-    }
 
     /**
      * 閲嶇疆鍒拌鍗$姸鎬�

--
Gitblit v1.8.0