From dc28a3d81ec42a226d3f073e962147312ae1f8f2 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Mon, 18 Dec 2023 16:53:37 +0800 Subject: [PATCH] zhanling dengji --- .../common/dialog/OrderLevelPopupWindow.java | 36 +++++++++++++++++-- .../src/main/res/layout/order_level_popup.xml | 4 ++- .../views/MainHomeCommunityViewHolder.java | 3 +- 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/dialog/OrderLevelPopupWindow.java b/common/src/main/java/com/yunbao/common/dialog/OrderLevelPopupWindow.java index 50cc3c060..5c3c94455 100644 --- a/common/src/main/java/com/yunbao/common/dialog/OrderLevelPopupWindow.java +++ b/common/src/main/java/com/yunbao/common/dialog/OrderLevelPopupWindow.java @@ -1,7 +1,7 @@ package com.yunbao.common.dialog; import android.content.Context; -import android.widget.EditText; +import android.view.View; import android.widget.TextView; import androidx.annotation.NonNull; @@ -9,12 +9,16 @@ import androidx.annotation.NonNull; import com.lxj.xpopup.core.CenterPopupView; import com.yunbao.common.R; +import java.math.BigDecimal; + /** * 战令等级 */ public class OrderLevelPopupWindow extends CenterPopupView { - private EditText orderLevel; - private TextView orderLevelDiamond,balanceDiamond; + private TextView orderLevel, orderLevelDiamond, balanceDiamond; + + private String buyExp = "100"; + public OrderLevelPopupWindow(@NonNull Context context) { super(context); } @@ -31,5 +35,31 @@ public class OrderLevelPopupWindow extends CenterPopupView { orderLevel = findViewById(R.id.tickets_plus_minus); orderLevelDiamond = findViewById(R.id.order_level_diamond); balanceDiamond = findViewById(R.id.balance_diamond); + orderLevel.setText(buyExp); + findViewById(R.id.sub).setOnClickListener(new OnClickListener() { + @Override + public void onClick(View view) { + float exp = new BigDecimal(buyExp).floatValue(); + if (exp > 100) { + BigDecimal buyExpBigDecimal = new BigDecimal(buyExp).subtract(new BigDecimal("100")); + buyExp = String.valueOf(buyExpBigDecimal.intValue()); + orderLevelDiamond.setText(String.valueOf(buyExpBigDecimal.floatValue())); + orderLevel.setText(buyExp); + } + } + }); + findViewById(R.id.add).setOnClickListener(new OnClickListener() { + @Override + public void onClick(View view) { + float exp = new BigDecimal(buyExp).floatValue(); + if (exp < 10000) { + BigDecimal buyExpBigDecimal = new BigDecimal(buyExp).add(new BigDecimal("100")); + buyExp = String.valueOf(buyExpBigDecimal.intValue()); + orderLevelDiamond.setText(String.valueOf(buyExpBigDecimal.floatValue())); + orderLevel.setText(buyExp); + } + + } + }); } } diff --git a/common/src/main/res/layout/order_level_popup.xml b/common/src/main/res/layout/order_level_popup.xml index c3b5da737..0f0f7644f 100644 --- a/common/src/main/res/layout/order_level_popup.xml +++ b/common/src/main/res/layout/order_level_popup.xml @@ -77,12 +77,14 @@ android:layout_height="match_parent" android:layout_weight="1" /> -