龍神送財金豆确认弹窗
This commit is contained in:
parent
299e109c3d
commit
4029392dad
@ -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<String>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(String data) {
|
||||||
|
dismiss();
|
||||||
|
ToastUtil.show(WordUtil.isNewZh() ? "開啓成功" : "Open successfully");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(String error) {
|
||||||
|
ToastUtil.show(error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
97
common/src/main/res/layout/dragon_rule_popup_3.xml
Normal file
97
common/src/main/res/layout/dragon_rule_popup_3.xml
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="270dp"
|
||||||
|
android:layout_height="270dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:scaleType="fitXY"
|
||||||
|
android:src="@mipmap/background_dragon_rule" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<com.flyjingfish.gradienttextviewlib.GradientTextView
|
||||||
|
android:id="@+id/title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:letterSpacing="0.2"
|
||||||
|
android:text="@string/dialog_tip"
|
||||||
|
android:textSize="23sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:gradient_angle="180"
|
||||||
|
app:gradient_endColor="#F9E1AE"
|
||||||
|
app:gradient_startColor="#C28413" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/list"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/text_1"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="13dp"
|
||||||
|
android:layout_marginTop="14dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/dialog_jin_dou_1"
|
||||||
|
android:textColor="#FFE0BF"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/text_2"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="13dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/dialog_jin_dou_2"
|
||||||
|
android:textColor="#FFE0BF"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/text_3"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="13dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/dialog_jin_dou_3"
|
||||||
|
android:textColor="#FFE0BF"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/btn_confirm"
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="38dp"
|
||||||
|
android:layout_gravity="bottom|center"
|
||||||
|
android:background="@drawable/guard_buy_tips_sure_bg"
|
||||||
|
android:gravity="center"
|
||||||
|
android:letterSpacing="0.1"
|
||||||
|
android:text="@string/edit_one_4"
|
||||||
|
android:textColor="#893D0D"
|
||||||
|
android:textSize="15sp"
|
||||||
|
android:layout_marginTop="60dp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
</LinearLayout>
|
@ -1566,4 +1566,10 @@
|
|||||||
<string name="game_dialog_activity_achievements_5">5連桿</string>
|
<string name="game_dialog_activity_achievements_5">5連桿</string>
|
||||||
<string name="game_dialog_activity_achievements_6">6連桿</string>
|
<string name="game_dialog_activity_achievements_6">6連桿</string>
|
||||||
<string name="game_dialog_activity_achievements_7">7連桿</string>
|
<string name="game_dialog_activity_achievements_7">7連桿</string>
|
||||||
|
|
||||||
|
|
||||||
|
<string name="dialog_jin_dou_1">您將送出%s金豆</string>
|
||||||
|
<string name="dialog_jin_dou_2">將獲得%s守護經驗值</string>
|
||||||
|
<string name="dialog_jin_dou_3">剩餘%s金豆</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -1574,4 +1574,8 @@
|
|||||||
<string name="game_dialog_activity_achievements_5">5 Combo</string>
|
<string name="game_dialog_activity_achievements_5">5 Combo</string>
|
||||||
<string name="game_dialog_activity_achievements_6">6 Combo</string>
|
<string name="game_dialog_activity_achievements_6">6 Combo</string>
|
||||||
<string name="game_dialog_activity_achievements_7">7 Combo</string>
|
<string name="game_dialog_activity_achievements_7">7 Combo</string>
|
||||||
|
|
||||||
|
<string name="dialog_jin_dou_1">You will send s% gold beans</string>
|
||||||
|
<string name="dialog_jin_dou_2">You will gain %s Daemon Experience</string>
|
||||||
|
<string name="dialog_jin_dou_3">Remaining %s gold beans</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -11,6 +11,7 @@ import androidx.fragment.app.FragmentActivity;
|
|||||||
import com.blankj.utilcode.util.GsonUtils;
|
import com.blankj.utilcode.util.GsonUtils;
|
||||||
import com.lxj.xpopup.XPopup;
|
import com.lxj.xpopup.XPopup;
|
||||||
import com.lxj.xpopup.core.CenterPopupView;
|
import com.lxj.xpopup.core.CenterPopupView;
|
||||||
|
import com.yunbao.common.dialog.DragonRuleConfirmPopup;
|
||||||
import com.yunbao.common.dialog.DragonRulePopup;
|
import com.yunbao.common.dialog.DragonRulePopup;
|
||||||
import com.yunbao.common.http.HttpCallback;
|
import com.yunbao.common.http.HttpCallback;
|
||||||
import com.yunbao.common.http.LiveHttpUtil;
|
import com.yunbao.common.http.LiveHttpUtil;
|
||||||
@ -68,7 +69,13 @@ public class DragonSendsMoneyPopup extends CenterPopupView {
|
|||||||
long money = Long.parseLong(dragonMoney);
|
long money = Long.parseLong(dragonMoney);
|
||||||
if (goldMoney >= money) {
|
if (goldMoney >= money) {
|
||||||
if (money >= 1000) {
|
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<String>() {
|
.sendMoneyLong(mLiveUid, String.valueOf(money), new com.yunbao.common.http.base.HttpCallback<String>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(String data) {
|
public void onSuccess(String data) {
|
||||||
@ -81,7 +88,7 @@ public class DragonSendsMoneyPopup extends CenterPopupView {
|
|||||||
public void onError(String error) {
|
public void onError(String error) {
|
||||||
ToastUtil.show(error);
|
ToastUtil.show(error);
|
||||||
}
|
}
|
||||||
});
|
});*/
|
||||||
} else {
|
} else {
|
||||||
ToastUtil.show(WordUtil.isNewZh() ? "金豆數量不低於1000" : "The number of golden beans is not less than 1000");
|
ToastUtil.show(WordUtil.isNewZh() ? "金豆數量不低於1000" : "The number of golden beans is not less than 1000");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user