ソースを参照

1.优化代码

王鹏鹏 1 年間 前
コミット
2de1fd0e3b

+ 5 - 2
healthconsultation/src/main/java/com/yingyang/healthconsultation/dialog/PaymentQrCodeDialog.kt

@@ -1,5 +1,6 @@
 package com.yingyang.healthconsultation.dialog
 
+import android.content.Context
 import android.os.Bundle
 import android.text.TextUtils
 import android.view.LayoutInflater
@@ -40,6 +41,7 @@ class PaymentQrCodeDialog : DialogFragment() {
     private var payImage: AppCompatImageView? = null
     private var paySuccessBtn: AppCompatButton? = null
     private var imageClose: AppCompatImageView? = null
+    private var content: Context? = null
     var onQueryPaymentStatusListener: ((orderNo: String) -> Unit)? = null
 
     fun setPaymentQrCodeBean(orderNo: String, qrCode: String, method: String) {
@@ -76,6 +78,7 @@ class PaymentQrCodeDialog : DialogFragment() {
         val rootView = ViewTool.inflateFragmentPixels(
             activity, R.layout.dialog_payment_qr_code, container, 1194, 834
         )
+        content = activity
         findId(rootView)
         init()
         successfulPurchase()
@@ -164,7 +167,7 @@ class PaymentQrCodeDialog : DialogFragment() {
         HealthConsultationsServiceFactory.getService()
             .delPayOrder(orderNo)
             .subscribeOn(Schedulers.io())
-            .compose(MyRxScheduler.ioMain(activity, true))
+            .compose(MyRxScheduler.ioMain(content, true))
             .subscribe(object : BaseObserver<String>() {
                 override fun onSuccess(t: String?) {
                     dismiss()
@@ -184,7 +187,7 @@ class PaymentQrCodeDialog : DialogFragment() {
         HealthConsultationsServiceFactory.getService()
             .getSelectPayResult(orderNo)
             .subscribeOn(Schedulers.io())
-            .compose(MyRxScheduler.ioMain(activity, true))
+            .compose(MyRxScheduler.ioMain(content, true))
             .subscribe(object : BaseObserver<String>() {
                 override fun onSuccess(t: String?) {
                     if (t.isNullOrEmpty().not()) {