兌換詳情弹窗
This commit is contained in:
parent
d415efde35
commit
1495bfee99
@ -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();
|
||||
}
|
||||
});
|
||||
|
@ -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()));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
102
common/src/main/res/layout/war_order_exchange_details_popup.xml
Normal file
102
common/src/main/res/layout/war_order_exchange_details_popup.xml
Normal file
@ -0,0 +1,102 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="282dp"
|
||||
android:layout_marginStart="17dp"
|
||||
android:layout_marginEnd="17dp"
|
||||
android:background="@drawable/background_order_dialog"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/war_order_close"
|
||||
android:layout_width="19dp"
|
||||
android:layout_height="19dp"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="14dp"
|
||||
android:src="@mipmap/icon_sud_rule_close" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="@string/exchange_particulars"
|
||||
android:textColor="#0D21B2"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/exchange_particulars"
|
||||
android:layout_width="99dp"
|
||||
android:layout_height="99dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="19dp"
|
||||
android:src="@drawable/background_wish_item" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="20dp"
|
||||
android:gravity="center">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/point_exchange_number"
|
||||
android:textColor="#0D21B2"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="90dp"
|
||||
android:layout_height="25dp"
|
||||
android:background="@mipmap/backgroud_tickets_plus_minus">
|
||||
|
||||
<View
|
||||
android:id="@+id/sub"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tickets_plus_minus"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="2"
|
||||
android:background="@null"
|
||||
android:gravity="center"
|
||||
android:imeOptions="actionSend"
|
||||
android:inputType="number"
|
||||
android:singleLine="true"
|
||||
android:text="0"
|
||||
android:textColor="#000000"
|
||||
android:textSize="12dp" />
|
||||
|
||||
<View
|
||||
android:id="@+id/add"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="140dp"
|
||||
android:layout_height="38dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="17dp"
|
||||
android:background="@mipmap/button_buying_experience"
|
||||
android:gravity="center_horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/point_exchange"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:text="@string/point_exchange"
|
||||
android:textColor="#E03600"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
@ -1413,5 +1413,8 @@ Limited ride And limited avatar frame</string>
|
||||
<string name="buying_experience_point">購買經驗值:</string>
|
||||
<string name="buying_experience">購買</string>
|
||||
<string name="this_activity_is_over">本期活動已結束,請儘快領取未領取的獎勵積分可保留下次使用</string>
|
||||
<string name="exchange_particulars">兌換詳情</string>
|
||||
<string name="point_exchange">%s(積分) 兌換</string>
|
||||
<string name="point_exchange_number">數量:</string>
|
||||
|
||||
</resources>
|
||||
|
@ -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();
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user