diff --git a/app/src/main/java/com/yizhuan/erban/avroom/firstcharge/FirstChargeDialog.kt b/app/src/main/java/com/yizhuan/erban/avroom/firstcharge/FirstChargeDialog.kt index 2479dae25..4b707725e 100644 --- a/app/src/main/java/com/yizhuan/erban/avroom/firstcharge/FirstChargeDialog.kt +++ b/app/src/main/java/com/yizhuan/erban/avroom/firstcharge/FirstChargeDialog.kt @@ -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() { private var currGoods: FirstChargeGoods? = null private lateinit var rewardAdapter: RewardAdapter private lateinit var rvDelegate: RVDelegate + private lateinit var helpPopupWindow: PopupWindow companion object { @JvmStatic @@ -37,6 +56,8 @@ class FirstChargeDialog : BaseViewBindingActivity() { 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() { 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() { }) .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() { 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(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() diff --git a/app/src/main/res/drawable-xhdpi/bg_first_charge_help.9.png b/app/src/main/res/drawable-xhdpi/bg_first_charge_help.9.png new file mode 100644 index 000000000..83527d22e Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/bg_first_charge_help.9.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_first_charge_help.png b/app/src/main/res/drawable-xhdpi/ic_first_charge_help.png new file mode 100644 index 000000000..0a6747339 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_first_charge_help.png differ diff --git a/app/src/main/res/layout/dialog_first_charge.xml b/app/src/main/res/layout/dialog_first_charge.xml index a0341ae61..8d9043bf6 100644 --- a/app/src/main/res/layout/dialog_first_charge.xml +++ b/app/src/main/res/layout/dialog_first_charge.xml @@ -13,11 +13,20 @@ android:background="@drawable/bg_first_charge" android:orientation="vertical"> + + @@ -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元" /> diff --git a/app/src/main/res/layout/layout_first_charge_help_view.xml b/app/src/main/res/layout/layout_first_charge_help_view.xml new file mode 100644 index 000000000..0431ff383 --- /dev/null +++ b/app/src/main/res/layout/layout_first_charge_help_view.xml @@ -0,0 +1,22 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 547ebcda0..c24c9097c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -906,4 +906,5 @@ 1.每轮相亲在“嘉宾交流”阶段累积送礼满999钻石且送礼价值最高的用户自动登上VIP席位;\n\n 2.若出现多个满足上VIP席位要求的用户,VIP席位最终由送礼价值最高的用户获得,若送礼价值相同以最先达到该值的用户为准;\n\n 3.VIP席位的用户可选择是否下麦,其他用户不可因此代替坐上席位; \n\n 4.用户只能在“嘉宾交流”阶段抢夺VIP席位,“嘉宾交流”阶段后直到结束本轮前,即使送出超过之前VIP总礼物价值也不能换人;\n\n 5.每轮相亲结束后VIP席位清空,下一轮重新开始抢位。 1)按收到的礼物价值积分(1钻石=1分),礼物值高的一方获胜。\n 2)PK结束后,若比分差距≥1314或双方分数总值≥15000(平局除外)将在与获胜方相同类型的房间公示PK结果;若比分差距≥5200或双方分数总值≥30000(平局除外)将在全服所有房间公示PK结果。 1)只有牌照房房主和超管才可以发起跨房pk,一次只能选择一个牌照房发起;\n 2)只有房主和超管才可以接受或拒绝跨房pk请求,若10秒内不点击pk邀请弹窗,弹窗消失,视为自动拒绝;\n 3)发起pk时需选择pk时间和pk对象,自定义时间下限为5,上限为180,只能填写整数;\n 4)pk发起后,未到pk时间无法自行结束,若有特殊情况需提前结束可联系客服,但本场pk不算胜负。 + 1.每人仅可获得1次首充福利\n2.每个手机号,设备,实名认证等如已参与过首充,则无法获得奖励。