1.更改支付方式可添加

2.更改验证码输入提示
This commit is contained in:
level 2025-05-26 18:37:37 +08:00
parent 6d546ebb75
commit fd0f5f0dba
7 changed files with 71 additions and 104 deletions

View File

@ -573,7 +573,42 @@ class MemberRechargeActivity : BaseActivity() {
rvPay.layoutManager=LinearLayoutManager(this@MemberRechargeActivity) rvPay.layoutManager=LinearLayoutManager(this@MemberRechargeActivity)
rcmAdapter.setCloudServiceList(groupBy,this@MemberRechargeActivity) rcmAdapter.setCloudServiceList(groupBy,this@MemberRechargeActivity)
rvPay.adapter=rcmAdapter rvPay.adapter=rcmAdapter
android.util.Log.e("rcmAdapter", " groupBy"+groupBy) rcmAdapter.setListener(object :RechargeModelAdapter.RechargeModelClickListener{
override fun onItemClick(rcEntity: RechargeModelEntity) {
if(rcEntity.payModel==7&&rcEntity.payType==1){
if (selectedGradeID != 0) {
if (!PayUtils.isAlipayInstalled(this@MemberRechargeActivity)) {
RxToast.error(resources.getString(R.string.AlipayNotInstalled))
return
}
dismiss()
showLoading(
resources.getString(R.string.PaymentIn),
this@MemberRechargeActivity
)
Log.i("PayGradeID:${selectedGradeID}")
viewModel.getPayClientSecret(selectedGradeID)
} else {
dismiss()
RxToast.info(getString(R.string.NoPaymentReceipt))
}
}else if(rcEntity.payModel==7&&rcEntity.payType==2){
if (selectedGradeID != 0) {
viewModel.getWeChatPayClientSecret(selectedGradeID)
dismiss()
} else {
dismiss()
RxToast.info(getString(R.string.NoPaymentReceipt))
}
} else {
val payModel = rcEntity.payModel
val payType = rcEntity.payType
val payParam = rcEntity.payParam
viewModel.orderPayment(data, payModel, payType, payParam)
}
}
})
getCustomView().findViewById<AppCompatImageView>(R.id.ivBack) getCustomView().findViewById<AppCompatImageView>(R.id.ivBack)
.setOnClickListener { .setOnClickListener {
dismiss() dismiss()

View File

@ -4,6 +4,6 @@ data class RechargeModelEntity(
val payModel: Int,//支付模式 val payModel: Int,//支付模式
val payChannel: String,//支付渠道名称 val payChannel: String,//支付渠道名称
val payParam:String,//支付参数 val payParam:String,//支付参数
val payType:Int,//支付类型 var payType:Int,//支付类型
var payOrder:Int//支付编号 var payOrder:Int//支付编号
) )

View File

@ -7,11 +7,9 @@ import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.TextView import android.widget.TextView
import androidx.appcompat.widget.AppCompatImageView import androidx.appcompat.widget.AppCompatImageView
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.yingmao.clash.R import com.yingmao.clash.R
import com.yingmao.clash.entity.RechargeModelEntity import com.yingmao.clash.entity.RechargeModelEntity
import com.yingmao.clash.net.http.entity.Grade
class RechargeModelAdapter : RecyclerView.Adapter<RechargeModelAdapter.RMViewHolder>() { class RechargeModelAdapter : RecyclerView.Adapter<RechargeModelAdapter.RMViewHolder>() {
@ -19,8 +17,6 @@ class RechargeModelAdapter : RecyclerView.Adapter<RechargeModelAdapter.RMViewHol
//设置回调监听 //设置回调监听
private var listener: RechargeModelClickListener? = null private var listener: RechargeModelClickListener? = null
private var context: Context? = null private var context: Context? = null
val rmiAdapter = RechargeModelItemAdapter()
var rMList= mutableListOf<RechargeModelEntity>()
//设置监听器 //设置监听器
fun setListener(listener: RechargeModelClickListener?) { fun setListener(listener: RechargeModelClickListener?) {
@ -31,14 +27,12 @@ class RechargeModelAdapter : RecyclerView.Adapter<RechargeModelAdapter.RMViewHol
fun setCloudServiceList(rechargeInfo:Map<Int, List<RechargeModelEntity>>, context: Context) { fun setCloudServiceList(rechargeInfo:Map<Int, List<RechargeModelEntity>>, context: Context) {
this.payMap = rechargeInfo this.payMap = rechargeInfo
this.context = context this.context = context
android.util.Log.e("rcmAdapter", " payMap"+payMap.size+"SSA"+payMap.values.size)
} }
inner class RMViewHolder(view: View) : RecyclerView.ViewHolder(view) { inner class RMViewHolder(view: View) : RecyclerView.ViewHolder(view) {
// val itemRv: RecyclerView = itemView.findViewById(R.id.itemRv) val titleTv: TextView = itemView.findViewById(R.id.KJPay)
val titleTv: TextView = itemView.findViewById(R.id.KJPay) val aliIcon: AppCompatImageView = itemView.findViewById(R.id.ivQuickPayment)
val wcIcon: AppCompatImageView = itemView.findViewById(R.id.ivQuickPayment) val wcIcon: AppCompatImageView = itemView.findViewById(R.id.ivQPWechatPay)
val aliIcon: AppCompatImageView = itemView.findViewById(R.id.ivQPWechatPay)
} }
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = RMViewHolder( override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = RMViewHolder(
@ -52,28 +46,29 @@ class RechargeModelAdapter : RecyclerView.Adapter<RechargeModelAdapter.RMViewHol
@SuppressLint("NotifyDataSetChanged", "SetTextI18n") @SuppressLint("NotifyDataSetChanged", "SetTextI18n")
override fun onBindViewHolder(holder: RMViewHolder, @SuppressLint("RecyclerView") position: Int) { override fun onBindViewHolder(holder: RMViewHolder, @SuppressLint("RecyclerView") position: Int) {
for ((index,value) in payMap){ val mutableListOf =payMap.values.elementAt(position)
android.util.Log.e("rcmAdapter", " value,context!!"+value) mutableListOf.forEach {item->
// rmiAdapter.setData(value,context!!) holder.titleTv.text= item.payChannel
holder.titleTv.text=value.get(index).payChannel
rMList= value.toMutableList()
}
rMList.forEach {item->
if(item.payType==1){ if(item.payType==1){
holder.aliIcon.visibility=View.VISIBLE holder.aliIcon.visibility=View.VISIBLE
} }else if (item.payType==2){
if(item.payType==2){
holder.wcIcon.visibility=View.VISIBLE holder.wcIcon.visibility=View.VISIBLE
} }
} }
// holder.itemRv.layoutManager= LinearLayoutManager(context) holder.aliIcon.setOnClickListener {
// holder.itemRv.adapter=rmiAdapter mutableListOf[position].payType=1
listener?.onItemClick(mutableListOf[position])
}
holder.wcIcon.setOnClickListener {
mutableListOf[position].payType=2
listener?.onItemClick(mutableListOf[position])
}
} }
/* /*
* 内置监听回调 * 内置监听回调
* */ * */
interface RechargeModelClickListener { interface RechargeModelClickListener {
fun onItemClick(noteItem: Grade?) fun onItemClick(rcEntity: RechargeModelEntity)
} }
} }

View File

@ -1,71 +0,0 @@
package com.yingmao.clash.fragment.recharge.adapter
import android.annotation.SuppressLint
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.appcompat.widget.AppCompatImageView
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.recyclerview.widget.RecyclerView
import com.cncat.vpn.common.log.Log
import com.yingmao.clash.R
import com.yingmao.clash.entity.RechargeModelEntity
import com.yingmao.clash.net.http.entity.Grade
import com.yingmao.clash.net.http.entity.RechargeInfo
import java.lang.String
class RechargeModelItemAdapter : RecyclerView.Adapter<RechargeModelItemAdapter.RMIViewHolder>() {
private lateinit var rmList: List<RechargeModelEntity>
//设置回调监听
private var listener: RechargeModelClickListener? = null
private var context: Context? = null
//设置监听器
fun setListener(listener: RechargeModelClickListener?) {
this.listener = listener
}
//设置显示的数据
fun setData(rechargeInfo:List<RechargeModelEntity>, context: Context) {
this.rmList = rechargeInfo
this.context = context
}
inner class RMIViewHolder(view: View) : RecyclerView.ViewHolder(view) {
val titleTv: TextView = itemView.findViewById(R.id.KJPay)
val wcIcon: AppCompatImageView = itemView.findViewById(R.id.ivQuickPayment)
val aliIcon: AppCompatImageView = itemView.findViewById(R.id.ivQPWechatPay)
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = RMIViewHolder(
LayoutInflater.from(context)
.inflate(R.layout.pay_model_item_item_layout, parent, false)
)
override fun getItemCount(): Int {
return rmList.size
}
@SuppressLint("NotifyDataSetChanged", "SetTextI18n")
override fun onBindViewHolder(holder: RMIViewHolder, @SuppressLint("RecyclerView") position: Int) {
android.util.Log.e("rcmAdapter", " RechargeModelItemAdapter"+rmList)
holder.titleTv.text= rmList[position].payChannel
rmList.forEach {item->
if(item.payType==1){
holder.aliIcon.visibility=View.VISIBLE
}
if(item.payType==2){
holder.wcIcon.visibility=View.VISIBLE
}
}
}
/*
* 内置监听回调
* */
interface RechargeModelClickListener {
fun onItemClick(noteItem: Grade?)
}
}

View File

@ -93,10 +93,10 @@ class NetService private constructor() : INetService {
// .sslSocketFactory(getSSLSocketFactory(), CustomTrustManager())//信任所有证书 // .sslSocketFactory(getSSLSocketFactory(), CustomTrustManager())//信任所有证书
.sslSocketFactory(getSSLSocketFactory(), trustAllCerts[0] as X509TrustManager) .sslSocketFactory(getSSLSocketFactory(), trustAllCerts[0] as X509TrustManager)
.hostnameVerifier(getHostnameVerifier()!!) .hostnameVerifier(getHostnameVerifier()!!)
// if (BuildConfig.DEBUG) { if (BuildConfig.DEBUG) {
// builder.addInterceptor(loggingInterceptor) builder.addInterceptor(loggingInterceptor)
// } }
builder.addInterceptor(loggingInterceptor) // builder.addInterceptor(loggingInterceptor)
return builder.build() return builder.build()
} }

View File

@ -1,5 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="35dp" android:tint="#666565" android:viewportHeight="24" android:viewportWidth="24" android:width="35dp"> <vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="32dp"
<path android:fillColor="@android:color/white" android:pathData="M17.77,3.77l-1.77,-1.77l-10,10l10,10l1.77,-1.77l-8.23,-8.23z"/> android:height="32dp"
android:tint="#666565"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M17.77,3.77l-1.77,-1.77l-10,10l10,10l1.77,-1.77l-8.23,-8.23z" />
</vector> </vector>

View File

@ -5,7 +5,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
android:background="@color/white" android:background="@drawable/ic_index_bg"
> >
<androidx.appcompat.widget.AppCompatImageView <androidx.appcompat.widget.AppCompatImageView
android:id="@+id/ivBack" android:id="@+id/ivBack"
@ -16,11 +16,12 @@
app:srcCompat="@drawable/ic_s_gray_back" app:srcCompat="@drawable/ic_s_gray_back"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
android:tint="@color/black"
/> />
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvPay" android:id="@+id/rvPay"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ivBack" app:layout_constraintTop_toBottomOf="@+id/ivBack"