parent
6d546ebb75
commit
fd0f5f0dba
|
|
@ -573,7 +573,42 @@ class MemberRechargeActivity : BaseActivity() {
|
|||
rvPay.layoutManager=LinearLayoutManager(this@MemberRechargeActivity)
|
||||
rcmAdapter.setCloudServiceList(groupBy,this@MemberRechargeActivity)
|
||||
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)
|
||||
.setOnClickListener {
|
||||
dismiss()
|
||||
|
|
|
|||
|
|
@ -4,6 +4,6 @@ data class RechargeModelEntity(
|
|||
val payModel: Int,//支付模式
|
||||
val payChannel: String,//支付渠道名称
|
||||
val payParam:String,//支付参数
|
||||
val payType:Int,//支付类型
|
||||
var payType:Int,//支付类型
|
||||
var payOrder:Int//支付编号
|
||||
)
|
||||
|
|
|
|||
|
|
@ -7,11 +7,9 @@ import android.view.View
|
|||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import androidx.appcompat.widget.AppCompatImageView
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.yingmao.clash.R
|
||||
import com.yingmao.clash.entity.RechargeModelEntity
|
||||
import com.yingmao.clash.net.http.entity.Grade
|
||||
|
||||
|
||||
class RechargeModelAdapter : RecyclerView.Adapter<RechargeModelAdapter.RMViewHolder>() {
|
||||
|
|
@ -19,8 +17,6 @@ class RechargeModelAdapter : RecyclerView.Adapter<RechargeModelAdapter.RMViewHol
|
|||
//设置回调监听
|
||||
private var listener: RechargeModelClickListener? = null
|
||||
private var context: Context? = null
|
||||
val rmiAdapter = RechargeModelItemAdapter()
|
||||
var rMList= mutableListOf<RechargeModelEntity>()
|
||||
|
||||
//设置监听器
|
||||
fun setListener(listener: RechargeModelClickListener?) {
|
||||
|
|
@ -31,14 +27,12 @@ class RechargeModelAdapter : RecyclerView.Adapter<RechargeModelAdapter.RMViewHol
|
|||
fun setCloudServiceList(rechargeInfo:Map<Int, List<RechargeModelEntity>>, context: Context) {
|
||||
this.payMap = rechargeInfo
|
||||
this.context = context
|
||||
android.util.Log.e("rcmAdapter", " payMap:"+payMap.size+"SSA"+payMap.values.size)
|
||||
}
|
||||
|
||||
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 wcIcon: AppCompatImageView = itemView.findViewById(R.id.ivQuickPayment)
|
||||
val aliIcon: AppCompatImageView = itemView.findViewById(R.id.ivQPWechatPay)
|
||||
val titleTv: TextView = itemView.findViewById(R.id.KJPay)
|
||||
val aliIcon: AppCompatImageView = itemView.findViewById(R.id.ivQuickPayment)
|
||||
val wcIcon: AppCompatImageView = itemView.findViewById(R.id.ivQPWechatPay)
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = RMViewHolder(
|
||||
|
|
@ -52,28 +46,29 @@ class RechargeModelAdapter : RecyclerView.Adapter<RechargeModelAdapter.RMViewHol
|
|||
|
||||
@SuppressLint("NotifyDataSetChanged", "SetTextI18n")
|
||||
override fun onBindViewHolder(holder: RMViewHolder, @SuppressLint("RecyclerView") position: Int) {
|
||||
for ((index,value) in payMap){
|
||||
android.util.Log.e("rcmAdapter", " value,context!!:"+value)
|
||||
// rmiAdapter.setData(value,context!!)
|
||||
holder.titleTv.text=value.get(index).payChannel
|
||||
rMList= value.toMutableList()
|
||||
}
|
||||
rMList.forEach {item->
|
||||
val mutableListOf =payMap.values.elementAt(position)
|
||||
mutableListOf.forEach {item->
|
||||
holder.titleTv.text= item.payChannel
|
||||
if(item.payType==1){
|
||||
holder.aliIcon.visibility=View.VISIBLE
|
||||
}
|
||||
if(item.payType==2){
|
||||
}else if (item.payType==2){
|
||||
holder.wcIcon.visibility=View.VISIBLE
|
||||
}
|
||||
}
|
||||
// holder.itemRv.layoutManager= LinearLayoutManager(context)
|
||||
// holder.itemRv.adapter=rmiAdapter
|
||||
holder.aliIcon.setOnClickListener {
|
||||
mutableListOf[position].payType=1
|
||||
listener?.onItemClick(mutableListOf[position])
|
||||
}
|
||||
holder.wcIcon.setOnClickListener {
|
||||
mutableListOf[position].payType=2
|
||||
listener?.onItemClick(mutableListOf[position])
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 内置监听回调
|
||||
* */
|
||||
interface RechargeModelClickListener {
|
||||
fun onItemClick(noteItem: Grade?)
|
||||
fun onItemClick(rcEntity: RechargeModelEntity)
|
||||
}
|
||||
}
|
||||
|
|
@ -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?)
|
||||
}
|
||||
}
|
||||
|
|
@ -93,10 +93,10 @@ class NetService private constructor() : INetService {
|
|||
// .sslSocketFactory(getSSLSocketFactory(), CustomTrustManager())//信任所有证书
|
||||
.sslSocketFactory(getSSLSocketFactory(), trustAllCerts[0] as X509TrustManager)
|
||||
.hostnameVerifier(getHostnameVerifier()!!)
|
||||
// if (BuildConfig.DEBUG) {
|
||||
// builder.addInterceptor(loggingInterceptor)
|
||||
// }
|
||||
builder.addInterceptor(loggingInterceptor)
|
||||
if (BuildConfig.DEBUG) {
|
||||
builder.addInterceptor(loggingInterceptor)
|
||||
}
|
||||
// builder.addInterceptor(loggingInterceptor)
|
||||
return builder.build()
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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">
|
||||
|
||||
<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 xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="32dp"
|
||||
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>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/white"
|
||||
android:background="@drawable/ic_index_bg"
|
||||
>
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/ivBack"
|
||||
|
|
@ -16,11 +16,12 @@
|
|||
app:srcCompat="@drawable/ic_s_gray_back"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:tint="@color/black"
|
||||
/>
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rvPay"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/ivBack"
|
||||
|
|
|
|||
Loading…
Reference in New Issue