|
|
@@ -63,6 +63,8 @@ public class FgtPlayGame extends BaseFragment {
|
|
|
Banner banner;
|
|
|
@BindView(R.id.play_game_center_type_list)
|
|
|
RecyclerView play_game_center_type_list;
|
|
|
+ @BindView(R.id.play_game_list_2_rv)
|
|
|
+ RecyclerView play_game_list_2_rv;
|
|
|
@BindView(R.id.play_game_list_x_rv)
|
|
|
RecyclerView play_game_list_x_rv;
|
|
|
@BindView(R.id.refresh)
|
|
|
@@ -74,6 +76,7 @@ public class FgtPlayGame extends BaseFragment {
|
|
|
public static final String[] GAME_CENTER_TYPE_ICON_NAME = {"myxy", "hytj", "mytj", "phb"};
|
|
|
public static final int[] GAME_CENTER_TYPE_ID = {1, 3, 2, -1};//1:绵羊新游 2:绵羊推荐 3:免费道具
|
|
|
//预下载和tag列表的数据
|
|
|
+ private List<ListTypeList<GameEntity, GameListType>> gameEntityList2 = new ArrayList<>();
|
|
|
private List<ListTypeList<GameEntity, GameListType>> gameEntityListx = new ArrayList<>();
|
|
|
private List<SlideshowEty> slideshowEtyLists = new ArrayList<>();
|
|
|
private List<String> slideshowTitleList = new ArrayList<>();
|
|
|
@@ -121,7 +124,12 @@ public class FgtPlayGame extends BaseFragment {
|
|
|
BaseQuickAdapter baseQuickAdapter = new AdpGameCenterType(gameCenterList);
|
|
|
baseQuickAdapter.bindToRecyclerView(play_game_center_type_list);
|
|
|
baseQuickAdapter.setOnItemClickListener((adapter, view, position) -> Jump2View.getInstance().goActGameCenterType(getActivity(), ListUtil.getItem(gameCenterList, position)));
|
|
|
- //预下载与其它列表
|
|
|
+ //x列表前2个
|
|
|
+ play_game_list_2_rv.setHasFixedSize(true);
|
|
|
+ play_game_list_2_rv.setNestedScrollingEnabled(false);
|
|
|
+ play_game_list_2_rv.setLayoutManager(new LinearLayoutManager(SheepApp.getInstance()));
|
|
|
+ new AdpGameCenter4_3List(gameEntityList2).bindToRecyclerView(play_game_list_2_rv);
|
|
|
+ //x列表从第2个开始
|
|
|
play_game_list_x_rv.setHasFixedSize(true);
|
|
|
play_game_list_x_rv.setNestedScrollingEnabled(false);
|
|
|
play_game_list_x_rv.setLayoutManager(new LinearLayoutManager(SheepApp.getInstance()));
|
|
|
@@ -145,18 +153,33 @@ public class FgtPlayGame extends BaseFragment {
|
|
|
|
|
|
//获取出包类型列表 的tagList
|
|
|
private void initGameTagList() {
|
|
|
+ gameEntityList2.clear();
|
|
|
gameEntityListx.clear();
|
|
|
+ ViewUtil.notifyDataSetChanged(play_game_list_2_rv);
|
|
|
ViewUtil.notifyDataSetChanged(play_game_list_x_rv);
|
|
|
//其它tag
|
|
|
SheepApp.getInstance().getNetComponent().getApiService().getGamePortType()
|
|
|
.subscribeOn(Schedulers.io())
|
|
|
- .flatMap((Function<BaseMessage, Observable<GamePortTypes>>) baseMessage -> Observable.fromIterable(baseMessage.getDataList(GamePortTypes.class)))
|
|
|
- .filter(gameListTag -> gameListTag != null)
|
|
|
- .subscribe(new AbsObserver<GamePortTypes>() {
|
|
|
+ .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
|
|
|
+ @Override
|
|
|
+ public void onError(BaseMessage baseMessage) {
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
@Override
|
|
|
- public void onNext(GamePortTypes gameListTag) {
|
|
|
- initGameList(play_game_list_x_rv, gameEntityListx, gameListTag);
|
|
|
+ public void onNext(BaseMessage baseMessage) {
|
|
|
+ ArrayList<GamePortTypes> gamePortTypeList = baseMessage.getDataList(GamePortTypes.class);
|
|
|
+ Collections.sort(gamePortTypeList, comparator2);
|
|
|
+ int size = gamePortTypeList.size();
|
|
|
+ int d = size / 2;
|
|
|
+ for (int i = 0; i < size; i++) {
|
|
|
+ GamePortTypes item = gamePortTypeList.get(i);
|
|
|
+ if(i < d ){
|
|
|
+ initGameList(play_game_list_2_rv, gameEntityList2, item);
|
|
|
+ } else {
|
|
|
+ initGameList(play_game_list_x_rv, gameEntityListx, item);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
@@ -250,6 +273,7 @@ public class FgtPlayGame extends BaseFragment {
|
|
|
banner.stopAutoPlay();
|
|
|
}
|
|
|
private Comparator<ListTypeList<GameEntity, GameListType>> comparator = (item1, item2) -> item2.getSort() - item1.getSort();
|
|
|
+ private Comparator<GamePortTypes> comparator2 = (item1, item2) -> item2.getSort() - item1.getSort();
|
|
|
private void initGameList(final RecyclerView playGameListRv, final List<ListTypeList<GameEntity, GameListType>> gameEntityListList, GamePortTypes packageTypes) {
|
|
|
GameListType gameListType = packageTypes.toGameListType();
|
|
|
if (gameListType == null) {
|