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 1283582d7..767cef165 100644 --- a/common/src/main/java/com/yunbao/common/dialog/PromotionElitePopupWindow.java +++ b/common/src/main/java/com/yunbao/common/dialog/PromotionElitePopupWindow.java @@ -18,16 +18,17 @@ import com.yunbao.common.views.weight.ViewClicksAntiShake; public class PromotionElitePopupWindow extends CenterPopupView { private String enjoySpendMoney, quintessenceSpendMoney;//花费钱 private LiberalBattlePassPopupWindow.LiberalBattlePassCallback mPassCallback; - private String mBattlePassTypeId; + private String elitesTypeId,enjoyTypeId; public PromotionElitePopupWindow(@NonNull Context context, String mEnjoySpendMoney, String mQuintessenceSpendMoney, LiberalBattlePassPopupWindow.LiberalBattlePassCallback passCallback, - String battlePassTypeId) { + String elitesTypeId, String enjoyTypeId) { super(context); enjoySpendMoney = mEnjoySpendMoney; quintessenceSpendMoney = mQuintessenceSpendMoney; mPassCallback = passCallback; - mBattlePassTypeId = battlePassTypeId; + this.elitesTypeId = elitesTypeId; + this.enjoyTypeId = enjoyTypeId; } @Override @@ -52,7 +53,7 @@ public class PromotionElitePopupWindow extends CenterPopupView { new XPopup.Builder(getContext()) .enableDrag(false) .maxWidth(DeviceUtils.getScreenHeight((Activity) getContext()) - DpUtil.dp2px(34)) - .asCustom(new ActivateEliteBattleOrderPopupWindow(getContext(), quintessenceSpendMoney, true, mPassCallback, mBattlePassTypeId)) + .asCustom(new ActivateEliteBattleOrderPopupWindow(getContext(), quintessenceSpendMoney, true, mPassCallback, elitesTypeId)) .show(); } }); @@ -63,7 +64,7 @@ public class PromotionElitePopupWindow extends CenterPopupView { new XPopup.Builder(getContext()) .enableDrag(false) .maxWidth(DeviceUtils.getScreenHeight((Activity) getContext()) - DpUtil.dp2px(34)) - .asCustom(new ActivateEliteBattleOrderPopupWindow(getContext(), enjoySpendMoney, false, mPassCallback, mBattlePassTypeId)) + .asCustom(new ActivateEliteBattleOrderPopupWindow(getContext(), enjoySpendMoney, false, mPassCallback, enjoyTypeId)) .show(); } }); diff --git a/common/src/main/java/com/yunbao/common/dialog/WarOrderExchangeDetailsPopupWindow.java b/common/src/main/java/com/yunbao/common/dialog/WarOrderExchangeDetailsPopupWindow.java new file mode 100644 index 000000000..1d7ecbe70 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/WarOrderExchangeDetailsPopupWindow.java @@ -0,0 +1,88 @@ +package com.yunbao.common.dialog; + +import android.content.Context; +import android.view.View; +import android.widget.ImageView; +import android.widget.TextView; + +import androidx.annotation.NonNull; + +import com.lxj.xpopup.core.CenterPopupView; +import com.yunbao.common.R; +import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.utils.WordUtil; + +import java.math.BigDecimal; + +/** + * 战令兑换详情 + */ +public class WarOrderExchangeDetailsPopupWindow extends CenterPopupView { + private TextView orderLevel, pointExchange; + private String buyExp = "1"; + private int mPoint, mLimitQuantity, mScale; + private String mImageUrl; + private ImageView exchangeParticulars; + + /*** + * + * @param context + * @param limitQuantity 最大限制数量 + * @param point 自己的积分 + * @param scale 兑换比例 + * @param imageUrl 物品图片的url + */ + public WarOrderExchangeDetailsPopupWindow(@NonNull Context context, int limitQuantity, + int point, int scale, String imageUrl) { + super(context); + mPoint = point; + mLimitQuantity = limitQuantity; + mScale = scale; + mImageUrl = imageUrl; + } + + @Override + protected int getImplLayoutId() { + return R.layout.war_order_exchange_details_popup; + } + + // 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑 + @Override + protected void onCreate() { + super.onCreate(); + orderLevel = findViewById(R.id.tickets_plus_minus); + exchangeParticulars = findViewById(R.id.exchange_particulars); + pointExchange = findViewById(R.id.point_exchange); + orderLevel.setText(buyExp); + BigDecimal needExpBigDecimal = new BigDecimal(buyExp).multiply(new BigDecimal(mScale)); + pointExchange.setText(String.format(WordUtil.getString(R.string.point_exchange),needExpBigDecimal.toString())); + ImgLoader.display(getContext(), mImageUrl, exchangeParticulars); + findViewById(R.id.sub).setOnClickListener(new OnClickListener() { + @Override + public void onClick(View view) { + float exp = new BigDecimal(buyExp).floatValue(); + if (exp > 1) { + BigDecimal buyExpBigDecimal = new BigDecimal(buyExp).subtract(new BigDecimal("1")); + buyExp = String.valueOf(buyExpBigDecimal.intValue()); + orderLevel.setText(buyExp); + BigDecimal needExpBigDecimal = buyExpBigDecimal.multiply(new BigDecimal(mScale)); + pointExchange.setText(String.format(WordUtil.getString(R.string.point_exchange),needExpBigDecimal.toString())); + } + } + }); + findViewById(R.id.add).setOnClickListener(new OnClickListener() { + @Override + public void onClick(View view) { + int number = new BigDecimal(mScale).multiply(new BigDecimal(buyExp)).intValue(); + int exp = new BigDecimal(buyExp).intValue(); + if (exp < mLimitQuantity && number < mPoint) { + BigDecimal buyExpBigDecimal = new BigDecimal(buyExp).add(new BigDecimal("1")); + buyExp = String.valueOf(buyExpBigDecimal.intValue()); + orderLevel.setText(buyExp); + BigDecimal needExpBigDecimal = buyExpBigDecimal.multiply(new BigDecimal(mScale)); + pointExchange.setText(String.format(WordUtil.getString(R.string.point_exchange),needExpBigDecimal.toString())); + } + } + }); + } +} diff --git a/common/src/main/res/layout/war_order_exchange_details_popup.xml b/common/src/main/res/layout/war_order_exchange_details_popup.xml new file mode 100644 index 000000000..4e85c34a3 --- /dev/null +++ b/common/src/main/res/layout/war_order_exchange_details_popup.xml @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index 60edd53e5..aa22299a1 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -1413,5 +1413,8 @@ Limited ride And limited avatar frame 購買經驗值: 購買 本期活動已結束,請儘快領取未領取的獎勵積分可保留下次使用 + 兌換詳情 + %s(積分) 兌換 + 數量: diff --git a/main/src/main/java/com/yunbao/main/views/MainHomeCommunityViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainHomeCommunityViewHolder.java index 0a3fbc5b4..3dac09223 100644 --- a/main/src/main/java/com/yunbao/main/views/MainHomeCommunityViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainHomeCommunityViewHolder.java @@ -42,6 +42,7 @@ import com.yunbao.common.dialog.CinemaTicketPopupWindow; import com.yunbao.common.dialog.LiberalBattlePassPopupWindow; import com.yunbao.common.dialog.OrderLevelPopupWindow; import com.yunbao.common.dialog.PromotionElitePopupWindow; +import com.yunbao.common.dialog.WarOrderExchangeDetailsPopupWindow; import com.yunbao.common.event.JavascriptInterfaceEvent; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.LiveHttpUtil; @@ -236,7 +237,8 @@ public class MainHomeCommunityViewHolder extends AbsMainHomeChildViewHolder impl new XPopup.Builder(mContext) .enableDrag(false) .maxWidth(DeviceUtils.getScreenHeight((Activity) mContext) - DpUtil.dp2px(34)) - .asCustom(new OrderLevelPopupWindow(mContext,10,100,"9","900.00")) + .asCustom(new WarOrderExchangeDetailsPopupWindow(mContext,10,90000,10, + "https://downs.yaoulive.com/20230706/0572c0f694601f4d2695cd210effbe93.jpeg?imageView2/2/w/600/h/600")) .show(); } });