diff --git a/common/src/main/java/com/yunbao/common/dialog/ActivateEliteBattleOrderPopupWindow.java b/common/src/main/java/com/yunbao/common/dialog/ActivateEliteBattleOrderPopupWindow.java new file mode 100644 index 000000000..f028bd1e2 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/ActivateEliteBattleOrderPopupWindow.java @@ -0,0 +1,72 @@ +package com.yunbao.common.dialog; + +import android.app.Activity; +import android.content.Context; +import android.widget.Button; + +import androidx.annotation.NonNull; + +import com.lxj.xpopup.XPopup; +import com.lxj.xpopup.core.CenterPopupView; +import com.yunbao.common.R; +import com.yunbao.common.utils.DeviceUtils; +import com.yunbao.common.utils.DpUtil; +import com.yunbao.common.views.weight.ViewClicksAntiShake; + +public class ActivateEliteBattleOrderPopupWindow extends CenterPopupView { + private boolean elites;//是否精英战令 + private String spendMoney;//花费钱 + private Button buttonWarOrder; + + public ActivateEliteBattleOrderPopupWindow(@NonNull Context context, String mSpendMoney, boolean elites) { + super(context); + this.elites = elites; + spendMoney = mSpendMoney; + } + + @Override + protected int getImplLayoutId() { + return R.layout.activate_elite_battle_order_popup; + } + + // 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑 + @Override + protected void onCreate() { + super.onCreate(); + buttonWarOrder = findViewById(R.id.button_war_order); + if (elites) { + findViewById(R.id.gift_overvalue).setVisibility(VISIBLE); + findViewById(R.id.gift_overvalue3).setVisibility(GONE); + findViewById(R.id.enjoy_image).setVisibility(GONE); + findViewById(R.id.gift_overvalue).setVisibility(VISIBLE); + } else { + findViewById(R.id.gift_overvalue).setVisibility(GONE); + findViewById(R.id.gift_overvalue3).setVisibility(VISIBLE); + findViewById(R.id.enjoy_image).setVisibility(VISIBLE); + findViewById(R.id.gift_overvalue).setVisibility(GONE); + } + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.war_order_close), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + dialog.dismiss(); + } + }); + //中文按钮文字 + StringBuffer stringBuffer = new StringBuffer(); + stringBuffer.append(spendMoney) + .append("鑽開通"); + buttonWarOrder.setText(stringBuffer.toString()); + + ViewClicksAntiShake.clicksAntiShake(buttonWarOrder, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + dialog.dismiss(); + new XPopup.Builder(getContext()) + .enableDrag(false) + .maxWidth(DeviceUtils.getScreenHeight((Activity) getContext()) - DpUtil.dp2px(34)) + .asCustom(new LiberalBattlePassPopupWindow(getContext(), spendMoney, elites)) + .show(); + } + }); + } +} diff --git a/common/src/main/java/com/yunbao/common/dialog/LiberalBattlePassPopupWindow.java b/common/src/main/java/com/yunbao/common/dialog/LiberalBattlePassPopupWindow.java new file mode 100644 index 000000000..08123554c --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/LiberalBattlePassPopupWindow.java @@ -0,0 +1,59 @@ +package com.yunbao.common.dialog; + +import android.content.Context; +import android.graphics.Color; +import android.text.Spannable; +import android.text.SpannableStringBuilder; +import android.text.style.ForegroundColorSpan; +import android.widget.TextView; + +import androidx.annotation.NonNull; + +import com.lxj.xpopup.core.CenterPopupView; +import com.yunbao.common.R; +import com.yunbao.common.views.weight.ViewClicksAntiShake; + +public class LiberalBattlePassPopupWindow extends CenterPopupView { + private String spendMoney;//花费钱 + private boolean mElites;//是否精英战令 + private TextView liberalBattlePass; + + public LiberalBattlePassPopupWindow(@NonNull Context context, String mSpendMoney, boolean elites) { + super(context); + spendMoney = mSpendMoney; + mElites = elites; + } + + protected int getImplLayoutId() { + return R.layout.liberal_battle_pass_popup; + } + + // 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑 + @Override + protected void onCreate() { + super.onCreate(); + liberalBattlePass = findViewById(R.id.liberal_battle_pass); + //中文版 + StringBuffer liberalBattlePassHint = new StringBuffer(); + liberalBattlePassHint.append("是否花費"); + liberalBattlePassHint.append(spendMoney).append(mElites ? "鑽石開通精英戰令!" : "鑽石開通尊享戰令!"); + //英文版 + + //设置样式 + String liberalBattlePassStr = liberalBattlePassHint.toString(); + SpannableStringBuilder builder = new SpannableStringBuilder(); + builder.append(liberalBattlePassStr); + int spendMoneyIndex = liberalBattlePassStr.indexOf(spendMoney); + int spendMoneySize = spendMoneyIndex + spendMoney.length(); + builder.setSpan(new ForegroundColorSpan(Color.parseColor("#CE2BFF")), spendMoneyIndex, spendMoneySize, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + liberalBattlePass.setText(builder); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.cancel), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + dialog.dismiss(); + } + }); + + + } +} diff --git a/common/src/main/java/com/yunbao/common/dialog/PromotionElitePopupWindow.java b/common/src/main/java/com/yunbao/common/dialog/PromotionElitePopupWindow.java index 91ae7d785..cefbcbfd5 100644 --- a/common/src/main/java/com/yunbao/common/dialog/PromotionElitePopupWindow.java +++ b/common/src/main/java/com/yunbao/common/dialog/PromotionElitePopupWindow.java @@ -1,19 +1,29 @@ package com.yunbao.common.dialog; +import android.app.Activity; import android.content.Context; import androidx.annotation.NonNull; +import com.lxj.xpopup.XPopup; import com.lxj.xpopup.core.CenterPopupView; import com.yunbao.common.R; +import com.yunbao.common.utils.DeviceUtils; +import com.yunbao.common.utils.DpUtil; +import com.yunbao.common.views.weight.ViewClicksAntiShake; /** * 升級精英/尊享戰令 */ public class PromotionElitePopupWindow extends CenterPopupView { - public PromotionElitePopupWindow(@NonNull Context context) { + private String enjoySpendMoney,quintessenceSpendMoney;//花费钱 + + public PromotionElitePopupWindow(@NonNull Context context, String mEnjoySpendMoney, String mQuintessenceSpendMoney) { super(context); + enjoySpendMoney = mEnjoySpendMoney; + quintessenceSpendMoney = mQuintessenceSpendMoney; } + @Override protected int getImplLayoutId() { return R.layout.promotion_elite_popup; @@ -23,5 +33,33 @@ public class PromotionElitePopupWindow extends CenterPopupView { @Override protected void onCreate() { super.onCreate(); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.close), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + dialog.dismiss(); + } + }); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.button_quintessence), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + dialog.dismiss(); + new XPopup.Builder(getContext()) + .enableDrag(false) + .maxWidth(DeviceUtils.getScreenHeight((Activity) getContext()) - DpUtil.dp2px(34)) + .asCustom(new ActivateEliteBattleOrderPopupWindow(getContext(), quintessenceSpendMoney, true)) + .show(); + } + }); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.button_enjoy), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + dialog.dismiss(); + new XPopup.Builder(getContext()) + .enableDrag(false) + .maxWidth(DeviceUtils.getScreenHeight((Activity) getContext()) - DpUtil.dp2px(34)) + .asCustom(new ActivateEliteBattleOrderPopupWindow(getContext(), enjoySpendMoney, false)) + .show(); + } + }); } } diff --git a/common/src/main/java/com/yunbao/common/dialog/RuleOfWarPopupWindow.java b/common/src/main/java/com/yunbao/common/dialog/RuleOfWarPopupWindow.java new file mode 100644 index 000000000..fcf545bd6 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/RuleOfWarPopupWindow.java @@ -0,0 +1,24 @@ +package com.yunbao.common.dialog; + +import android.content.Context; + +import androidx.annotation.NonNull; + +import com.lxj.xpopup.core.CenterPopupView; +import com.yunbao.common.R; + +public class RuleOfWarPopupWindow extends CenterPopupView { + public RuleOfWarPopupWindow(@NonNull Context context) { + super(context); + } + @Override + protected int getImplLayoutId() { + return R.layout.rule_of_war_popup; + } + + // 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑 + @Override + protected void onCreate() { + super.onCreate(); + } +} diff --git a/common/src/main/res/layout/activate_elite_battle_order_popup.xml b/common/src/main/res/layout/activate_elite_battle_order_popup.xml new file mode 100644 index 000000000..63cac1100 --- /dev/null +++ b/common/src/main/res/layout/activate_elite_battle_order_popup.xml @@ -0,0 +1,142 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +