Commit 5a7320b1 authored by mengcuiguang's avatar mengcuiguang

添加蚂蚁链

parent 321ba848
...@@ -121,7 +121,15 @@ ...@@ -121,7 +121,15 @@
<activity <activity
android:name=".ui.activitys.VipActivity" android:name=".ui.activitys.VipActivity"
android:exported="false" android:exported="false"
android:screenOrientation="portrait" /> android:screenOrientation="portrait"
tools:node="merge">
<intent-filter tools:node="replace">
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="com.duben.duoduoplayletu.ui.activitys.VipActivity"
tools:ignore="AppLinkUrlError" />
</intent-filter>
</activity>
<activity <activity
android:name=".ui.activitys.SettingsActivity" android:name=".ui.activitys.SettingsActivity"
android:exported="false" android:exported="false"
......
...@@ -184,7 +184,7 @@ class VipPresenter : BasePresenter<VipView>() { ...@@ -184,7 +184,7 @@ class VipPresenter : BasePresenter<VipView>() {
fun getVipPayParams(payChannel: String, pid: String, isInstallAlipay: Boolean,enter:String) { fun getVipPayParams(payChannel: String, pid: String, isInstallAlipay: Boolean,enter:String) {
val vo = HashMap<String, Any>() val vo = HashMap<String, Any>()
// vo["payChannel"] = payChannel vo["payChannel"] = payChannel
vo["payChannel"] = "ALIPAY" vo["payChannel"] = "ALIPAY"
vo["pid"] = pid vo["pid"] = pid
vo["isInstallAlipay"] = isInstallAlipay vo["isInstallAlipay"] = isInstallAlipay
......
...@@ -8,15 +8,14 @@ import android.os.Bundle ...@@ -8,15 +8,14 @@ import android.os.Bundle
import android.os.Handler import android.os.Handler
import android.os.Looper import android.os.Looper
import android.text.TextUtils import android.text.TextUtils
import android.util.Log
import android.view.KeyEvent import android.view.KeyEvent
import android.view.View import android.view.View
import android.widget.CompoundButton import android.widget.CompoundButton
import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager import com.alipay.sdk.app.OpenAuthTask
import com.daimajia.androidanimations.library.Techniques import com.daimajia.androidanimations.library.Techniques
import com.daimajia.androidanimations.library.YoYo import com.daimajia.androidanimations.library.YoYo
import com.duben.library.utils.GlideUtils
import com.duben.library.utils.nodoubleclick.AntiShake
import com.duben.duoduoplayletu.BuildConfig import com.duben.duoduoplayletu.BuildConfig
import com.duben.duoduoplayletu.R import com.duben.duoduoplayletu.R
import com.duben.duoduoplayletu.common.AppConfig import com.duben.duoduoplayletu.common.AppConfig
...@@ -32,6 +31,8 @@ import com.duben.duoduoplayletu.ui.adapter.VipBannerAdapter ...@@ -32,6 +31,8 @@ import com.duben.duoduoplayletu.ui.adapter.VipBannerAdapter
import com.duben.duoduoplayletu.ui.widgets.* import com.duben.duoduoplayletu.ui.widgets.*
import com.duben.duoduoplayletu.ui.widgets.countdowntimer.CountDownTimerSupport import com.duben.duoduoplayletu.ui.widgets.countdowntimer.CountDownTimerSupport
import com.duben.duoduoplayletu.ui.widgets.countdowntimer.OnCountDownTimerListener import com.duben.duoduoplayletu.ui.widgets.countdowntimer.OnCountDownTimerListener
import com.duben.library.utils.GlideUtils
import com.duben.library.utils.nodoubleclick.AntiShake
import com.jobo.alipay.AliPay import com.jobo.alipay.AliPay
import com.jobo.alipay.AlipayInfoImpl import com.jobo.alipay.AlipayInfoImpl
import com.jobo.rxpay.RxPay import com.jobo.rxpay.RxPay
...@@ -43,6 +44,7 @@ import com.tencent.mm.opensdk.openapi.IWXAPI ...@@ -43,6 +44,7 @@ import com.tencent.mm.opensdk.openapi.IWXAPI
import com.tencent.mm.opensdk.openapi.WXAPIFactory import com.tencent.mm.opensdk.openapi.WXAPIFactory
import com.youth.banner.listener.OnPageChangeListener import com.youth.banner.listener.OnPageChangeListener
import kotlinx.android.synthetic.main.activity_new_vip.* import kotlinx.android.synthetic.main.activity_new_vip.*
import java.net.URLDecoder
import java.net.URLEncoder import java.net.URLEncoder
...@@ -250,6 +252,9 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener, ...@@ -250,6 +252,9 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
openAlipayApp(vipBean.payToModel2SecondAlipayAppid) openAlipayApp(vipBean.payToModel2SecondAlipayAppid)
} }
} }
4 -> {
goAlipaySignExecute(paramsBean.params.params)
}
} }
} }
} }
...@@ -344,6 +349,8 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener, ...@@ -344,6 +349,8 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
payType = ALIPAY payType = ALIPAY
iv_vip_alipay.setImageResource(R.mipmap.ic_vip_enable_blue) iv_vip_alipay.setImageResource(R.mipmap.ic_vip_enable_blue)
iv_vip_wx.setImageResource(R.mipmap.ic_vip_none) iv_vip_wx.setImageResource(R.mipmap.ic_vip_none)
} else {
payType = ALIPAY
} }
backPayYesDialog(vipBean) backPayYesDialog(vipBean)
} else { } else {
...@@ -362,20 +369,12 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener, ...@@ -362,20 +369,12 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
if (vipBean.isShowCycTips) { if (vipBean.isShowCycTips) {
agreementPayDialog() agreementPayDialog()
} else { } else {
if (TextUtils.equals(payType, WEIXIN_PAY)) {
vipPresenter.getVipPayParams( vipPresenter.getVipPayParams(
"WEIXIN", payType,
vipBean.pid, isAliPayInstalled(),
ENTER_TYPE_ACTIVITY
)
} else if (TextUtils.equals(payType, ALIPAY)) {
vipPresenter.getVipPayParams(
"ALIPAY",
vipBean.pid, isAliPayInstalled(), vipBean.pid, isAliPayInstalled(),
ENTER_TYPE_ACTIVITY ENTER_TYPE_ACTIVITY
) )
} }
}
} else { } else {
showToast("产品未配置") showToast("产品未配置")
} }
...@@ -491,25 +490,6 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener, ...@@ -491,25 +490,6 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
override fun cancel() { override fun cancel() {
vipPresenter.queryVipOrder(wxParanBean.tid.toString(), false) vipPresenter.queryVipOrder(wxParanBean.tid.toString(), false)
mainHandler.postDelayed(
{
if (isFinishing) return@postDelayed
// 挽留弹窗存在也不弹
if (payYesDialog != null && payYesDialog!!.isShowing) return@postDelayed
if (vipList != null && vipList!!.size > 0) {
val vipBean = vipList!![vipAdapter.getPosition()]
// 0.01
if (vipBean.trial != 0) {
showPayCancelDialog()
}
}
},
2000
)
} }
}) })
} }
...@@ -563,20 +543,12 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener, ...@@ -563,20 +543,12 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
if (vipList != null && vipList!!.size > 0) { if (vipList != null && vipList!!.size > 0) {
val vipBean = vipList!![vipAdapter.getPosition()] val vipBean = vipList!![vipAdapter.getPosition()]
if (TextUtils.equals(payType, WEIXIN_PAY)) {
vipPresenter.getVipPayParams( vipPresenter.getVipPayParams(
"WEIXIN", payType,
vipBean.pid, isAliPayInstalled(), vipBean.pid, isAliPayInstalled(),
ENTER_TYPE_DIALOG ENTER_TYPE_DIALOG
) )
} else if (TextUtils.equals(payType, ALIPAY)) {
vipPresenter.getVipPayParams(
"ALIPAY",
vipBean.pid, isAliPayInstalled(),
ENTER_TYPE_DIALOG
)
}
} else { } else {
showToast("产品未配置") showToast("产品未配置")
} }
...@@ -619,21 +591,12 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener, ...@@ -619,21 +591,12 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
} }
when (v.id) { when (v.id) {
R.id.tv_agreement_next -> { R.id.tv_agreement_next -> {
if (TextUtils.equals(payType, WEIXIN_PAY)) {
vipPresenter.getVipPayParams(
"WEIXIN",
vipBean.pid, isAliPayInstalled(),
ENTER_TYPE_ACTIVITY
)
} else if (TextUtils.equals(payType, ALIPAY)) {
vipPresenter.getVipPayParams( vipPresenter.getVipPayParams(
"ALIPAY", payType,
vipBean.pid, isAliPayInstalled(), vipBean.pid, isAliPayInstalled(),
ENTER_TYPE_ACTIVITY ENTER_TYPE_ACTIVITY
) )
} }
}
} }
} }
}) })
...@@ -670,19 +633,11 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener, ...@@ -670,19 +633,11 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
if (vipBean.isShowCycTips) { if (vipBean.isShowCycTips) {
agreementPayDialog() agreementPayDialog()
} else { } else {
if (TextUtils.equals(payType, WEIXIN_PAY)) {
vipPresenter.getVipPayParams( vipPresenter.getVipPayParams(
"WEIXIN", payType,
vipBean.pid, isAliPayInstalled(), vipBean.pid, isAliPayInstalled(),
ENTER_TYPE_ACTIVITY ENTER_TYPE_ACTIVITY
) )
} else if (TextUtils.equals(payType, ALIPAY)) {
vipPresenter.getVipPayParams(
"ALIPAY",
vipBean.pid, isAliPayInstalled(),
ENTER_TYPE_ACTIVITY
)
}
} }
} else { } else {
showToast("产品未配置") showToast("产品未配置")
...@@ -746,24 +701,6 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener, ...@@ -746,24 +701,6 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
tv_banner_title.text = String.format("《%1s》", data[0].title) tv_banner_title.text = String.format("《%1s》", data[0].title)
} }
private fun showPayCancelDialog() {
val vipBean = vipList!![0]
VipPayCancelDialog(this, vipBean.price, object : DialogListener() {
override fun onClick(dialog: Dialog?, v: View?) {
super.onClick(dialog, v)
dialog?.dismiss()
vipPresenter.getVipPayParams(
"ALIPAY",
vipBean.pid, isAliPayInstalled(),
ENTER_TYPE_DIALOG
)
}
})
.show()
}
fun startTimer() { fun startTimer() {
if (timer != null) { //防止计时器重复 if (timer != null) { //防止计时器重复
timer!!.stop() timer!!.stop()
...@@ -826,4 +763,35 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener, ...@@ -826,4 +763,35 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
e.printStackTrace() e.printStackTrace()
} }
} }
/**
* 唤起独立签约-拿到结果
*
* @param signParams
*/
private fun goAlipaySignExecute(signParams: String) {
AppConfig.enterAlipay = true
try {
val openAuthTask = OpenAuthTask(this)
val map: MutableMap<String, String> = HashMap()
map["sign_params"] = signParams
openAuthTask.execute(
"com.duben.duoduoplayletu.ui.activitys.VipActivity",
OpenAuthTask.BizType.Deduct,
map,
{ resultCode: Int, memo: String?, bundle: Bundle ->
if (resultCode == OpenAuthTask.OK) {
// 对业务完成的结果做后续处理
} else {
// 对业务失败的结果做后续处理
showToast("支付失败")
}
},
true
)
} catch (e: Exception) {
e.printStackTrace()
}
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment