首充弹窗增加帮助弹窗
This commit is contained in:
@@ -3,20 +3,38 @@ package com.yizhuan.erban.avroom.firstcharge
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import android.view.Gravity
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.WindowManager
|
||||
import android.widget.PopupWindow
|
||||
import android.widget.TextView
|
||||
import com.google.android.flexbox.AlignItems
|
||||
import com.google.android.flexbox.FlexboxLayoutManager
|
||||
import com.google.android.flexbox.JustifyContent
|
||||
import com.netease.nim.uikit.common.util.sys.ScreenUtil
|
||||
import com.yizhuan.erban.R
|
||||
import com.yizhuan.erban.bank_card.activity.AddBankCardAgreementActivity
|
||||
import com.yizhuan.erban.base.BaseViewBindingActivity
|
||||
import com.yizhuan.erban.common.widget.dialog.DialogManager.AbsOkDialogListener
|
||||
import com.yizhuan.erban.databinding.DialogFirstChargeBinding
|
||||
import com.yizhuan.erban.ui.setting.ModifyPwdActivity
|
||||
import com.yizhuan.erban.ui.utils.RVDelegate
|
||||
import com.yizhuan.erban.ui.webview.CommonWebViewActivity
|
||||
import com.yizhuan.xchat_android_core.UriProvider
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel
|
||||
import com.yizhuan.xchat_android_core.pay.PayModel
|
||||
import com.yizhuan.xchat_android_core.pay.PaymentActivity
|
||||
import com.yizhuan.xchat_android_core.pay.bean.FirstChargeGoods
|
||||
import com.yizhuan.xchat_android_core.pay.bean.FirstChargeReward
|
||||
import com.yizhuan.xchat_android_core.pay.bean.PaymentResult
|
||||
import com.yizhuan.xchat_android_core.pay.event.FirstChargeEvent
|
||||
import com.yizhuan.xchat_android_core.pay.model.unionpay.UnionPayModel
|
||||
import com.yizhuan.xchat_android_core.utils.toast
|
||||
import com.yizhuan.xchat_android_library.annatation.ActLayoutRes
|
||||
import com.yizhuan.xchat_android_library.utils.JavaUtil
|
||||
import com.yizhuan.xchat_android_library.utils.SingleToastUtil
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
@@ -30,6 +48,7 @@ class FirstChargeDialog : BaseViewBindingActivity<DialogFirstChargeBinding>() {
|
||||
private var currGoods: FirstChargeGoods? = null
|
||||
private lateinit var rewardAdapter: RewardAdapter
|
||||
private lateinit var rvDelegate: RVDelegate<FirstChargeReward>
|
||||
private lateinit var helpPopupWindow: PopupWindow
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
@@ -37,6 +56,8 @@ class FirstChargeDialog : BaseViewBindingActivity<DialogFirstChargeBinding>() {
|
||||
val starter = Intent(context, FirstChargeDialog::class.java)
|
||||
context.startActivity(starter)
|
||||
}
|
||||
|
||||
private const val BIND_CODE_GOLD = 200
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
@@ -60,6 +81,7 @@ class FirstChargeDialog : BaseViewBindingActivity<DialogFirstChargeBinding>() {
|
||||
binding.rbPlanC.textSize = 22f
|
||||
updateCurrGoods(goodsList?.getOrNull(2))
|
||||
}
|
||||
binding.ivHelp.setOnClickListener { showHelpPopup() }
|
||||
binding.ivCharge.setOnClickListener {
|
||||
currGoods?.let {
|
||||
SelectPayTypeDialog.newInstance(it.chargeProdId, "¥${it.chargeMoney}")
|
||||
@@ -77,13 +99,15 @@ class FirstChargeDialog : BaseViewBindingActivity<DialogFirstChargeBinding>() {
|
||||
})
|
||||
.setRecyclerView(binding.recyclerView)
|
||||
.build()
|
||||
|
||||
dialogManager.showProgressDialog(this)
|
||||
PayModel.get().firstChargeList
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe({
|
||||
initData(it)
|
||||
dialogManager.dismissDialog()
|
||||
}, {
|
||||
it.printStackTrace()
|
||||
dialogManager.dismissDialog()
|
||||
SingleToastUtil.showToast(it.message)
|
||||
finish()
|
||||
})
|
||||
@@ -130,6 +154,88 @@ class FirstChargeDialog : BaseViewBindingActivity<DialogFirstChargeBinding>() {
|
||||
binding.rbPlanC.textSize = 18f
|
||||
}
|
||||
|
||||
private fun showHelpPopup() {
|
||||
if (currGoods == null) {
|
||||
SingleToastUtil.showToast("数据加载中,请稍后...")
|
||||
return
|
||||
}
|
||||
val contentView: View
|
||||
if (!this::helpPopupWindow.isInitialized) {
|
||||
contentView =
|
||||
LayoutInflater.from(context).inflate(R.layout.layout_first_charge_help_view, null)
|
||||
contentView.findViewById<TextView>(R.id.tv_content).text =
|
||||
currGoods?.chargeProdDesc?.replace("\\n", "\n")?.replace("\\r", "\r")
|
||||
helpPopupWindow =
|
||||
PopupWindow(
|
||||
contentView,
|
||||
ScreenUtil.dip2px(150f),
|
||||
WindowManager.LayoutParams.WRAP_CONTENT
|
||||
)
|
||||
helpPopupWindow.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
|
||||
helpPopupWindow.isOutsideTouchable = true
|
||||
helpPopupWindow.isFocusable = true
|
||||
}
|
||||
|
||||
try {
|
||||
helpPopupWindow.showAsDropDown(
|
||||
binding.ivHelp,
|
||||
0,
|
||||
0,
|
||||
Gravity.START or Gravity.BOTTOM
|
||||
)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
dialogManager.dismissDialog()
|
||||
if (resultCode != RESULT_OK) {
|
||||
return
|
||||
}
|
||||
//支付页面返回处理
|
||||
if (requestCode == PaymentActivity.REQUEST_CODE_PAY) {
|
||||
if (data != null && data.extras != null) {
|
||||
val paymentResult: PaymentResult? =
|
||||
data.getParcelableExtra(PaymentActivity.KEY_PAY_RESULT)
|
||||
if (paymentResult != null) {
|
||||
// 充值金额超过限定时,就必须先实名认证
|
||||
when (JavaUtil.str2int(paymentResult.code)) {
|
||||
PayModel.NOT_REAL_NAME_BEFORE_CHARGING -> dialogManager.showTipsDialog(
|
||||
getString(R.string.tips_need_to_certification),
|
||||
getString(R.string.go_to_certification),
|
||||
object : AbsOkDialogListener() {
|
||||
override fun onOk() {
|
||||
// 跳去实名认证页面
|
||||
CommonWebViewActivity.start(
|
||||
this@FirstChargeDialog,
|
||||
UriProvider.getTutuRealNamePage()
|
||||
)
|
||||
}
|
||||
})
|
||||
UnionPayModel.CODE_NEED_BIND_BANK_CARD_FIRST -> dialogManager.showTipsDialog(
|
||||
getString(R.string.tips_need_bind_bank_card_first),
|
||||
object : AbsOkDialogListener() {
|
||||
override fun onOk() {
|
||||
// 跳去添加银行卡页面
|
||||
AddBankCardAgreementActivity.start(this@FirstChargeDialog)
|
||||
}
|
||||
})
|
||||
else -> {
|
||||
toast(paymentResult.msg)
|
||||
//重新获取钱包信息
|
||||
PayModel.get().getWalletInfo(AuthModel.get().currentUid).subscribe()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (requestCode == BIND_CODE_GOLD) {
|
||||
ModifyPwdActivity.start(this, ModifyPwdActivity.FOGERT_PAY_PWD)
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onFirstRechargeEvent(event: FirstChargeEvent?) {
|
||||
finish()
|
||||
|
BIN
app/src/main/res/drawable-xhdpi/bg_first_charge_help.9.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/bg_first_charge_help.9.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_first_charge_help.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/ic_first_charge_help.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
@@ -13,11 +13,20 @@
|
||||
android:background="@drawable/bg_first_charge"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_help"
|
||||
android:layout_width="22dp"
|
||||
android:layout_height="22dp"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginTop="100dp"
|
||||
android:layout_marginEnd="13dp"
|
||||
android:src="@drawable/ic_first_charge_help" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="250dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="130dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<CheckBox
|
||||
@@ -30,7 +39,7 @@
|
||||
android:checked="true"
|
||||
android:gravity="center_horizontal|bottom"
|
||||
android:includeFontPadding="false"
|
||||
android:paddingBottom="5dp"
|
||||
android:paddingBottom="3dp"
|
||||
android:textColor="@color/color_selector_c06100_false_white"
|
||||
android:textSize="22sp"
|
||||
tools:text="1元" />
|
||||
@@ -45,7 +54,7 @@
|
||||
android:button="@null"
|
||||
android:gravity="center_horizontal|bottom"
|
||||
android:includeFontPadding="false"
|
||||
android:paddingBottom="5dp"
|
||||
android:paddingBottom="3dp"
|
||||
android:textColor="@color/color_selector_c06100_false_white"
|
||||
android:textSize="18sp"
|
||||
tools:text="6元" />
|
||||
@@ -61,7 +70,7 @@
|
||||
android:button="@null"
|
||||
android:gravity="center_horizontal|bottom"
|
||||
android:includeFontPadding="false"
|
||||
android:paddingBottom="5dp"
|
||||
android:paddingBottom="3dp"
|
||||
android:textColor="@color/color_selector_c06100_false_white"
|
||||
android:textSize="18sp"
|
||||
tools:text="188元" />
|
||||
|
22
app/src/main/res/layout/layout_first_charge_help_view.xml
Normal file
22
app/src/main/res/layout/layout_first_charge_help_view.xml
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_content"
|
||||
android:layout_width="145dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:background="@drawable/bg_first_charge_help"
|
||||
android:lineSpacingExtra="1dp"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingTop="13dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:text="@string/first_charge_help"
|
||||
android:textColor="@color/text_title_white"
|
||||
android:textSize="10dp" />
|
||||
</FrameLayout>
|
@@ -906,4 +906,5 @@
|
||||
<string name="text_dating_vip_rule">1.每轮相亲在“嘉宾交流”阶段累积送礼满999钻石且送礼价值最高的用户自动登上VIP席位;\n\n 2.若出现多个满足上VIP席位要求的用户,VIP席位最终由送礼价值最高的用户获得,若送礼价值相同以最先达到该值的用户为准;\n\n 3.VIP席位的用户可选择是否下麦,其他用户不可因此代替坐上席位; \n\n 4.用户只能在“嘉宾交流”阶段抢夺VIP席位,“嘉宾交流”阶段后直到结束本轮前,即使送出超过之前VIP总礼物价值也不能换人;\n\n 5.每轮相亲结束后VIP席位清空,下一轮重新开始抢位。</string>
|
||||
<string name="room_pk_help">1)按收到的礼物价值积分(1钻石=1分),礼物值高的一方获胜。\n 2)PK结束后,若比分差距≥1314或双方分数总值≥15000(平局除外)将在与获胜方相同类型的房间公示PK结果;若比分差距≥5200或双方分数总值≥30000(平局除外)将在全服所有房间公示PK结果。</string>
|
||||
<string name="room_pk_rule">1)只有牌照房房主和超管才可以发起跨房pk,一次只能选择一个牌照房发起;\n 2)只有房主和超管才可以接受或拒绝跨房pk请求,若10秒内不点击pk邀请弹窗,弹窗消失,视为自动拒绝;\n 3)发起pk时需选择pk时间和pk对象,自定义时间下限为5,上限为180,只能填写整数;\n 4)pk发起后,未到pk时间无法自行结束,若有特殊情况需提前结束可联系客服,但本场pk不算胜负。</string>
|
||||
<string name="first_charge_help">1.每人仅可获得1次首充福利\n2.每个手机号,设备,实名认证等如已参与过首充,则无法获得奖励。</string>
|
||||
</resources>
|
||||
|
Reference in New Issue
Block a user