From a8a1aa2e7151d22a7b1354e76ece02db71420173 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Thu, 18 Jan 2024 10:57:21 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=88=98=E4=BB=A4=E5=A5=96?= =?UTF-8?q?=E5=8A=B1=E5=88=97=E8=A1=A8=E7=9A=84=E6=B8=B2=E6=9F=93=20?= =?UTF-8?q?=E6=9B=B4=E6=94=B9=E6=88=98=E4=BB=A4=E8=8E=B7=E5=8F=96=E9=87=91?= =?UTF-8?q?=E5=B8=81=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/bean/BattlePassUserInfoBean.java | 23 +++++++++++++++ .../bean/LiveBattlePassRewardsBean.java | 13 +++++++++ .../common/dialog/OrderLevelPopupWindow.java | 28 +++++++++++++++---- .../yunbao/common/manager/IMLoginManager.java | 20 ++++++++++++- .../main/adapter/BattlePassRewardAdapter.java | 5 ++++ .../fragment/BattlePassMissionFragment.java | 1 - 6 files changed, 82 insertions(+), 8 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/bean/BattlePassUserInfoBean.java b/common/src/main/java/com/yunbao/common/bean/BattlePassUserInfoBean.java index f6fb0f17c..12ef62d04 100644 --- a/common/src/main/java/com/yunbao/common/bean/BattlePassUserInfoBean.java +++ b/common/src/main/java/com/yunbao/common/bean/BattlePassUserInfoBean.java @@ -173,4 +173,27 @@ public class BattlePassUserInfoBean extends BaseModel{ public void setMaxLevel(int maxLevel) { this.maxLevel = maxLevel; } + + @Override + public String toString() { + return "BattlePassUserInfoBean{" + + "uid='" + uid + '\'' + + ", points=" + points + + ", battlePassExp=" + battlePassExp + + ", battlePassUserRecords1=" + battlePassUserRecords1 + + ", battlePassUserRecords2=" + battlePassUserRecords2 + + ", battlePassUserRecords3=" + battlePassUserRecords3 + + ", level=" + level + + ", lastLevelExp=" + lastLevelExp + + ", nextLevelExp=" + nextLevelExp + + ", id='" + id + '\'' + + ", battlePassName='" + battlePassName + '\'' + + ", startTime='" + startTime + '\'' + + ", endTime='" + endTime + '\'' + + ", battlePassStatus=" + battlePassStatus + + ", maxLevelExp=" + maxLevelExp + + ", maxLevel=" + maxLevel + + ", live_battle_pass_type=" + live_battle_pass_type + + '}'; + } } diff --git a/common/src/main/java/com/yunbao/common/bean/LiveBattlePassRewardsBean.java b/common/src/main/java/com/yunbao/common/bean/LiveBattlePassRewardsBean.java index 942e5d34d..3deed7e93 100644 --- a/common/src/main/java/com/yunbao/common/bean/LiveBattlePassRewardsBean.java +++ b/common/src/main/java/com/yunbao/common/bean/LiveBattlePassRewardsBean.java @@ -158,5 +158,18 @@ public class LiveBattlePassRewardsBean extends BaseModel{ public void setReceived(int received) { this.received = received; } + + @Override + public String toString() { + return "LiveBattlePassReward{" + + "id=" + id + + ", liveBattlePassLevel=" + liveBattlePassLevel + + ", liveBattlePassTypeId=" + liveBattlePassTypeId + + ", rewardName='" + rewardName + '\'' + + ", imageUrl='" + imageUrl + '\'' + + ", lock=" + lock + + ", received=" + received + + '}'; + } } } 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 205ecac5f..0d64fa8c4 100644 --- a/common/src/main/java/com/yunbao/common/dialog/OrderLevelPopupWindow.java +++ b/common/src/main/java/com/yunbao/common/dialog/OrderLevelPopupWindow.java @@ -7,12 +7,15 @@ import android.widget.TextView; import androidx.annotation.NonNull; +import com.alibaba.fastjson.JSONObject; import com.lxj.xpopup.core.CenterPopupView; import com.yunbao.common.R; import com.yunbao.common.bean.BattlePassUserInfoBean; import com.yunbao.common.http.ResponseModel; import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.live.LiveNetManager; +import com.yunbao.common.interfaces.OnItemClickListener; +import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.common.views.weight.ViewClicksAntiShake; @@ -23,13 +26,14 @@ import java.math.BigDecimal; * 战令等级 经验 */ public class OrderLevelPopupWindow extends CenterPopupView { - private TextView orderLevel, orderLevelDiamond, balanceDiamond, current,expText; + private TextView orderLevel, orderLevelDiamond, balanceDiamond, current, expText; private int currentExperience, totalExperience;//当前经验,全部经验 private String buyExp = "100", currentLevel, balance; private ProgressBar progressBar; private OrderLevelCallback orderLevelCallback; private long maxExp; private BattlePassUserInfoBean userInfoBean; + public OrderLevelPopupWindow(@NonNull Context context, BattlePassUserInfoBean userInfoBean, int mCurrentExperience, int mTotalExperience, String mCurrentLevel, String mBalance, long maxExp, OrderLevelCallback mOrderLevelCallback) { @@ -39,7 +43,7 @@ public class OrderLevelPopupWindow extends CenterPopupView { totalExperience = mTotalExperience; currentLevel = mCurrentLevel; balance = mBalance; - this.maxExp=maxExp; + this.maxExp = maxExp; orderLevelCallback = mOrderLevelCallback; } @@ -85,8 +89,8 @@ public class OrderLevelPopupWindow extends CenterPopupView { buyExp = String.valueOf(buyExpBigDecimal.intValue()); orderLevelDiamond.setText(String.valueOf(buyExpBigDecimal.floatValue())); orderLevel.setText(buyExp); - }else if(exp>=maxExp){ - ToastUtil.show(WordUtil.isNewZh()?"经验已滿":"Experience full"); + } else if (exp >= maxExp) { + ToastUtil.show(WordUtil.isNewZh() ? "经验已滿" : "Experience full"); } } @@ -107,18 +111,30 @@ public class OrderLevelPopupWindow extends CenterPopupView { if (orderLevelCallback != null) { orderLevelCallback.onCallback(data.getData().getCode(), data.getMsg()); - }dialog.dismiss(); + } + dialog.dismiss(); } @Override public void onError(String error) { if (orderLevelCallback != null) { orderLevelCallback.onCallback(102, error); - } dialog.dismiss(); + } + dialog.dismiss(); } }); } }); + IMLoginManager.get(getContext()) + .updateUserCoin(new OnItemClickListener() { + @Override + public void onItemClick(JSONObject bean, int position) { + if (bean != null) { + balance = bean.getString("coin"); + balanceDiamond.setText(balance); + } + } + }); } public interface OrderLevelCallback { diff --git a/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java index c0fd33ebb..cb7684922 100644 --- a/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java +++ b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java @@ -17,6 +17,7 @@ import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.event.DataUserInfoEvent; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpClient; +import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.manager.base.BaseCacheManager; import com.yunbao.common.manager.imrongcloud.MessageIMManager; import com.yunbao.common.manager.imrongcloud.RongcloudIMManager; @@ -527,5 +528,22 @@ public class IMLoginManager extends BaseCacheManager { } }); } - + public void updateUserCoin(OnItemClickListener listener){ + HttpClient.getInstance().get("User.getUserBalance", "User.getUserBalance") + .execute(new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if (code == 0) { + JSONObject obj = JSONObject.parseObject(info[0]); + listener.onItemClick(obj,0); + String golds = obj.getString("gold"); + String coins = obj.getString("coin"); + String yuanbaos = obj.getString("yuanbao"); + userInfo.setCoin(obj.getLong("coin")); + userInfo.setGold(obj.getLong("gold")); + userInfo.setYuanbao(yuanbaos); + } + } + }); + } } diff --git a/main/src/main/java/com/yunbao/main/adapter/BattlePassRewardAdapter.java b/main/src/main/java/com/yunbao/main/adapter/BattlePassRewardAdapter.java index 1db688217..f862fb108 100644 --- a/main/src/main/java/com/yunbao/main/adapter/BattlePassRewardAdapter.java +++ b/main/src/main/java/com/yunbao/main/adapter/BattlePassRewardAdapter.java @@ -6,6 +6,7 @@ import android.annotation.SuppressLint; import android.app.Activity; import android.app.Dialog; import android.content.Context; +import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -165,6 +166,9 @@ public class BattlePassRewardAdapter extends RecyclerView.Adapter { lv.setText("V" + reward.getLiveBattlePassLevel()); + lv.setTag(reward); view.setText(reward.getRewardName()); }), tab1Title, tab2Title, tab3Title); getAllView(((reward, view) -> { diff --git a/main/src/main/java/com/yunbao/main/fragment/BattlePassMissionFragment.java b/main/src/main/java/com/yunbao/main/fragment/BattlePassMissionFragment.java index 6aea5d641..dd55d1c92 100644 --- a/main/src/main/java/com/yunbao/main/fragment/BattlePassMissionFragment.java +++ b/main/src/main/java/com/yunbao/main/fragment/BattlePassMissionFragment.java @@ -112,7 +112,6 @@ public class BattlePassMissionFragment extends BaseFragment { } ToastUtil.show(msg); Bus.get().post(new BattlePassTypeEvent(0)); - IMLoginManager.get(getContext()).updateUserCoin(); updateData(); } }