调整战令奖励列表的渲染

更改战令获取金币接口
This commit is contained in:
zlzw 2024-01-18 10:57:21 +08:00
parent 2857127285
commit a8a1aa2e71
6 changed files with 82 additions and 8 deletions

View File

@ -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 +
'}';
}
}

View File

@ -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 +
'}';
}
}
}

View File

@ -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<JSONObject>() {
@Override
public void onItemClick(JSONObject bean, int position) {
if (bean != null) {
balance = bean.getString("coin");
balanceDiamond.setText(balance);
}
}
});
}
public interface OrderLevelCallback {

View File

@ -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<JSONObject> 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);
}
}
});
}
}

View File

@ -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<BattlePassRewa
setVisibility(View.VISIBLE, -1, tab1Layout, tab2Layout, tab3Layout);
setVisibility(View.VISIBLE, -1, tab1, tab2, tab3);
setVisibility(View.VISIBLE, -1, tab1Mask, tab2Mask, tab3Mask);
ConstraintLayout.LayoutParams _params = (ConstraintLayout.LayoutParams) line.getLayoutParams();
_params.bottomMargin = DpUtil.dp2px(0);
line.setLayoutParams(_params);
line.setVisibility(View.GONE);
point.setVisibility(View.GONE);
@ -200,6 +204,7 @@ public class BattlePassRewardAdapter extends RecyclerView.Adapter<BattlePassRewa
}), tab1Unlock, tab2Unlock, tab3Unlock);
getAllView(((reward, view) -> {
lv.setText("V" + reward.getLiveBattlePassLevel());
lv.setTag(reward);
view.setText(reward.getRewardName());
}), tab1Title, tab2Title, tab3Title);
getAllView(((reward, view) -> {

View File

@ -112,7 +112,6 @@ public class BattlePassMissionFragment extends BaseFragment {
}
ToastUtil.show(msg);
Bus.get().post(new BattlePassTypeEvent(0));
IMLoginManager.get(getContext()).updateUserCoin();
updateData();
}
}