新增戰令一鍵領取按鈕

This commit is contained in:
zlzw 2024-04-26 11:11:48 +08:00
parent 1f12187766
commit d0c0f8f82e
8 changed files with 73 additions and 3 deletions

View File

@ -7,12 +7,21 @@ import java.util.Map;
public class LiveBattlePassRewardsBean extends BaseModel{ public class LiveBattlePassRewardsBean extends BaseModel{
private int level; private int level;
private int is_received;
private List<BattlePassType> live_battle_pass_type; private List<BattlePassType> live_battle_pass_type;
private Map<Integer,Map<Integer,LiveBattlePassReward>> live_battle_pass_rewards; private Map<Integer,Map<Integer,LiveBattlePassReward>> live_battle_pass_rewards;
public LiveBattlePassRewardsBean() { public LiveBattlePassRewardsBean() {
} }
public int getIs_received() {
return is_received;
}
public void setIs_received(int is_received) {
this.is_received = is_received;
}
public int getLevel() { public int getLevel() {
return level; return level;
} }

View File

@ -6,6 +6,7 @@ import android.annotation.SuppressLint;
import android.app.Activity; import android.app.Activity;
import android.app.Dialog; import android.app.Dialog;
import android.os.Bundle; import android.os.Bundle;
import android.view.View;
import android.widget.Button; import android.widget.Button;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.ProgressBar; import android.widget.ProgressBar;
@ -21,6 +22,7 @@ import com.alibaba.android.arouter.launcher.ARouter;
import com.lxj.xpopup.XPopup; import com.lxj.xpopup.XPopup;
import com.yunbao.common.activity.AbsActivity; import com.yunbao.common.activity.AbsActivity;
import com.yunbao.common.bean.BattlePassUserInfoBean; import com.yunbao.common.bean.BattlePassUserInfoBean;
import com.yunbao.common.bean.HttpCallbackModel;
import com.yunbao.common.bean.LiveBattlePassRewardsBean; import com.yunbao.common.bean.LiveBattlePassRewardsBean;
import com.yunbao.common.dialog.ActivateEliteBattleOrderPopupWindow; import com.yunbao.common.dialog.ActivateEliteBattleOrderPopupWindow;
import com.yunbao.common.dialog.ActivityEndPopupWindow; import com.yunbao.common.dialog.ActivityEndPopupWindow;
@ -69,6 +71,7 @@ public class BattlePassActivity extends AbsActivity {
Button moreIntegralButton; Button moreIntegralButton;
String enjoySpendMoney = ""; String enjoySpendMoney = "";
String quintessenceSpendMoney = ""; String quintessenceSpendMoney = "";
Button allGet;
BattlePassUserInfoBean data; BattlePassUserInfoBean data;
@ -99,6 +102,7 @@ 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);
allGet = findViewById(R.id.all_get);
fragments.add(new BattlePassRewardFragment(() -> data)); fragments.add(new BattlePassRewardFragment(() -> data));
fragments.add(new BattlePassMissionFragment(() -> data)); fragments.add(new BattlePassMissionFragment(() -> data));
fragments.add(new BattlePassExchangeFragment(() -> data)); fragments.add(new BattlePassExchangeFragment(() -> data));
@ -171,21 +175,44 @@ public class BattlePassActivity extends AbsActivity {
.show(); .show();
} }
}); });
ViewClicksAntiShake.clicksAntiShake(allGet, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
LiveNetManager.get(mContext)
.getRewards("0", "0", new HttpCallback<HttpCallbackModel>() {
@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) { private void clickView(int position) {
switch (position) { switch (position) {
case 0: case 0:
if (allGet.getTag() != null) {
allGet.setVisibility(View.VISIBLE);
}
tab1.setImageResource(R.mipmap.ic_zl_tab1); tab1.setImageResource(R.mipmap.ic_zl_tab1);
tab2.setImageResource(R.mipmap.ic_zl_tab2_unselect); tab2.setImageResource(R.mipmap.ic_zl_tab2_unselect);
tab3.setImageResource(R.mipmap.ic_zl_tab3_unselect); tab3.setImageResource(R.mipmap.ic_zl_tab3_unselect);
break; break;
case 1: case 1:
event(new BattlePassTypeEvent(2));
tab1.setImageResource(R.mipmap.ic_zl_tab1_unselect); tab1.setImageResource(R.mipmap.ic_zl_tab1_unselect);
tab2.setImageResource(R.mipmap.ic_zl_tab2); tab2.setImageResource(R.mipmap.ic_zl_tab2);
tab3.setImageResource(R.mipmap.ic_zl_tab3_unselect); tab3.setImageResource(R.mipmap.ic_zl_tab3_unselect);
break; break;
case 2: case 2:
event(new BattlePassTypeEvent(2));
tab1.setImageResource(R.mipmap.ic_zl_tab1_unselect); tab1.setImageResource(R.mipmap.ic_zl_tab1_unselect);
tab2.setImageResource(R.mipmap.ic_zl_tab2_unselect); tab2.setImageResource(R.mipmap.ic_zl_tab2_unselect);
tab3.setImageResource(R.mipmap.ic_zl_tab3); tab3.setImageResource(R.mipmap.ic_zl_tab3);
@ -251,6 +278,11 @@ public class BattlePassActivity extends AbsActivity {
public void event(BattlePassTypeEvent event) { public void event(BattlePassTypeEvent event) {
if (event.getType() == 0) { if (event.getType() == 0) {
initData(); initData();
} else if (event.getType() == 1) {
allGet.setVisibility(View.VISIBLE);
allGet.setTag(event.getBean());
} else if (event.getType() == 2) {
allGet.setVisibility(View.GONE);
} }
} }
} }

View File

@ -6,6 +6,16 @@ import java.util.List;
public class BattlePassTypeEvent { public class BattlePassTypeEvent {
int type; int type;
LiveBattlePassRewardsBean bean;
public LiveBattlePassRewardsBean getBean() {
return bean;
}
public BattlePassTypeEvent setBean(LiveBattlePassRewardsBean bean) {
this.bean = bean;
return this;
}
public BattlePassTypeEvent(int liveBattlePassType) { public BattlePassTypeEvent(int liveBattlePassType) {
this.type=liveBattlePassType; this.type=liveBattlePassType;

View File

@ -190,6 +190,9 @@ public class BattlePassRewardFragment extends BaseFragment {
} }
} }
if(data.getIs_received()>=2){
Bus.get().post(new BattlePassTypeEvent(1).setBean(data));
}
Collection<Map<Integer, LiveBattlePassRewardsBean.LiveBattlePassReward>> values = data.getLive_battle_pass_rewards().values(); Collection<Map<Integer, LiveBattlePassRewardsBean.LiveBattlePassReward>> values = data.getLive_battle_pass_rewards().values();
List<Map<Integer, LiveBattlePassRewardsBean.LiveBattlePassReward>> list = new ArrayList<>(values); List<Map<Integer, LiveBattlePassRewardsBean.LiveBattlePassReward>> list = new ArrayList<>(values);
/* list.get(1).get(1).setReceived(2); /* list.get(1).get(1).setReceived(2);

View File

@ -2,6 +2,7 @@
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:background="#140F1F" android:background="#140F1F"
android:layout_height="match_parent"> android:layout_height="match_parent">
@ -112,6 +113,19 @@
</LinearLayout> </LinearLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
</LinearLayout> </LinearLayout>
<Button
android:id="@+id/all_get"
android:text="@string/activity_battle_pass_all_get"
android:layout_width="120dp"
android:visibility="gone"
tools:visibility="visible"
android:layout_height="34dp"
android:textColor="#ff6c00"
android:layout_marginBottom="50dp"
android:layout_marginEnd="50dp"
android:background="@mipmap/icon_battle_all_get"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -41,4 +41,5 @@
<string name="activity_feedback_edit_submit_tip3">今日反饋次數已用完</string> <string name="activity_feedback_edit_submit_tip3">今日反饋次數已用完</string>
<string name="activity_feedback_edit_img_select">從相冊選取</string> <string name="activity_feedback_edit_img_select">從相冊選取</string>
<string name="activity_feedback_edit_img_camera">拍照</string> <string name="activity_feedback_edit_img_camera">拍照</string>
<string name="activity_battle_pass_all_get">一鍵領取</string>
</resources> </resources>

View File

@ -41,4 +41,5 @@
<string name="activity_feedback_edit_submit_tip3">Today\'s feedback count has been used up</string> <string name="activity_feedback_edit_submit_tip3">Today\'s feedback count has been used up</string>
<string name="activity_feedback_edit_img_select">Select from album</string> <string name="activity_feedback_edit_img_select">Select from album</string>
<string name="activity_feedback_edit_img_camera">Photo shoot</string> <string name="activity_feedback_edit_img_camera">Photo shoot</string>
<string name="activity_battle_pass_all_get">一键领取</string>
</resources> </resources>