修改引导页对公转账跳转逻辑
This commit is contained in:
parent
6780974632
commit
d5601ac408
|
|
@ -26,6 +26,7 @@ import com.cheng.blzb.bean.VipGoodsEntity
|
||||||
import com.cheng.blzb.common.Constants
|
import com.cheng.blzb.common.Constants
|
||||||
import com.cheng.blzb.common.EventConstants
|
import com.cheng.blzb.common.EventConstants
|
||||||
import com.cheng.blzb.databinding.FragmentGuideVipBinding
|
import com.cheng.blzb.databinding.FragmentGuideVipBinding
|
||||||
|
import com.cheng.blzb.event.OrderEvent
|
||||||
import com.cheng.blzb.event.PayStatusEnum
|
import com.cheng.blzb.event.PayStatusEnum
|
||||||
import com.cheng.blzb.event.PayStatusEvent
|
import com.cheng.blzb.event.PayStatusEvent
|
||||||
import com.cheng.blzb.event.PaySuccessEvent
|
import com.cheng.blzb.event.PaySuccessEvent
|
||||||
|
|
@ -291,7 +292,7 @@ class GuideVipFragment: BaseFragment<FragmentGuideVipBinding, GuideVipViewModel>
|
||||||
} else if (payType == 1) {
|
} else if (payType == 1) {
|
||||||
PayUtils.toAliPay(requireActivity(), it.payParam, "")
|
PayUtils.toAliPay(requireActivity(), it.payParam, "")
|
||||||
} else {
|
} else {
|
||||||
PublicActivity.start(requireContext(), CertificateFragment::class.java, Pair("orderId", orderEntity!!.orderId))
|
PublicActivity.start(requireContext(), CertificateFragment::class.java, Pair("from", 1), Pair("orderId", orderEntity!!.orderId))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -338,6 +339,11 @@ class GuideVipFragment: BaseFragment<FragmentGuideVipBinding, GuideVipViewModel>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
addDisposable(payStatusDisposable)
|
addDisposable(payStatusDisposable)
|
||||||
|
|
||||||
|
val orderEvent = RxBus.defaultInstance.toObservable(OrderEvent::class.java).subscribe {
|
||||||
|
requireActivity().finish()
|
||||||
|
}
|
||||||
|
addDisposable(orderEvent)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showQueryTipDialog() {
|
private fun showQueryTipDialog() {
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,25 @@
|
||||||
package com.cheng.blzb.ui.fragment.mine.order
|
package com.cheng.blzb.ui.fragment.mine.order
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
import android.graphics.Typeface
|
import android.graphics.Typeface
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
|
import android.window.OnBackInvokedDispatcher
|
||||||
|
import androidx.activity.addCallback
|
||||||
|
import androidx.core.os.BuildCompat
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.fragment.app.FragmentStatePagerAdapter
|
import androidx.fragment.app.FragmentStatePagerAdapter
|
||||||
import com.angcyo.tablayout.delegate.ViewPager1Delegate
|
import com.angcyo.tablayout.delegate.ViewPager1Delegate
|
||||||
import com.cheng.blzb.R
|
import com.cheng.blzb.R
|
||||||
import com.cheng.blzb.common.Constants
|
import com.cheng.blzb.common.Constants
|
||||||
import com.cheng.blzb.databinding.FragmentOrderBinding
|
import com.cheng.blzb.databinding.FragmentOrderBinding
|
||||||
|
import com.cheng.blzb.ui.activity.MainActivity
|
||||||
import com.cheng.blzb.ui.base.BasePageAdapter
|
import com.cheng.blzb.ui.base.BasePageAdapter
|
||||||
import com.cheng.blzb.ui.fragment.mine.order.list.OrderListFragment
|
import com.cheng.blzb.ui.fragment.mine.order.list.OrderListFragment
|
||||||
import com.example.base.ui.BaseFragment
|
import com.example.base.ui.BaseFragment
|
||||||
|
import org.jetbrains.anko.startActivity
|
||||||
|
|
||||||
class OrderFragment: BaseFragment<FragmentOrderBinding, OrderViewModel>() {
|
class OrderFragment: BaseFragment<FragmentOrderBinding, OrderViewModel>() {
|
||||||
|
private val from by lazy { arguments?.getInt("from") ?: 0 }
|
||||||
private val tabText = listOf("全部", "待支付", "已支付")
|
private val tabText = listOf("全部", "待支付", "已支付")
|
||||||
private val fragmentList by lazy { mutableListOf<Fragment>() }
|
private val fragmentList by lazy { mutableListOf<Fragment>() }
|
||||||
private val pageAdapter by lazy {
|
private val pageAdapter by lazy {
|
||||||
|
|
@ -42,6 +49,13 @@ class OrderFragment: BaseFragment<FragmentOrderBinding, OrderViewModel>() {
|
||||||
|
|
||||||
override fun initListener() {
|
override fun initListener() {
|
||||||
super.initListener()
|
super.initListener()
|
||||||
|
if (from == 1) {
|
||||||
|
setBackPressed()
|
||||||
|
mTitleBar?.setNavigationOnClickListener {
|
||||||
|
requireActivity().startActivity<MainActivity>()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
binding.tabLayout.observeIndexChange { fromIndex, toIndex, _, _ ->
|
binding.tabLayout.observeIndexChange { fromIndex, toIndex, _, _ ->
|
||||||
binding.viewPager.currentItem = toIndex
|
binding.viewPager.currentItem = toIndex
|
||||||
if (fromIndex != -1) {
|
if (fromIndex != -1) {
|
||||||
|
|
@ -52,4 +66,17 @@ class OrderFragment: BaseFragment<FragmentOrderBinding, OrderViewModel>() {
|
||||||
(binding.tabLayout.getChildAt(toIndex) as TextView).setBackgroundResource(R.drawable.shape_push_bid_type_checked)
|
(binding.tabLayout.getChildAt(toIndex) as TextView).setBackgroundResource(R.drawable.shape_push_bid_type_checked)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("UnsafeOptInUsageError")
|
||||||
|
private fun setBackPressed() {
|
||||||
|
if (BuildCompat.isAtLeastT()) {
|
||||||
|
requireActivity().onBackInvokedDispatcher.registerOnBackInvokedCallback(OnBackInvokedDispatcher.PRIORITY_DEFAULT) {
|
||||||
|
requireActivity().startActivity<MainActivity>()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
requireActivity().onBackPressedDispatcher.addCallback(this) {
|
||||||
|
requireActivity().startActivity<MainActivity>()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -8,13 +8,16 @@ import coil.transform.RoundedCornersTransformation
|
||||||
import com.cheng.blzb.bean.OrderEntity
|
import com.cheng.blzb.bean.OrderEntity
|
||||||
import com.cheng.blzb.databinding.FragmentCertificateBinding
|
import com.cheng.blzb.databinding.FragmentCertificateBinding
|
||||||
import com.cheng.blzb.event.OrderEvent
|
import com.cheng.blzb.event.OrderEvent
|
||||||
|
import com.cheng.blzb.ui.activity.MainActivity
|
||||||
import com.cheng.blzb.ui.activity.PublicActivity
|
import com.cheng.blzb.ui.activity.PublicActivity
|
||||||
|
import com.cheng.blzb.ui.fragment.mine.order.OrderFragment
|
||||||
import com.cheng.blzb.ui.fragment.photo.PhotoViewFragment
|
import com.cheng.blzb.ui.fragment.photo.PhotoViewFragment
|
||||||
import com.cheng.blzb.utils.FileProviderUtils
|
import com.cheng.blzb.utils.FileProviderUtils
|
||||||
import com.cheng.blzb.utils.PermissionUtils
|
import com.cheng.blzb.utils.PermissionUtils
|
||||||
import com.example.base.common.RxBus
|
import com.example.base.common.RxBus
|
||||||
import com.example.base.extensions.gone
|
import com.example.base.extensions.gone
|
||||||
import com.example.base.extensions.onClick
|
import com.example.base.extensions.onClick
|
||||||
|
import com.example.base.extensions.startActivity
|
||||||
import com.example.base.extensions.toast
|
import com.example.base.extensions.toast
|
||||||
import com.example.base.extensions.visible
|
import com.example.base.extensions.visible
|
||||||
import com.example.base.ui.BaseFragment
|
import com.example.base.ui.BaseFragment
|
||||||
|
|
@ -23,9 +26,11 @@ import com.example.base.utils.DensityUtils
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import com.google.gson.JsonObject
|
import com.google.gson.JsonObject
|
||||||
import okhttp3.RequestBody.Companion.toRequestBody
|
import okhttp3.RequestBody.Companion.toRequestBody
|
||||||
|
import org.jetbrains.anko.startActivity
|
||||||
import java.text.DecimalFormat
|
import java.text.DecimalFormat
|
||||||
|
|
||||||
class CertificateFragment: BaseFragment<FragmentCertificateBinding, CertificateViewModel>() {
|
class CertificateFragment: BaseFragment<FragmentCertificateBinding, CertificateViewModel>() {
|
||||||
|
private val from by lazy { arguments?.getInt("from") ?: 0 }
|
||||||
private val orderId by lazy { arguments?.getString("orderId") ?: "" }
|
private val orderId by lazy { arguments?.getString("orderId") ?: "" }
|
||||||
|
|
||||||
private var orderInfo: OrderEntity? = null
|
private var orderInfo: OrderEntity? = null
|
||||||
|
|
@ -112,6 +117,9 @@ class CertificateFragment: BaseFragment<FragmentCertificateBinding, CertificateV
|
||||||
mViewModel.updateLiveData.observe(this) {
|
mViewModel.updateLiveData.observe(this) {
|
||||||
toast("提交成功")
|
toast("提交成功")
|
||||||
RxBus.defaultInstance.post(OrderEvent())
|
RxBus.defaultInstance.post(OrderEvent())
|
||||||
|
if (from == 1) {
|
||||||
|
PublicActivity.start(requireContext(), OrderFragment::class.java, Pair("from", 1))
|
||||||
|
}
|
||||||
requireActivity().finish()
|
requireActivity().finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue