diff --git a/common/src/main/java/com/yunbao/common/dialog/DragonRuleConfirmPopup.java b/common/src/main/java/com/yunbao/common/dialog/DragonRuleConfirmPopup.java new file mode 100644 index 000000000..3eefa2413 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/DragonRuleConfirmPopup.java @@ -0,0 +1,72 @@ +package com.yunbao.common.dialog; + +import android.content.Context; +import android.widget.LinearLayout; +import android.widget.TextView; + +import androidx.annotation.NonNull; + +import com.lxj.xpopup.core.CenterPopupView; +import com.yunbao.common.R; +import com.yunbao.common.http.live.LiveNetManager; +import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; +import com.yunbao.common.views.weight.ViewClicksAntiShake; + +public class DragonRuleConfirmPopup extends CenterPopupView { + TextView text_1; + TextView text_2; + TextView text_3; + private String mLiveUid; + private int mGoldMoney;// 總數 + private int mMoney;// 輸入的 + + + + public DragonRuleConfirmPopup(Context context, long goldMoney, long money, String mLiveUid) { + super(context); + this.mGoldMoney = (int) goldMoney; + this.mMoney =(int) money; + this.mLiveUid = mLiveUid; + + } + + // 返回自定义弹窗的布局 + @Override + protected int getImplLayoutId() { + return R.layout.dragon_rule_popup_3; + } + + // 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑 + @Override + protected void onCreate() { + super.onCreate(); + text_1 = findViewById(R.id.text_1); + text_2 = findViewById(R.id.text_2); + text_3 = findViewById(R.id.text_3); + + text_1.setText(String.format(WordUtil.getString(R.string.dialog_jin_dou_1), mMoney)); + text_2.setText(String.format(WordUtil.getString(R.string.dialog_jin_dou_2), (mMoney/10))); + text_3.setText(String.format(WordUtil.getString(R.string.dialog_jin_dou_3), mGoldMoney-mMoney)); + + + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.btn_confirm), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + LiveNetManager.get(getContext()) + .sendMoneyLong(mLiveUid, String.valueOf(mMoney), new com.yunbao.common.http.base.HttpCallback() { + @Override + public void onSuccess(String data) { + dismiss(); + ToastUtil.show(WordUtil.isNewZh() ? "開啓成功" : "Open successfully"); + } + + @Override + public void onError(String error) { + ToastUtil.show(error); + } + }); + } + }); + } +} diff --git a/common/src/main/res/layout/dragon_rule_popup_3.xml b/common/src/main/res/layout/dragon_rule_popup_3.xml new file mode 100644 index 000000000..8bf28339f --- /dev/null +++ b/common/src/main/res/layout/dragon_rule_popup_3.xml @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/values-zh/strings.xml b/common/src/main/res/values-zh/strings.xml index 059c891ae..e55cd1990 100644 --- a/common/src/main/res/values-zh/strings.xml +++ b/common/src/main/res/values-zh/strings.xml @@ -1566,4 +1566,10 @@ 5連桿 6連桿 7連桿 + + + 您將送出%s金豆 + 將獲得%s守護經驗值 + 剩餘%s金豆 + diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index 5eb0c4aef..555dca1eb 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -1574,4 +1574,8 @@ 5 Combo 6 Combo 7 Combo + + You will send s% gold beans + You will gain %s Daemon Experience + Remaining %s gold beans diff --git a/live/src/main/java/com/yunbao/live/dialog/DragonSendsMoneyPopup.java b/live/src/main/java/com/yunbao/live/dialog/DragonSendsMoneyPopup.java index 6d4593949..aa3f39285 100644 --- a/live/src/main/java/com/yunbao/live/dialog/DragonSendsMoneyPopup.java +++ b/live/src/main/java/com/yunbao/live/dialog/DragonSendsMoneyPopup.java @@ -11,6 +11,7 @@ import androidx.fragment.app.FragmentActivity; import com.blankj.utilcode.util.GsonUtils; import com.lxj.xpopup.XPopup; import com.lxj.xpopup.core.CenterPopupView; +import com.yunbao.common.dialog.DragonRuleConfirmPopup; import com.yunbao.common.dialog.DragonRulePopup; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.LiveHttpUtil; @@ -68,7 +69,13 @@ public class DragonSendsMoneyPopup extends CenterPopupView { long money = Long.parseLong(dragonMoney); if (goldMoney >= money) { if (money >= 1000) { - LiveNetManager.get(getContext()) + // 显示确认弹窗 + new XPopup.Builder(getContext()) + .asCustom(new DragonRuleConfirmPopup(getContext(),goldMoney,money,mLiveUid)) + .show(); + dismiss(); + + /* LiveNetManager.get(getContext()) .sendMoneyLong(mLiveUid, String.valueOf(money), new com.yunbao.common.http.base.HttpCallback() { @Override public void onSuccess(String data) { @@ -81,7 +88,7 @@ public class DragonSendsMoneyPopup extends CenterPopupView { public void onError(String error) { ToastUtil.show(error); } - }); + });*/ } else { ToastUtil.show(WordUtil.isNewZh() ? "金豆數量不低於1000" : "The number of golden beans is not less than 1000"); }