fix:修复发布头条支付弹窗未选中金币问题
This commit is contained in:
@@ -827,8 +827,8 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
||||
KeyBoardUtils.hideKeyBoard(activity, inputEdit)
|
||||
SelectPayTypeDialog.newInstance(
|
||||
money.toString(),
|
||||
false,
|
||||
money.toDouble()
|
||||
money,
|
||||
false
|
||||
).apply {
|
||||
setOnDiamondChargeClick {
|
||||
headlineViewModel.sendHeadline(message)
|
||||
|
@@ -27,7 +27,7 @@ import com.chwl.library.utils.SingleToastUtil
|
||||
class SelectPayTypeDialog : BaseDialog<DialogSelectPayTypeBinding>() {
|
||||
|
||||
private val descText by lazy { requireArguments().getString("descText", "") }
|
||||
private val money by lazy { requireArguments().getDouble("money", 0.0) }
|
||||
private val coins by lazy { requireArguments().getLong("coins", 0) }
|
||||
private val showGoogleCharge by lazy {
|
||||
requireArguments().getBoolean(
|
||||
"showGoogleCharge",
|
||||
@@ -44,17 +44,33 @@ class SelectPayTypeDialog : BaseDialog<DialogSelectPayTypeBinding>() {
|
||||
private var walletInfo: WalletInfo? = null
|
||||
|
||||
companion object {
|
||||
/**
|
||||
* @param money 真实货币(目前比例1:1000)
|
||||
*/
|
||||
@JvmStatic
|
||||
fun newInstance(
|
||||
descText: String,
|
||||
showGoogleCharge: Boolean = false,
|
||||
money: Double = 0.0
|
||||
): SelectPayTypeDialog {
|
||||
return newInstance(descText, (money * 1000).toLong(), showGoogleCharge)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param coins 虚拟货币:金币
|
||||
*/
|
||||
@JvmStatic
|
||||
fun newInstance(
|
||||
descText: String,
|
||||
coins: Long,
|
||||
showGoogleCharge: Boolean = false,
|
||||
): SelectPayTypeDialog {
|
||||
return SelectPayTypeDialog().apply {
|
||||
arguments = Bundle().apply {
|
||||
putString("descText", descText)
|
||||
putBoolean("showGoogleCharge", showGoogleCharge)
|
||||
putDouble("money", money)
|
||||
putLong("coins", coins)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -117,7 +133,7 @@ class SelectPayTypeDialog : BaseDialog<DialogSelectPayTypeBinding>() {
|
||||
binding?.rbGoogle?.visibility = View.VISIBLE
|
||||
binding?.rg?.setOnCheckedChangeListener { _, _ ->
|
||||
if (binding?.rbDiamond?.isChecked == true) {
|
||||
binding?.tvDiamondNum?.text = (money * 1000).toInt().toString()
|
||||
binding?.tvDiamondNum?.text = coins.toString()
|
||||
binding?.tvDiamond?.visibility = View.VISIBLE
|
||||
} else {
|
||||
binding?.tvDiamondNum?.text = descText
|
||||
@@ -151,12 +167,13 @@ class SelectPayTypeDialog : BaseDialog<DialogSelectPayTypeBinding>() {
|
||||
)
|
||||
)
|
||||
.build()
|
||||
val defaultDiamond = money != 0.0 && money * 1000 <= walletInfo.diamondNum
|
||||
var defaultDiamond = coins <= walletInfo.diamondNum
|
||||
if (showGoogleCharge) {
|
||||
binding?.rbGoogle?.visibility = View.VISIBLE
|
||||
binding?.rbGoogle?.isChecked = !defaultDiamond
|
||||
} else {
|
||||
binding?.rbGoogle?.visibility = View.GONE
|
||||
defaultDiamond = true
|
||||
}
|
||||
binding?.rbDiamond?.isChecked = defaultDiamond
|
||||
}
|
||||
|
@@ -71,8 +71,8 @@ class HeadlineSendDialog : BaseDialog<HeadlineSendDialogBinding>() {
|
||||
private fun showPayDialog(money: Long) {
|
||||
SelectPayTypeDialog.newInstance(
|
||||
money.toString(),
|
||||
false,
|
||||
money.toDouble()
|
||||
money,
|
||||
false
|
||||
).apply {
|
||||
setOnDiamondChargeClick {
|
||||
val message = getInputContent()
|
||||
|
Reference in New Issue
Block a user