直播通行证获取到的等级数据因为不知名原因顺序错乱,增加排序解决
This commit is contained in:
parent
7b256ff3c4
commit
39818064f6
@ -4,12 +4,15 @@ import static com.yunbao.common.utils.RouteUtil.PATH_COIN;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
@ -37,8 +40,12 @@ import com.yunbao.main.interfaces.BattlePassUserInfoListener;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class BattlePassRewardFragment extends BaseFragment {
|
||||
ImageView tab1;
|
||||
@ -175,6 +182,7 @@ public class BattlePassRewardFragment extends BaseFragment {
|
||||
|
||||
LiveNetManager.get(getContext())
|
||||
.getLiveBattlePassRewards(new HttpCallback<LiveBattlePassRewardsBean>() {
|
||||
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||
@Override
|
||||
public void onSuccess(LiveBattlePassRewardsBean data) {
|
||||
|
||||
@ -195,8 +203,14 @@ public class BattlePassRewardFragment extends BaseFragment {
|
||||
}else{
|
||||
Bus.get().post(new BattlePassTypeEvent(2).setBean(data));
|
||||
}
|
||||
Collection<Map<Integer, LiveBattlePassRewardsBean.LiveBattlePassReward>> values = data.getLive_battle_pass_rewards().values();
|
||||
|
||||
// data.getLive_battle_pass_rewards()返回的Map排序,不能转为集合
|
||||
Map<Integer, Map<Integer, LiveBattlePassRewardsBean.LiveBattlePassReward>> liveBattlePassRewards = data.getLive_battle_pass_rewards();
|
||||
// 使用TreeMap来自动按键排序
|
||||
Map<Integer, Map<Integer, LiveBattlePassRewardsBean.LiveBattlePassReward>> sortedMap = new TreeMap<>(liveBattlePassRewards);
|
||||
Collection<Map<Integer, LiveBattlePassRewardsBean.LiveBattlePassReward>> values = sortedMap.values();
|
||||
List<Map<Integer, LiveBattlePassRewardsBean.LiveBattlePassReward>> list = new ArrayList<>(values);
|
||||
|
||||
/* list.get(1).get(1).setReceived(2);
|
||||
list.get(0).get(2).setLock(2);
|
||||
list.get(1).get(2).setLock(2);
|
||||
|
Loading…
Reference in New Issue
Block a user