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 7467819fb..fe8b274c2 100644 --- a/common/src/main/java/com/yunbao/common/bean/LiveBattlePassRewardsBean.java +++ b/common/src/main/java/com/yunbao/common/bean/LiveBattlePassRewardsBean.java @@ -7,12 +7,21 @@ import java.util.Map; public class LiveBattlePassRewardsBean extends BaseModel{ private int level; + private int is_received; private List live_battle_pass_type; private Map> live_battle_pass_rewards; public LiveBattlePassRewardsBean() { } + public int getIs_received() { + return is_received; + } + + public void setIs_received(int is_received) { + this.is_received = is_received; + } + public int getLevel() { return level; } diff --git a/main/src/main/java/com/yunbao/main/activity/BattlePassActivity.java b/main/src/main/java/com/yunbao/main/activity/BattlePassActivity.java index 6eb699604..5f91acbfb 100644 --- a/main/src/main/java/com/yunbao/main/activity/BattlePassActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/BattlePassActivity.java @@ -6,6 +6,7 @@ import android.annotation.SuppressLint; import android.app.Activity; import android.app.Dialog; import android.os.Bundle; +import android.view.View; import android.widget.Button; import android.widget.ImageView; import android.widget.ProgressBar; @@ -21,6 +22,7 @@ import com.alibaba.android.arouter.launcher.ARouter; import com.lxj.xpopup.XPopup; import com.yunbao.common.activity.AbsActivity; import com.yunbao.common.bean.BattlePassUserInfoBean; +import com.yunbao.common.bean.HttpCallbackModel; import com.yunbao.common.bean.LiveBattlePassRewardsBean; import com.yunbao.common.dialog.ActivateEliteBattleOrderPopupWindow; import com.yunbao.common.dialog.ActivityEndPopupWindow; @@ -69,6 +71,7 @@ public class BattlePassActivity extends AbsActivity { Button moreIntegralButton; String enjoySpendMoney = ""; String quintessenceSpendMoney = ""; + Button allGet; BattlePassUserInfoBean data; @@ -99,6 +102,7 @@ public class BattlePassActivity extends AbsActivity { tab3 = findViewById(R.id.tab_3); expText = findViewById(R.id.exp_text); viewPager = findViewById(R.id.context_layout); + allGet = findViewById(R.id.all_get); fragments.add(new BattlePassRewardFragment(() -> data)); fragments.add(new BattlePassMissionFragment(() -> data)); fragments.add(new BattlePassExchangeFragment(() -> data)); @@ -171,21 +175,44 @@ public class BattlePassActivity extends AbsActivity { .show(); } }); + ViewClicksAntiShake.clicksAntiShake(allGet, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + LiveNetManager.get(mContext) + .getRewards("0", "0", new HttpCallback() { + @Override + public void onSuccess(HttpCallbackModel data) { + ToastUtil.show(data.getMsg()); + initData(); + } + + @Override + public void onError(String error) { + ToastUtil.show(error); + } + }); + } + }); } private void clickView(int position) { switch (position) { case 0: + if (allGet.getTag() != null) { + allGet.setVisibility(View.VISIBLE); + } tab1.setImageResource(R.mipmap.ic_zl_tab1); tab2.setImageResource(R.mipmap.ic_zl_tab2_unselect); tab3.setImageResource(R.mipmap.ic_zl_tab3_unselect); break; case 1: + event(new BattlePassTypeEvent(2)); tab1.setImageResource(R.mipmap.ic_zl_tab1_unselect); tab2.setImageResource(R.mipmap.ic_zl_tab2); tab3.setImageResource(R.mipmap.ic_zl_tab3_unselect); break; case 2: + event(new BattlePassTypeEvent(2)); tab1.setImageResource(R.mipmap.ic_zl_tab1_unselect); tab2.setImageResource(R.mipmap.ic_zl_tab2_unselect); tab3.setImageResource(R.mipmap.ic_zl_tab3); @@ -210,8 +237,8 @@ public class BattlePassActivity extends AbsActivity { levelView.setText("Lv." + data.getLevel()); expText.setText(data.getBattlePassExp() + "/" + (data.getNextLevelExp() == 0 ? data.getBattlePassExp() : data.getNextLevelExp())); - levelProgressView.setMax(data.getNextLevelExp()-data.getLastLevelExp()); - levelProgressView.setProgress(data.getBattlePassExp()-data.getLastLevelExp()); + levelProgressView.setMax(data.getNextLevelExp() - data.getLastLevelExp()); + levelProgressView.setProgress(data.getBattlePassExp() - data.getLastLevelExp()); integralView.setText(String.format(WordUtil.getNewString(R.string.battlepass_user_my_integral), data.getPoints())); for (LiveBattlePassRewardsBean.BattlePassType passType : data.getLive_battle_pass_type()) { @@ -251,6 +278,11 @@ public class BattlePassActivity extends AbsActivity { public void event(BattlePassTypeEvent event) { if (event.getType() == 0) { initData(); + } else if (event.getType() == 1) { + allGet.setVisibility(View.VISIBLE); + allGet.setTag(event.getBean()); + } else if (event.getType() == 2) { + allGet.setVisibility(View.GONE); } } } diff --git a/main/src/main/java/com/yunbao/main/event/BattlePassTypeEvent.java b/main/src/main/java/com/yunbao/main/event/BattlePassTypeEvent.java index 577f756c5..98540437a 100644 --- a/main/src/main/java/com/yunbao/main/event/BattlePassTypeEvent.java +++ b/main/src/main/java/com/yunbao/main/event/BattlePassTypeEvent.java @@ -6,6 +6,16 @@ import java.util.List; public class BattlePassTypeEvent { int type; + LiveBattlePassRewardsBean bean; + + public LiveBattlePassRewardsBean getBean() { + return bean; + } + + public BattlePassTypeEvent setBean(LiveBattlePassRewardsBean bean) { + this.bean = bean; + return this; + } public BattlePassTypeEvent(int liveBattlePassType) { this.type=liveBattlePassType; diff --git a/main/src/main/java/com/yunbao/main/fragment/BattlePassRewardFragment.java b/main/src/main/java/com/yunbao/main/fragment/BattlePassRewardFragment.java index 389c7b1b7..4a069856b 100644 --- a/main/src/main/java/com/yunbao/main/fragment/BattlePassRewardFragment.java +++ b/main/src/main/java/com/yunbao/main/fragment/BattlePassRewardFragment.java @@ -190,6 +190,9 @@ public class BattlePassRewardFragment extends BaseFragment { } } + if(data.getIs_received()>=2){ + Bus.get().post(new BattlePassTypeEvent(1).setBean(data)); + } Collection> values = data.getLive_battle_pass_rewards().values(); List> list = new ArrayList<>(values); /* list.get(1).get(1).setReceived(2); diff --git a/main/src/main/res/layout/activity_battlepass.xml b/main/src/main/res/layout/activity_battlepass.xml index 4639d1bc0..6a8e0e91d 100644 --- a/main/src/main/res/layout/activity_battlepass.xml +++ b/main/src/main/res/layout/activity_battlepass.xml @@ -2,6 +2,7 @@ @@ -112,6 +113,19 @@ - + +