|
@@ -24,6 +24,7 @@ import com.sheep.gamegroup.module.game.adapter.AdpGameCenterType;
|
|
|
import com.sheep.gamegroup.module.game.model.GameCenterType;
|
|
import com.sheep.gamegroup.module.game.model.GameCenterType;
|
|
|
import com.sheep.gamegroup.module.game.model.GamePortTypes;
|
|
import com.sheep.gamegroup.module.game.model.GamePortTypes;
|
|
|
import com.sheep.gamegroup.module.game.util.HpRefreshWelfareHelper;
|
|
import com.sheep.gamegroup.module.game.util.HpRefreshWelfareHelper;
|
|
|
|
|
+import com.sheep.gamegroup.module.game.util.PromoteGoodsHelper;
|
|
|
import com.sheep.gamegroup.util.CommonUtil;
|
|
import com.sheep.gamegroup.util.CommonUtil;
|
|
|
import com.sheep.gamegroup.util.DataUtil;
|
|
import com.sheep.gamegroup.util.DataUtil;
|
|
|
import com.sheep.gamegroup.util.Jump2View;
|
|
import com.sheep.gamegroup.util.Jump2View;
|
|
@@ -62,6 +63,8 @@ public class FgtPlayGame extends BaseFragment {
|
|
|
Banner banner;
|
|
Banner banner;
|
|
|
@BindView(R.id.play_game_center_type_list)
|
|
@BindView(R.id.play_game_center_type_list)
|
|
|
RecyclerView 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)
|
|
@BindView(R.id.play_game_list_x_rv)
|
|
|
RecyclerView play_game_list_x_rv;
|
|
RecyclerView play_game_list_x_rv;
|
|
|
@BindView(R.id.refresh)
|
|
@BindView(R.id.refresh)
|
|
@@ -73,6 +76,7 @@ public class FgtPlayGame extends BaseFragment {
|
|
|
public static final String[] GAME_CENTER_TYPE_ICON_NAME = {"myxy", "hytj", "mytj", "phb"};
|
|
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:免费道具
|
|
public static final int[] GAME_CENTER_TYPE_ID = {1, 3, 2, -1};//1:绵羊新游 2:绵羊推荐 3:免费道具
|
|
|
//预下载和tag列表的数据
|
|
//预下载和tag列表的数据
|
|
|
|
|
+ private List<ListTypeList<GameEntity, GameListType>> gameEntityList2 = new ArrayList<>();
|
|
|
private List<ListTypeList<GameEntity, GameListType>> gameEntityListx = new ArrayList<>();
|
|
private List<ListTypeList<GameEntity, GameListType>> gameEntityListx = new ArrayList<>();
|
|
|
private List<SlideshowEty> slideshowEtyLists = new ArrayList<>();
|
|
private List<SlideshowEty> slideshowEtyLists = new ArrayList<>();
|
|
|
private List<String> slideshowTitleList = new ArrayList<>();
|
|
private List<String> slideshowTitleList = new ArrayList<>();
|
|
@@ -87,6 +91,10 @@ public class FgtPlayGame extends BaseFragment {
|
|
|
@BindView(R.id.hp_refresh_welfare_box)
|
|
@BindView(R.id.hp_refresh_welfare_box)
|
|
|
View hp_refresh_welfare_box;
|
|
View hp_refresh_welfare_box;
|
|
|
private HpRefreshWelfareHelper mHpRefreshWelfareHelper;//刷新福利的帮助类
|
|
private HpRefreshWelfareHelper mHpRefreshWelfareHelper;//刷新福利的帮助类
|
|
|
|
|
+ //商品限时抢购入口与刷新商品
|
|
|
|
|
+ @BindView(R.id.play_game_promote_goods)
|
|
|
|
|
+ View play_game_promote_goods;
|
|
|
|
|
+ private PromoteGoodsHelper mPromoteGoodsHelper;//的帮助类
|
|
|
@Override
|
|
@Override
|
|
|
public void onViewCreated() {
|
|
public void onViewCreated() {
|
|
|
//banner
|
|
//banner
|
|
@@ -95,8 +103,9 @@ public class FgtPlayGame extends BaseFragment {
|
|
|
banner.setLayoutParams(bannerLayoutParams);
|
|
banner.setLayoutParams(bannerLayoutParams);
|
|
|
|
|
|
|
|
//玩转游戏 游戏福利专区入口
|
|
//玩转游戏 游戏福利专区入口
|
|
|
-
|
|
|
|
|
mHpRefreshWelfareHelper = new HpRefreshWelfareHelper(hp_refresh_welfare_box);
|
|
mHpRefreshWelfareHelper = new HpRefreshWelfareHelper(hp_refresh_welfare_box);
|
|
|
|
|
+ //玩转游戏 商城限时抢购入口
|
|
|
|
|
+ mPromoteGoodsHelper = new PromoteGoodsHelper(play_game_promote_goods);
|
|
|
|
|
|
|
|
|
|
|
|
|
//绵羊新游、免费道具、绵羊推荐、排行榜
|
|
//绵羊新游、免费道具、绵羊推荐、排行榜
|
|
@@ -115,7 +124,12 @@ public class FgtPlayGame extends BaseFragment {
|
|
|
BaseQuickAdapter baseQuickAdapter = new AdpGameCenterType(gameCenterList);
|
|
BaseQuickAdapter baseQuickAdapter = new AdpGameCenterType(gameCenterList);
|
|
|
baseQuickAdapter.bindToRecyclerView(play_game_center_type_list);
|
|
baseQuickAdapter.bindToRecyclerView(play_game_center_type_list);
|
|
|
baseQuickAdapter.setOnItemClickListener((adapter, view, position) -> Jump2View.getInstance().goActGameCenterType(getActivity(), ListUtil.getItem(gameCenterList, position)));
|
|
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.setHasFixedSize(true);
|
|
|
play_game_list_x_rv.setNestedScrollingEnabled(false);
|
|
play_game_list_x_rv.setNestedScrollingEnabled(false);
|
|
|
play_game_list_x_rv.setLayoutManager(new LinearLayoutManager(SheepApp.getInstance()));
|
|
play_game_list_x_rv.setLayoutManager(new LinearLayoutManager(SheepApp.getInstance()));
|
|
@@ -133,23 +147,39 @@ public class FgtPlayGame extends BaseFragment {
|
|
|
initGameTagList();
|
|
initGameTagList();
|
|
|
if(mHpRefreshWelfareHelper != null)
|
|
if(mHpRefreshWelfareHelper != null)
|
|
|
mHpRefreshWelfareHelper.refreshData();
|
|
mHpRefreshWelfareHelper.refreshData();
|
|
|
|
|
+ if(mPromoteGoodsHelper != null)
|
|
|
|
|
+ mPromoteGoodsHelper.refreshData();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
//获取出包类型列表 的tagList
|
|
//获取出包类型列表 的tagList
|
|
|
private void initGameTagList() {
|
|
private void initGameTagList() {
|
|
|
|
|
+ gameEntityList2.clear();
|
|
|
gameEntityListx.clear();
|
|
gameEntityListx.clear();
|
|
|
|
|
+ ViewUtil.notifyDataSetChanged(play_game_list_2_rv);
|
|
|
ViewUtil.notifyDataSetChanged(play_game_list_x_rv);
|
|
ViewUtil.notifyDataSetChanged(play_game_list_x_rv);
|
|
|
//其它tag
|
|
//其它tag
|
|
|
SheepApp.getInstance().getNetComponent().getApiService().getGamePortType()
|
|
SheepApp.getInstance().getNetComponent().getApiService().getGamePortType()
|
|
|
.subscribeOn(Schedulers.io())
|
|
.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
|
|
@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);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
@@ -243,6 +273,7 @@ public class FgtPlayGame extends BaseFragment {
|
|
|
banner.stopAutoPlay();
|
|
banner.stopAutoPlay();
|
|
|
}
|
|
}
|
|
|
private Comparator<ListTypeList<GameEntity, GameListType>> comparator = (item1, item2) -> item2.getSort() - item1.getSort();
|
|
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) {
|
|
private void initGameList(final RecyclerView playGameListRv, final List<ListTypeList<GameEntity, GameListType>> gameEntityListList, GamePortTypes packageTypes) {
|
|
|
GameListType gameListType = packageTypes.toGameListType();
|
|
GameListType gameListType = packageTypes.toGameListType();
|
|
|
if (gameListType == null) {
|
|
if (gameListType == null) {
|