|
|
@@ -1,19 +1,29 @@
|
|
|
package com.yingyang.workbenches.dialog
|
|
|
|
|
|
import android.annotation.SuppressLint
|
|
|
+import android.graphics.Bitmap
|
|
|
+import android.os.Binder
|
|
|
import android.os.Bundle
|
|
|
import android.view.LayoutInflater
|
|
|
import android.view.View
|
|
|
import android.view.ViewGroup
|
|
|
+import android.widget.Button
|
|
|
+import android.widget.ImageView
|
|
|
+import android.widget.TextView
|
|
|
import androidx.appcompat.widget.AppCompatImageView
|
|
|
import androidx.appcompat.widget.AppCompatTextView
|
|
|
import androidx.constraintlayout.widget.ConstraintLayout
|
|
|
import androidx.fragment.app.DialogFragment
|
|
|
+import com.bumptech.glide.Glide
|
|
|
import com.yingyang.workbenches.R
|
|
|
import com.yingyang.workbenches.entity.GetPayImageEvent
|
|
|
import com.yingyangfly.baselib.ext.setOnSingleClickListener
|
|
|
+import com.yingyangfly.baselib.ext.show
|
|
|
+import com.yingyangfly.baselib.utils.RxBusCodes
|
|
|
import com.yingyangfly.baselib.utils.ViewTool
|
|
|
import gorden.rxbus2.RxBus
|
|
|
+import gorden.rxbus2.Subscribe
|
|
|
+import gorden.rxbus2.ThreadMode
|
|
|
|
|
|
/**
|
|
|
* 购买服务弹窗l
|
|
|
@@ -24,6 +34,13 @@ class PurchaseServicesDialog : DialogFragment() {
|
|
|
private var payMoney = ""
|
|
|
private var packageName = ""
|
|
|
|
|
|
+ private var tvPackageMoney: TextView? = null
|
|
|
+ private var tvPay: TextView? = null
|
|
|
+ private var weChatLayout: ConstraintLayout? = null
|
|
|
+ private var alipayLayout: ConstraintLayout? = null
|
|
|
+ private var payImage: AppCompatImageView? = null
|
|
|
+ private var paySuccessBtn: Button? = null
|
|
|
+
|
|
|
fun setPackageBean(packageId: String, payMoney: String, packageName: String) {
|
|
|
this.packageId = packageId
|
|
|
this.payMoney = payMoney
|
|
|
@@ -33,7 +50,7 @@ class PurchaseServicesDialog : DialogFragment() {
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
super.onCreate(savedInstanceState)
|
|
|
RxBus.get().register(this)
|
|
|
- isCancelable = true
|
|
|
+ isCancelable = false
|
|
|
dialog?.setCanceledOnTouchOutside(true)
|
|
|
}
|
|
|
|
|
|
@@ -61,15 +78,20 @@ class PurchaseServicesDialog : DialogFragment() {
|
|
|
|
|
|
@SuppressLint("SetTextI18n")
|
|
|
private fun findId(rootView: View) {
|
|
|
- val tvPackageMoney = rootView.findViewById<AppCompatTextView>(R.id.tvPackageMoney)
|
|
|
- tvPackageMoney.text = "您购买的是" + payMoney + "元" + packageName
|
|
|
- val weChatLayout = rootView.findViewById<ConstraintLayout>(R.id.weChatLayout)
|
|
|
+ tvPackageMoney = rootView.findViewById(R.id.tvPackageMoney)
|
|
|
+ tvPay = rootView.findViewById(R.id.tvPay)
|
|
|
+ weChatLayout = rootView.findViewById(R.id.weChatLayout)
|
|
|
+ alipayLayout = rootView.findViewById(R.id.alipayLayout)
|
|
|
+ payImage = rootView.findViewById(R.id.payImage)
|
|
|
+ paySuccessBtn = rootView.findViewById(R.id.paySuccessBtn)
|
|
|
+ payImage?.show(false)
|
|
|
+ paySuccessBtn?.show(false)
|
|
|
+ tvPackageMoney?.text = "您购买的是" + payMoney + "元" + packageName
|
|
|
weChatLayout?.setOnSingleClickListener {
|
|
|
- RxBus.get().send(GetPayImageEvent(packageId, "1", payMoney))
|
|
|
+ RxBus.get().send(GetPayImageEvent(packageId, "1", payMoney, packageName))
|
|
|
}
|
|
|
- val alipayLayout = rootView.findViewById<ConstraintLayout>(R.id.alipayLayout)
|
|
|
alipayLayout?.setOnSingleClickListener {
|
|
|
- RxBus.get().send(GetPayImageEvent(packageId, "2", payMoney))
|
|
|
+ RxBus.get().send(GetPayImageEvent(packageId, "2", payMoney, packageName))
|
|
|
}
|
|
|
val imageClose = rootView.findViewById<AppCompatImageView>(R.id.imageClose)
|
|
|
imageClose.setOnSingleClickListener {
|
|
|
@@ -86,4 +108,17 @@ class PurchaseServicesDialog : DialogFragment() {
|
|
|
RxBus.get().unRegister(this)
|
|
|
}
|
|
|
|
|
|
+ @Subscribe(code = RxBusCodes.ORDERPAY, threadMode = ThreadMode.MAIN)
|
|
|
+ fun getPayImage(image: Bitmap) {
|
|
|
+ if (image != null) {
|
|
|
+ tvPackageMoney?.show(false)
|
|
|
+ tvPay?.show(false)
|
|
|
+ weChatLayout?.show(false)
|
|
|
+ alipayLayout?.show(false)
|
|
|
+ payImage?.show(false)
|
|
|
+ payImage?.show(true)
|
|
|
+ paySuccessBtn?.show(true)
|
|
|
+ Glide.with(this).load(image).into(payImage!!)
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|