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