调整战令接口
调整战令购买等级最大值 新增战令统计直播间发送消息接口
This commit is contained in:
parent
44601c74b4
commit
fbb801bf62
@ -29,6 +29,10 @@ public class BattlePassUserInfoBean extends BaseModel{
|
|||||||
private String endTime;
|
private String endTime;
|
||||||
@SerializedName("battle_pass_status")
|
@SerializedName("battle_pass_status")
|
||||||
private boolean battlePassStatus;
|
private boolean battlePassStatus;
|
||||||
|
@SerializedName("max_level_exp")
|
||||||
|
private long maxLevelExp;
|
||||||
|
@SerializedName("max_level")
|
||||||
|
private int maxLevel;
|
||||||
|
|
||||||
private List<LiveBattlePassRewardsBean.BattlePassType> live_battle_pass_type;
|
private List<LiveBattlePassRewardsBean.BattlePassType> live_battle_pass_type;
|
||||||
|
|
||||||
@ -153,4 +157,20 @@ public class BattlePassUserInfoBean extends BaseModel{
|
|||||||
public void setBattlePassStatus(boolean battlePassStatus) {
|
public void setBattlePassStatus(boolean battlePassStatus) {
|
||||||
this.battlePassStatus = battlePassStatus;
|
this.battlePassStatus = battlePassStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long getMaxLevelExp() {
|
||||||
|
return maxLevelExp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxLevelExp(long maxLevelExp) {
|
||||||
|
this.maxLevelExp = maxLevelExp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaxLevel() {
|
||||||
|
return maxLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxLevel(int maxLevel) {
|
||||||
|
this.maxLevel = maxLevel;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,8 @@ import com.yunbao.common.R;
|
|||||||
import com.yunbao.common.http.ResponseModel;
|
import com.yunbao.common.http.ResponseModel;
|
||||||
import com.yunbao.common.http.base.HttpCallback;
|
import com.yunbao.common.http.base.HttpCallback;
|
||||||
import com.yunbao.common.http.live.LiveNetManager;
|
import com.yunbao.common.http.live.LiveNetManager;
|
||||||
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
|
import com.yunbao.common.utils.WordUtil;
|
||||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@ -25,15 +27,17 @@ public class OrderLevelPopupWindow extends CenterPopupView {
|
|||||||
private String buyExp = "100", currentLevel, balance;
|
private String buyExp = "100", currentLevel, balance;
|
||||||
private ProgressBar progressBar;
|
private ProgressBar progressBar;
|
||||||
private OrderLevelCallback orderLevelCallback;
|
private OrderLevelCallback orderLevelCallback;
|
||||||
|
private long maxExp;
|
||||||
|
|
||||||
public OrderLevelPopupWindow(@NonNull Context context,
|
public OrderLevelPopupWindow(@NonNull Context context,
|
||||||
int mCurrentExperience, int mTotalExperience,
|
int mCurrentExperience, int mTotalExperience,
|
||||||
String mCurrentLevel, String mBalance, OrderLevelCallback mOrderLevelCallback) {
|
String mCurrentLevel, String mBalance,long maxExp, OrderLevelCallback mOrderLevelCallback) {
|
||||||
super(context);
|
super(context);
|
||||||
currentExperience = mCurrentExperience;
|
currentExperience = mCurrentExperience;
|
||||||
totalExperience = mTotalExperience;
|
totalExperience = mTotalExperience;
|
||||||
currentLevel = mCurrentLevel;
|
currentLevel = mCurrentLevel;
|
||||||
balance = mBalance;
|
balance = mBalance;
|
||||||
|
this.maxExp=maxExp;
|
||||||
orderLevelCallback = mOrderLevelCallback;
|
orderLevelCallback = mOrderLevelCallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,11 +76,13 @@ public class OrderLevelPopupWindow extends CenterPopupView {
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
float exp = new BigDecimal(buyExp).floatValue();
|
float exp = new BigDecimal(buyExp).floatValue();
|
||||||
if (exp < 10000) {
|
if (exp < maxExp && exp < 10000) {
|
||||||
BigDecimal buyExpBigDecimal = new BigDecimal(buyExp).add(new BigDecimal("100"));
|
BigDecimal buyExpBigDecimal = new BigDecimal(buyExp).add(new BigDecimal("100"));
|
||||||
buyExp = String.valueOf(buyExpBigDecimal.intValue());
|
buyExp = String.valueOf(buyExpBigDecimal.intValue());
|
||||||
orderLevelDiamond.setText(String.valueOf(buyExpBigDecimal.floatValue()));
|
orderLevelDiamond.setText(String.valueOf(buyExpBigDecimal.floatValue()));
|
||||||
orderLevel.setText(buyExp);
|
orderLevel.setText(buyExp);
|
||||||
|
}else if(exp>=maxExp){
|
||||||
|
ToastUtil.show(WordUtil.isNewZh()?"经验已滿":"Experience full");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1131,4 +1131,6 @@ public interface PDLiveApi {
|
|||||||
Observable<ResponseModel<List<BattlePassPoints>>> getBattlePassPoints();
|
Observable<ResponseModel<List<BattlePassPoints>>> getBattlePassPoints();
|
||||||
@GET("/api/public/?service=Livebattlepass.battlePassRule")
|
@GET("/api/public/?service=Livebattlepass.battlePassRule")
|
||||||
Observable<ResponseModel<String>> battlePassRule();
|
Observable<ResponseModel<String>> battlePassRule();
|
||||||
|
@GET("/api/public/?service=Livebattlepass.addChatCount")
|
||||||
|
Observable<ResponseModel<List<BaseModel>>> addChatCount();
|
||||||
}
|
}
|
||||||
|
@ -2757,7 +2757,27 @@ public class LiveNetManager {
|
|||||||
}
|
}
|
||||||
}).isDisposed();
|
}).isDisposed();
|
||||||
}
|
}
|
||||||
|
public void addChatCount(HttpCallback<HttpCallbackModel> callback) {
|
||||||
|
API.get().pdLiveApi(mContext)
|
||||||
|
.addChatCount()
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(responseModel -> {
|
||||||
|
if (callback != null) {
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onSuccess(new HttpCallbackModel(responseModel.getData().getCode(), responseModel.getData().getMsg()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, new Consumer<Throwable>() {
|
||||||
|
@Override
|
||||||
|
public void accept(Throwable throwable) throws Exception {
|
||||||
|
throwable.printStackTrace();
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onError(mContext.getString(R.string.net_error));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).isDisposed();
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 直播间取消网络请求
|
* 直播间取消网络请求
|
||||||
*/
|
*/
|
||||||
|
@ -6,10 +6,12 @@ import android.util.Log;
|
|||||||
import com.yunbao.common.CommonAppConfig;
|
import com.yunbao.common.CommonAppConfig;
|
||||||
import com.yunbao.common.CommonAppContext;
|
import com.yunbao.common.CommonAppContext;
|
||||||
import com.yunbao.common.Constants;
|
import com.yunbao.common.Constants;
|
||||||
|
import com.yunbao.common.bean.HttpCallbackModel;
|
||||||
import com.yunbao.common.bean.IMLoginModel;
|
import com.yunbao.common.bean.IMLoginModel;
|
||||||
import com.yunbao.common.bean.UserBean;
|
import com.yunbao.common.bean.UserBean;
|
||||||
import com.yunbao.common.http.HttpCallback;
|
import com.yunbao.common.http.HttpCallback;
|
||||||
import com.yunbao.common.http.LiveHttpUtil;
|
import com.yunbao.common.http.LiveHttpUtil;
|
||||||
|
import com.yunbao.common.http.live.LiveNetManager;
|
||||||
import com.yunbao.common.manager.IMLoginManager;
|
import com.yunbao.common.manager.IMLoginManager;
|
||||||
import com.yunbao.common.utils.ToastUtil;
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
import com.yunbao.common.utils.WordUtil;
|
import com.yunbao.common.utils.WordUtil;
|
||||||
@ -128,6 +130,18 @@ public class SocketRyChatUtil {
|
|||||||
if (SocketRyClient.mSocketHandler != null) {
|
if (SocketRyClient.mSocketHandler != null) {
|
||||||
SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
|
SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
|
||||||
}
|
}
|
||||||
|
LiveNetManager.get(CommonAppContext.sInstance)
|
||||||
|
.addChatCount(new com.yunbao.common.http.base.HttpCallback<HttpCallbackModel>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(HttpCallbackModel data) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(String error) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -41,6 +41,7 @@ import com.yunbao.main.event.BattlePassTypeEvent;
|
|||||||
import com.yunbao.main.fragment.BattlePassExchangeFragment;
|
import com.yunbao.main.fragment.BattlePassExchangeFragment;
|
||||||
import com.yunbao.main.fragment.BattlePassMissionFragment;
|
import com.yunbao.main.fragment.BattlePassMissionFragment;
|
||||||
import com.yunbao.main.fragment.BattlePassRewardFragment;
|
import com.yunbao.main.fragment.BattlePassRewardFragment;
|
||||||
|
import com.yunbao.main.interfaces.BattlePassUserInfoListener;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.Subscribe;
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
import org.greenrobot.eventbus.ThreadMode;
|
import org.greenrobot.eventbus.ThreadMode;
|
||||||
@ -95,9 +96,9 @@ public class BattlePassActivity extends AbsActivity {
|
|||||||
tab3 = findViewById(R.id.tab_3);
|
tab3 = findViewById(R.id.tab_3);
|
||||||
expText = findViewById(R.id.exp_text);
|
expText = findViewById(R.id.exp_text);
|
||||||
viewPager = findViewById(R.id.context_layout);
|
viewPager = findViewById(R.id.context_layout);
|
||||||
fragments.add(new BattlePassRewardFragment());
|
fragments.add(new BattlePassRewardFragment(() -> data));
|
||||||
fragments.add(new BattlePassMissionFragment());
|
fragments.add(new BattlePassMissionFragment(() -> data));
|
||||||
fragments.add(new BattlePassExchangeFragment());
|
fragments.add(new BattlePassExchangeFragment(() -> data));
|
||||||
viewPager.setAdapter(new FragmentStateAdapter(this) {
|
viewPager.setAdapter(new FragmentStateAdapter(this) {
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
@ -191,7 +192,8 @@ public class BattlePassActivity extends AbsActivity {
|
|||||||
data.getEndTime()
|
data.getEndTime()
|
||||||
));
|
));
|
||||||
levelView.setText("Lv." + data.getLevel());
|
levelView.setText("Lv." + data.getLevel());
|
||||||
expText.setText(data.getBattlePassExp() + "/" + data.getNextLevelExp());
|
expText.setText(data.getBattlePassExp() + "/" +
|
||||||
|
(data.getNextLevelExp() == 0 ? data.getBattlePassExp() : data.getNextLevelExp()));
|
||||||
levelProgressView.setMax(data.getNextLevelExp());
|
levelProgressView.setMax(data.getNextLevelExp());
|
||||||
levelProgressView.setMin(data.getLastLevelExp());
|
levelProgressView.setMin(data.getLastLevelExp());
|
||||||
levelProgressView.setProgress(data.getBattlePassExp());
|
levelProgressView.setProgress(data.getBattlePassExp());
|
||||||
|
@ -148,6 +148,7 @@ public class BattlePassMissionAdapter extends RecyclerView.Adapter<BattlePassMis
|
|||||||
submit.setTag(SUBMIT_DEF);
|
submit.setTag(SUBMIT_DEF);
|
||||||
submit.setText(WordUtil.getNewString(R.string.battlepass_mission_submit_btn_unfinished));
|
submit.setText(WordUtil.getNewString(R.string.battlepass_mission_submit_btn_unfinished));
|
||||||
submit.setBackgroundResource(R.drawable.bg_battlepass_mission_btn_unfinished);
|
submit.setBackgroundResource(R.drawable.bg_battlepass_mission_btn_unfinished);
|
||||||
|
submit.setTextColor(Color.parseColor("#FFFFFF"));
|
||||||
if (task.isBuy()) {
|
if (task.isBuy()) {
|
||||||
submit.setText(WordUtil.getNewString(R.string.battlepass_mission_submit_btn_buy));
|
submit.setText(WordUtil.getNewString(R.string.battlepass_mission_submit_btn_buy));
|
||||||
submit.setBackgroundResource(R.drawable.bg_battlepass_mission_btn_buy);
|
submit.setBackgroundResource(R.drawable.bg_battlepass_mission_btn_buy);
|
||||||
|
@ -117,43 +117,57 @@ public class BattlePassRewardAdapter extends RecyclerView.Adapter<BattlePassRewa
|
|||||||
tab3Received = itemView.findViewById(R.id.tab_3_item_received);
|
tab3Received = itemView.findViewById(R.id.tab_3_item_received);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int level = 0;
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
public void setData(Map<Integer, LiveBattlePassRewardsBean.LiveBattlePassReward> data, int position) {
|
public void setData(Map<Integer, LiveBattlePassRewardsBean.LiveBattlePassReward> data, int position) {
|
||||||
this.data = data;
|
this.data = data;
|
||||||
|
for (LiveBattlePassRewardsBean.LiveBattlePassReward value : data.values()) {
|
||||||
|
if (value.getId() > 0) {
|
||||||
|
level = value.getLiveBattlePassLevel();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (position == 0) {
|
if (position == 0) {
|
||||||
ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) lineBg.getLayoutParams();
|
ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) lineBg.getLayoutParams();
|
||||||
ConstraintLayout.LayoutParams params1 = (ConstraintLayout.LayoutParams) line.getLayoutParams();
|
ConstraintLayout.LayoutParams params1 = (ConstraintLayout.LayoutParams) line.getLayoutParams();
|
||||||
params.topMargin = DpUtil.dp2px(3);
|
params.topMargin = DpUtil.dp2px(3);
|
||||||
params1.topMargin = DpUtil.dp2px(3);
|
params1.topMargin = DpUtil.dp2px(3);
|
||||||
|
} else {
|
||||||
|
ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) lineBg.getLayoutParams();
|
||||||
|
ConstraintLayout.LayoutParams params1 = (ConstraintLayout.LayoutParams) line.getLayoutParams();
|
||||||
|
params.topMargin = DpUtil.dp2px(0);
|
||||||
|
params1.topMargin = DpUtil.dp2px(0);
|
||||||
}
|
}
|
||||||
setVisibility(View.VISIBLE, -1, tab1Mask, tab2Mask, tab3Mask);
|
|
||||||
setVisibility(View.GONE, -1, tab1Unlock, tab1Unlock, tab1Unlock);
|
setVisibility(View.GONE, -1, tab1Unlock, tab1Unlock, tab1Unlock);
|
||||||
setVisibility(View.GONE, -1, tab1Subscript, tab2Subscript, tab3Subscript);
|
setVisibility(View.GONE, -1, tab1Subscript, tab2Subscript, tab3Subscript);
|
||||||
|
setVisibility(View.VISIBLE, -1, tab1Layout, tab2Layout, tab3Layout);
|
||||||
|
setVisibility(View.VISIBLE, -1, tab1, tab2, tab3);
|
||||||
|
setVisibility(View.VISIBLE, -1, tab1Mask, tab2Mask, tab3Mask);
|
||||||
|
|
||||||
line.setVisibility(View.GONE);
|
line.setVisibility(View.GONE);
|
||||||
point.setVisibility(View.GONE);
|
point.setVisibility(View.GONE);
|
||||||
if (userLevel > (position + 1) && userLevel < mList.size()) {
|
if (userLevel > level && userLevel < userType.getMaxLevel()) {
|
||||||
setVisibility(View.GONE, -1, tab1Mask, tab2Mask, tab3Mask);
|
setVisibility(View.GONE, -1, tab1Mask, tab2Mask, tab3Mask);
|
||||||
point.setVisibility(View.GONE);
|
point.setVisibility(View.GONE);
|
||||||
line.setVisibility(View.VISIBLE);
|
line.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
if (userLevel == (position + 1) && userLevel < mList.size()) {
|
if (userLevel == level && userLevel < userType.getMaxLevel()) {
|
||||||
setVisibility(View.GONE, -1, tab1Mask, tab2Mask, tab3Mask);
|
setVisibility(View.GONE, -1, tab1Mask, tab2Mask, tab3Mask);
|
||||||
ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) line.getLayoutParams();
|
ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) line.getLayoutParams();
|
||||||
params.bottomMargin = DpUtil.dp2px(70);
|
params.bottomMargin = DpUtil.dp2px(70);
|
||||||
line.setVisibility(View.VISIBLE);
|
line.setVisibility(View.VISIBLE);
|
||||||
point.setVisibility(View.VISIBLE);
|
point.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
if (userLevel >= mList.size()) {
|
if (userLevel >= userType.getMaxLevel()) {
|
||||||
setVisibility(View.GONE, -1, tab1Mask, tab2Mask, tab3Mask);
|
setVisibility(View.GONE, -1, tab1Mask, tab2Mask, tab3Mask);
|
||||||
line.setVisibility(View.VISIBLE);
|
line.setVisibility(View.VISIBLE);
|
||||||
point.setVisibility(View.GONE);
|
point.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
lv.setText("V" + (position + 1));
|
|
||||||
getAllView((reward, view) -> ImgLoader.display(mContext, reward.getImageUrl(), view), tab1, tab2, tab3);
|
getAllView((reward, view) -> ImgLoader.display(mContext, reward.getImageUrl(), view), tab1, tab2, tab3);
|
||||||
getAllView(((reward, view) -> {
|
getAllView(((reward, view) -> {
|
||||||
if (userLevel < (position + 1)) {
|
if (userLevel < level) {
|
||||||
view.setVisibility(View.GONE);
|
view.setVisibility(View.GONE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -164,6 +178,7 @@ public class BattlePassRewardAdapter extends RecyclerView.Adapter<BattlePassRewa
|
|||||||
}
|
}
|
||||||
}), tab1Unlock, tab2Unlock, tab3Unlock);
|
}), tab1Unlock, tab2Unlock, tab3Unlock);
|
||||||
getAllView(((reward, view) -> {
|
getAllView(((reward, view) -> {
|
||||||
|
lv.setText("V" + reward.getLiveBattlePassLevel());
|
||||||
view.setText(reward.getRewardName());
|
view.setText(reward.getRewardName());
|
||||||
}), tab1Title, tab2Title, tab3Title);
|
}), tab1Title, tab2Title, tab3Title);
|
||||||
getAllView(((reward, view) -> {
|
getAllView(((reward, view) -> {
|
||||||
@ -183,33 +198,34 @@ public class BattlePassRewardAdapter extends RecyclerView.Adapter<BattlePassRewa
|
|||||||
}), tab1, tab2, tab3);
|
}), tab1, tab2, tab3);
|
||||||
|
|
||||||
}
|
}
|
||||||
private void getReward(LiveBattlePassRewardsBean.LiveBattlePassReward reward){
|
|
||||||
if(userLevel<reward.getLiveBattlePassLevel()){
|
private void getReward(LiveBattlePassRewardsBean.LiveBattlePassReward reward) {
|
||||||
|
if (userLevel < reward.getLiveBattlePassLevel()) {
|
||||||
ToastUtil.show(WordUtil.getNewString(R.string.battlepass_reward_item_lock));
|
ToastUtil.show(WordUtil.getNewString(R.string.battlepass_reward_item_lock));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(reward.getLock()==1){
|
if (reward.getLock() == 1) {
|
||||||
//ToastUtil.show("锁了");
|
//ToastUtil.show("锁了");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(reward.getReceived()==2){
|
if (reward.getReceived() == 2) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
switch (reward.getLiveBattlePassTypeId()){
|
switch (reward.getLiveBattlePassTypeId()) {
|
||||||
case 1:
|
case 1:
|
||||||
if(userType.getBattlePassUserRecords1()==1){
|
if (userType.getBattlePassUserRecords1() == 1) {
|
||||||
ToastUtil.show("没购买");
|
ToastUtil.show("没购买");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if(userType.getBattlePassUserRecords2()==1){
|
if (userType.getBattlePassUserRecords2() == 1) {
|
||||||
ToastUtil.show("没购买");
|
ToastUtil.show("没购买");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
if(userType.getBattlePassUserRecords3()==1){
|
if (userType.getBattlePassUserRecords3() == 1) {
|
||||||
ToastUtil.show("没购买");
|
ToastUtil.show("没购买");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -221,15 +237,15 @@ public class BattlePassRewardAdapter extends RecyclerView.Adapter<BattlePassRewa
|
|||||||
@Override
|
@Override
|
||||||
public void onSuccess(HttpCallbackModel data) {
|
public void onSuccess(HttpCallbackModel data) {
|
||||||
ToastUtil.show(WordUtil.getNewString(R.string.battlepass_reward_item_get));
|
ToastUtil.show(WordUtil.getNewString(R.string.battlepass_reward_item_get));
|
||||||
if(onItemClickListener!=null){
|
if (onItemClickListener != null) {
|
||||||
onItemClickListener.onItemClick(reward,reward.getId());
|
onItemClickListener.onItemClick(reward, reward.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(String error) {
|
public void onError(String error) {
|
||||||
if(onItemClickListener!=null){
|
if (onItemClickListener != null) {
|
||||||
onItemClickListener.onItemClick(reward,reward.getId());
|
onItemClickListener.onItemClick(reward, reward.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -254,6 +270,7 @@ public class BattlePassRewardAdapter extends RecyclerView.Adapter<BattlePassRewa
|
|||||||
private <T> void getView(int type, ViewData<T> viewData, T... views) {
|
private <T> void getView(int type, ViewData<T> viewData, T... views) {
|
||||||
if (data.containsKey(type) && data.get(type) != null && Objects.requireNonNull(data.get(type)).getId() != 0) {
|
if (data.containsKey(type) && data.get(type) != null && Objects.requireNonNull(data.get(type)).getId() != 0) {
|
||||||
viewData.onData(data.get(type), views[type - 1]);
|
viewData.onData(data.get(type), views[type - 1]);
|
||||||
|
setVisibility(View.VISIBLE, type - 1, tab1Layout, tab2Layout, tab3Layout);
|
||||||
} else {
|
} else {
|
||||||
setVisibility(View.INVISIBLE, type - 1, tab1Layout, tab2Layout, tab3Layout);
|
setVisibility(View.INVISIBLE, type - 1, tab1Layout, tab2Layout, tab3Layout);
|
||||||
}
|
}
|
||||||
|
@ -23,12 +23,18 @@ import com.yunbao.main.activity.BattlePassActivity;
|
|||||||
import com.yunbao.main.adapter.BattlePassExchangeAdapter;
|
import com.yunbao.main.adapter.BattlePassExchangeAdapter;
|
||||||
import com.yunbao.main.adapter.BattlePassMissionAdapter;
|
import com.yunbao.main.adapter.BattlePassMissionAdapter;
|
||||||
import com.yunbao.main.event.BattlePassTypeEvent;
|
import com.yunbao.main.event.BattlePassTypeEvent;
|
||||||
|
import com.yunbao.main.interfaces.BattlePassUserInfoListener;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class BattlePassExchangeFragment extends BaseFragment {
|
public class BattlePassExchangeFragment extends BaseFragment {
|
||||||
RecyclerView mRecyclerView;
|
RecyclerView mRecyclerView;
|
||||||
BattlePassExchangeAdapter adapter;
|
BattlePassExchangeAdapter adapter;
|
||||||
|
BattlePassUserInfoListener userInfoListener;
|
||||||
|
|
||||||
|
public BattlePassExchangeFragment(BattlePassUserInfoListener userInfoListener) {
|
||||||
|
this.userInfoListener = userInfoListener;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View createView(LayoutInflater inflater, ViewGroup container) {
|
public View createView(LayoutInflater inflater, ViewGroup container) {
|
||||||
@ -46,9 +52,8 @@ public class BattlePassExchangeFragment extends BaseFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateData() {
|
protected void loadData() {
|
||||||
super.updateData();
|
|
||||||
loadData();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -65,23 +70,14 @@ public class BattlePassExchangeFragment extends BaseFragment {
|
|||||||
mRecyclerView.setAdapter(adapter);
|
mRecyclerView.setAdapter(adapter);
|
||||||
}
|
}
|
||||||
private void initData() {
|
private void initData() {
|
||||||
LiveNetManager.get(getContext())
|
BattlePassUserInfoBean userInfo = userInfoListener.getBattlePassUserInfo();
|
||||||
.getBattlePassUserInfo(new HttpCallback<BattlePassUserInfoBean>() {
|
if(adapter!=null && userInfo!=null){
|
||||||
@Override
|
adapter.setPoint(userInfo.getPoints());
|
||||||
public void onSuccess(BattlePassUserInfoBean data) {
|
|
||||||
if(adapter!=null) {
|
|
||||||
adapter.setPoint(data.getPoints());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(String error) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadData() {
|
public void updateData() {
|
||||||
|
super.updateData();
|
||||||
initData();
|
initData();
|
||||||
LiveNetManager.get(getContext())
|
LiveNetManager.get(getContext())
|
||||||
.getBattlePassPoints(new HttpCallback<List<BattlePassPoints>>() {
|
.getBattlePassPoints(new HttpCallback<List<BattlePassPoints>>() {
|
||||||
|
@ -26,6 +26,7 @@ import com.yunbao.common.utils.WordUtil;
|
|||||||
import com.yunbao.main.R;
|
import com.yunbao.main.R;
|
||||||
import com.yunbao.main.adapter.BattlePassMissionAdapter;
|
import com.yunbao.main.adapter.BattlePassMissionAdapter;
|
||||||
import com.yunbao.main.event.BattlePassTypeEvent;
|
import com.yunbao.main.event.BattlePassTypeEvent;
|
||||||
|
import com.yunbao.main.interfaces.BattlePassUserInfoListener;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -33,7 +34,11 @@ import java.util.List;
|
|||||||
public class BattlePassMissionFragment extends BaseFragment {
|
public class BattlePassMissionFragment extends BaseFragment {
|
||||||
RecyclerView mRecyclerView;
|
RecyclerView mRecyclerView;
|
||||||
BattlePassMissionAdapter adapter;
|
BattlePassMissionAdapter adapter;
|
||||||
BattlePassUserInfoBean userInfoBean;
|
BattlePassUserInfoListener userInfoListener;
|
||||||
|
|
||||||
|
public BattlePassMissionFragment(BattlePassUserInfoListener userInfoListener) {
|
||||||
|
this.userInfoListener = userInfoListener;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View createView(LayoutInflater inflater, ViewGroup container) {
|
public View createView(LayoutInflater inflater, ViewGroup container) {
|
||||||
@ -52,9 +57,8 @@ public class BattlePassMissionFragment extends BaseFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateData() {
|
protected void loadData() {
|
||||||
super.updateData();
|
|
||||||
loadData();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -67,12 +71,15 @@ public class BattlePassMissionFragment extends BaseFragment {
|
|||||||
adapter.setOnItemClickListener(new OnItemClickListener<BattlePassTask.Task>() {
|
adapter.setOnItemClickListener(new OnItemClickListener<BattlePassTask.Task>() {
|
||||||
@Override
|
@Override
|
||||||
public void onItemClick(BattlePassTask.Task bean, int position) {
|
public void onItemClick(BattlePassTask.Task bean, int position) {
|
||||||
Bus.get().post(new BattlePassTypeEvent(0));
|
|
||||||
if (position == -2) {
|
if (position == -2) {
|
||||||
|
BattlePassUserInfoBean userInfoBean = userInfoListener.getBattlePassUserInfo();
|
||||||
if (userInfoBean.getNextLevelExp() == 0) {
|
if (userInfoBean.getNextLevelExp() == 0) {
|
||||||
ToastUtil.show(WordUtil.getNewString(R.string.battlepass_user_level_max));
|
ToastUtil.show(WordUtil.getNewString(R.string.battlepass_user_level_max));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
long maxExp=userInfoBean.getMaxLevelExp() - userInfoBean.getBattlePassExp();
|
||||||
|
ToastUtil.show("max = "+maxExp+"|"+userInfoBean.getNextLevelExp());
|
||||||
|
|
||||||
new XPopup.Builder(getContext())
|
new XPopup.Builder(getContext())
|
||||||
.enableDrag(false)
|
.enableDrag(false)
|
||||||
.maxWidth(DeviceUtils.getScreenHeight((Activity) getContext()) - DpUtil.dp2px(34))
|
.maxWidth(DeviceUtils.getScreenHeight((Activity) getContext()) - DpUtil.dp2px(34))
|
||||||
@ -81,6 +88,7 @@ public class BattlePassMissionFragment extends BaseFragment {
|
|||||||
userInfoBean.getNextLevelExp() - userInfoBean.getLastLevelExp(),
|
userInfoBean.getNextLevelExp() - userInfoBean.getLastLevelExp(),
|
||||||
String.valueOf(userInfoBean.getLevel()),
|
String.valueOf(userInfoBean.getLevel()),
|
||||||
String.valueOf(IMLoginManager.get(getContext()).getUserInfo().getCoin()),
|
String.valueOf(IMLoginManager.get(getContext()).getUserInfo().getCoin()),
|
||||||
|
maxExp,
|
||||||
new OrderLevelPopupWindow.OrderLevelCallback() {
|
new OrderLevelPopupWindow.OrderLevelCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onCallback(int code, String msg) {
|
public void onCallback(int code, String msg) {
|
||||||
@ -94,15 +102,16 @@ public class BattlePassMissionFragment extends BaseFragment {
|
|||||||
)
|
)
|
||||||
.show();
|
.show();
|
||||||
} else {
|
} else {
|
||||||
loadData();
|
updateData();
|
||||||
|
Bus.get().post(new BattlePassTypeEvent(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
mRecyclerView.setAdapter(adapter);
|
mRecyclerView.setAdapter(adapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadData() {
|
public void updateData() {
|
||||||
|
super.updateData();
|
||||||
LiveNetManager.get(getContext())
|
LiveNetManager.get(getContext())
|
||||||
.getBattlePassTask(new HttpCallback<BattlePassTask>() {
|
.getBattlePassTask(new HttpCallback<BattlePassTask>() {
|
||||||
@Override
|
@Override
|
||||||
@ -120,18 +129,6 @@ public class BattlePassMissionFragment extends BaseFragment {
|
|||||||
@Override
|
@Override
|
||||||
public void onError(String error) {
|
public void onError(String error) {
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
LiveNetManager.get(getContext())
|
|
||||||
.getBattlePassUserInfo(new HttpCallback<BattlePassUserInfoBean>() {
|
|
||||||
@Override
|
|
||||||
public void onSuccess(BattlePassUserInfoBean data) {
|
|
||||||
userInfoBean = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(String error) {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
|||||||
import com.yunbao.main.R;
|
import com.yunbao.main.R;
|
||||||
import com.yunbao.main.adapter.BattlePassRewardAdapter;
|
import com.yunbao.main.adapter.BattlePassRewardAdapter;
|
||||||
import com.yunbao.main.event.BattlePassTypeEvent;
|
import com.yunbao.main.event.BattlePassTypeEvent;
|
||||||
|
import com.yunbao.main.interfaces.BattlePassUserInfoListener;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -44,6 +45,11 @@ public class BattlePassRewardFragment extends BaseFragment {
|
|||||||
String enjoySpendMoney = "";
|
String enjoySpendMoney = "";
|
||||||
String quintessenceSpendMoney = "";
|
String quintessenceSpendMoney = "";
|
||||||
|
|
||||||
|
BattlePassUserInfoListener userInfoListener;
|
||||||
|
|
||||||
|
public BattlePassRewardFragment(BattlePassUserInfoListener userInfoListener) {
|
||||||
|
this.userInfoListener = userInfoListener;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View createView(LayoutInflater inflater, ViewGroup container) {
|
public View createView(LayoutInflater inflater, ViewGroup container) {
|
||||||
@ -62,9 +68,8 @@ public class BattlePassRewardFragment extends BaseFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateData() {
|
protected void loadData() {
|
||||||
super.updateData();
|
|
||||||
loadData();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -78,7 +83,7 @@ public class BattlePassRewardFragment extends BaseFragment {
|
|||||||
adapter.setOnItemClickListener(new OnItemClickListener<LiveBattlePassRewardsBean.LiveBattlePassReward>() {
|
adapter.setOnItemClickListener(new OnItemClickListener<LiveBattlePassRewardsBean.LiveBattlePassReward>() {
|
||||||
@Override
|
@Override
|
||||||
public void onItemClick(LiveBattlePassRewardsBean.LiveBattlePassReward bean, int position) {
|
public void onItemClick(LiveBattlePassRewardsBean.LiveBattlePassReward bean, int position) {
|
||||||
loadData();
|
updateData();
|
||||||
Bus.get().post(new BattlePassTypeEvent(0));
|
Bus.get().post(new BattlePassTypeEvent(0));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -100,7 +105,7 @@ public class BattlePassRewardFragment extends BaseFragment {
|
|||||||
@Override
|
@Override
|
||||||
public void onCallback(int code, String msg) {
|
public void onCallback(int code, String msg) {
|
||||||
ToastUtil.show(msg);
|
ToastUtil.show(msg);
|
||||||
loadData();
|
updateData();
|
||||||
Bus.get().post(new BattlePassTypeEvent(0));
|
Bus.get().post(new BattlePassTypeEvent(0));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -123,7 +128,7 @@ public class BattlePassRewardFragment extends BaseFragment {
|
|||||||
@Override
|
@Override
|
||||||
public void onCallback(int code, String msg) {
|
public void onCallback(int code, String msg) {
|
||||||
ToastUtil.show(msg);
|
ToastUtil.show(msg);
|
||||||
loadData();
|
updateData();
|
||||||
Bus.get().post(new BattlePassTypeEvent(0));
|
Bus.get().post(new BattlePassTypeEvent(0));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -134,7 +139,8 @@ public class BattlePassRewardFragment extends BaseFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadData() {
|
public void updateData() {
|
||||||
|
super.updateData();
|
||||||
|
|
||||||
LiveNetManager.get(getContext())
|
LiveNetManager.get(getContext())
|
||||||
.getLiveBattlePassRewards(new HttpCallback<LiveBattlePassRewardsBean>() {
|
.getLiveBattlePassRewards(new HttpCallback<LiveBattlePassRewardsBean>() {
|
||||||
@ -170,20 +176,12 @@ public class BattlePassRewardFragment extends BaseFragment {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
private void initData() {
|
private void initData() {
|
||||||
LiveNetManager.get(getContext())
|
BattlePassUserInfoBean userInfo = userInfoListener.getBattlePassUserInfo();
|
||||||
.getBattlePassUserInfo(new HttpCallback<BattlePassUserInfoBean>() {
|
if(userInfo!=null){
|
||||||
@Override
|
setTab(userInfo);
|
||||||
public void onSuccess(BattlePassUserInfoBean data) {
|
adapter.setUserType(userInfo);
|
||||||
setTab(data);
|
|
||||||
adapter.setUserType(data);
|
|
||||||
adapter.notifyDataSetChanged();
|
adapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(String error) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
private void setTab(BattlePassUserInfoBean data) {
|
private void setTab(BattlePassUserInfoBean data) {
|
||||||
tab1.setImageResource(R.mipmap.ic_reward_tab_normal);
|
tab1.setImageResource(R.mipmap.ic_reward_tab_normal);
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
package com.yunbao.main.interfaces;
|
||||||
|
|
||||||
|
import com.yunbao.common.bean.BattlePassUserInfoBean;
|
||||||
|
|
||||||
|
public interface BattlePassUserInfoListener {
|
||||||
|
BattlePassUserInfoBean getBattlePassUserInfo();
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user