zhanling dengji

This commit is contained in:
18401019693 2023-12-18 16:53:37 +08:00
parent 215a2f8927
commit dc28a3d81e
3 changed files with 38 additions and 5 deletions

View File

@ -1,7 +1,7 @@
package com.yunbao.common.dialog; package com.yunbao.common.dialog;
import android.content.Context; import android.content.Context;
import android.widget.EditText; import android.view.View;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
@ -9,12 +9,16 @@ import androidx.annotation.NonNull;
import com.lxj.xpopup.core.CenterPopupView; import com.lxj.xpopup.core.CenterPopupView;
import com.yunbao.common.R; import com.yunbao.common.R;
import java.math.BigDecimal;
/** /**
* 战令等级 * 战令等级
*/ */
public class OrderLevelPopupWindow extends CenterPopupView { public class OrderLevelPopupWindow extends CenterPopupView {
private EditText orderLevel; private TextView orderLevel, orderLevelDiamond, balanceDiamond;
private TextView orderLevelDiamond,balanceDiamond;
private String buyExp = "100";
public OrderLevelPopupWindow(@NonNull Context context) { public OrderLevelPopupWindow(@NonNull Context context) {
super(context); super(context);
} }
@ -31,5 +35,31 @@ public class OrderLevelPopupWindow extends CenterPopupView {
orderLevel = findViewById(R.id.tickets_plus_minus); orderLevel = findViewById(R.id.tickets_plus_minus);
orderLevelDiamond = findViewById(R.id.order_level_diamond); orderLevelDiamond = findViewById(R.id.order_level_diamond);
balanceDiamond = findViewById(R.id.balance_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);
}
}
});
} }
} }

View File

@ -77,12 +77,14 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" /> android:layout_weight="1" />
<EditText <TextView
android:id="@+id/tickets_plus_minus" android:id="@+id/tickets_plus_minus"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="2" android:layout_weight="2"
android:gravity="center" android:gravity="center"
android:inputType="number"
android:imeOptions="actionSend"
android:background="@null" android:background="@null"
android:singleLine="true" android:singleLine="true"
android:text="0" android:text="0"

View File

@ -40,6 +40,7 @@ import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.bean.NativeCallbackModel; import com.yunbao.common.bean.NativeCallbackModel;
import com.yunbao.common.dialog.CinemaTicketPopupWindow; import com.yunbao.common.dialog.CinemaTicketPopupWindow;
import com.yunbao.common.dialog.OrderLevelPopupWindow; import com.yunbao.common.dialog.OrderLevelPopupWindow;
import com.yunbao.common.dialog.PromotionElitePopupWindow;
import com.yunbao.common.event.JavascriptInterfaceEvent; import com.yunbao.common.event.JavascriptInterfaceEvent;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.LiveHttpUtil; import com.yunbao.common.http.LiveHttpUtil;
@ -234,7 +235,7 @@ public class MainHomeCommunityViewHolder extends AbsMainHomeChildViewHolder impl
new XPopup.Builder(mContext) new XPopup.Builder(mContext)
.enableDrag(false) .enableDrag(false)
.maxWidth(DeviceUtils.getScreenHeight((Activity) mContext) - DpUtil.dp2px(34)) .maxWidth(DeviceUtils.getScreenHeight((Activity) mContext) - DpUtil.dp2px(34))
.asCustom(new OrderLevelPopupWindow(mContext)) .asCustom(new PromotionElitePopupWindow(mContext,"62,888","12,888"))
.show(); .show();
} }
}); });