Przeglądaj źródła

Merge remote-tracking branch 'origin/sheep_develop' into sheep_develop

# Conflicts:
#	app/src/main/res/values/strings.xml
zhoujuncai 7 lat temu
rodzic
commit
25841c3876
35 zmienionych plików z 1582 dodań i 596 usunięć
  1. 7 1
      app/src/main/AndroidManifest.xml
  2. 37 1
      app/src/main/java/com/sheep/gamegroup/model/api/ApiService.java
  3. 11 4
      app/src/main/java/com/sheep/gamegroup/model/entity/GameEntityList.java
  4. 72 0
      app/src/main/java/com/sheep/gamegroup/model/entity/GameListTag.java
  5. 98 0
      app/src/main/java/com/sheep/gamegroup/model/entity/GameListType.java
  6. 25 0
      app/src/main/java/com/sheep/gamegroup/model/entity/GameListTypeList.java
  7. 161 0
      app/src/main/java/com/sheep/gamegroup/model/entity/GameRecommend.java
  8. 19 0
      app/src/main/java/com/sheep/gamegroup/model/util/AbsSubscriber.java
  9. 15 12
      app/src/main/java/com/sheep/gamegroup/util/CommonUtil.java
  10. 39 11
      app/src/main/java/com/sheep/gamegroup/util/Jump2View.java
  11. 23 0
      app/src/main/java/com/sheep/gamegroup/util/ObservableUtil.java
  12. 12 0
      app/src/main/java/com/sheep/gamegroup/util/StringUtils.java
  13. 4 0
      app/src/main/java/com/sheep/gamegroup/util/TestUtil.java
  14. 10 3
      app/src/main/java/com/sheep/gamegroup/util/ViewUtil.java
  15. 0 54
      app/src/main/java/com/sheep/gamegroup/view/activity/ActEverydayPlayGame.java
  16. 1 2
      app/src/main/java/com/sheep/gamegroup/view/activity/ActMain.java
  17. 53 0
      app/src/main/java/com/sheep/gamegroup/view/activity/ActPlayGameList.java
  18. 59 0
      app/src/main/java/com/sheep/gamegroup/view/activity/ActPlayGameRecommendList.java
  19. 59 0
      app/src/main/java/com/sheep/gamegroup/view/activity/ActPlayGameUserLikeList.java
  20. 127 114
      app/src/main/java/com/sheep/gamegroup/view/activity/BaseListActivity.java
  21. 3 1
      app/src/main/java/com/sheep/gamegroup/view/activity/SplashAct.java
  22. 76 0
      app/src/main/java/com/sheep/gamegroup/view/adapter/AdpGameCenter1_2List.java
  23. 85 0
      app/src/main/java/com/sheep/gamegroup/view/adapter/AdpGameCenter3_3List.java
  24. 268 223
      app/src/main/java/com/sheep/gamegroup/view/fragment/FgtPlayGame.java
  25. 112 113
      app/src/main/java/com/sheep/gamegroup/view/fragment/FgtPlayGameSon.java
  26. 9 0
      app/src/main/res/drawable/shape_black_solid_rectangle_tl_br_12.xml
  27. 17 0
      app/src/main/res/drawable/shape_light_blue_gradient_solid_rectangle_5.xml
  28. 17 0
      app/src/main/res/drawable/shape_orange_gradient_solid_rectangle_5.xml
  29. 17 0
      app/src/main/res/drawable/shape_purple_gradient_solid_rectangle_5.xml
  30. 7 44
      app/src/main/res/layout/fgt_play_game.xml
  31. 43 0
      app/src/main/res/layout/item_game_act.xml
  32. 14 13
      app/src/main/res/layout/item_hot_welfare.xml
  33. 49 0
      app/src/main/res/layout/item_play_game.xml
  34. 32 0
      app/src/main/res/layout/item_play_game_list.xml
  35. 1 0
      app/src/main/res/values/strings.xml

+ 7 - 1
app/src/main/AndroidManifest.xml

@@ -664,7 +664,13 @@
             android:name="com.sheep.gamegroup.view.activity.ActModifyThird"
             android:name="com.sheep.gamegroup.view.activity.ActModifyThird"
             android:screenOrientation="portrait" />
             android:screenOrientation="portrait" />
         <activity
         <activity
-            android:name="com.sheep.gamegroup.view.activity.ActEverydayPlayGame"
+            android:name="com.sheep.gamegroup.view.activity.ActPlayGameList"
+            android:screenOrientation="portrait" />
+        <activity
+            android:name="com.sheep.gamegroup.view.activity.ActPlayGameUserLikeList"
+            android:screenOrientation="portrait" />
+        <activity
+            android:name="com.sheep.gamegroup.view.activity.ActPlayGameRecommendList"
             android:screenOrientation="portrait" />
             android:screenOrientation="portrait" />
         <activity
         <activity
             android:name="com.sheep.gamegroup.view.activity.ActPlayGameDetail"
             android:name="com.sheep.gamegroup.view.activity.ActPlayGameDetail"

+ 37 - 1
app/src/main/java/com/sheep/gamegroup/model/api/ApiService.java

@@ -17,6 +17,7 @@ import retrofit2.http.POST;
 import retrofit2.http.PUT;
 import retrofit2.http.PUT;
 import retrofit2.http.Path;
 import retrofit2.http.Path;
 import retrofit2.http.Query;
 import retrofit2.http.Query;
+import retrofit2.http.QueryMap;
 import retrofit2.http.Streaming;
 import retrofit2.http.Streaming;
 import rx.Observable;
 import rx.Observable;
 
 
@@ -1001,7 +1002,36 @@ public interface ApiService {
      * type: 1002:快发出包 1003:腾讯出包 1004:小米出包 1099:其他
      * type: 1002:快发出包 1003:腾讯出包 1004:小米出包 1099:其他
      */
      */
     @GET("app/find")
     @GET("app/find")
-    Observable<BaseMessage> playgameDailyOrHotOrTypePlay(@Query("page") int page, @Query("per_page") int per_page, @Query("is_hot") int is_hot, @Query("daily_play") int daily_play, @Query("type") int type);
+    Observable<BaseMessage> getPlayGameList(@Query("page") int page, @Query("per_page") int per_page, @QueryMap Map<String, Object> map);
+
+    /**
+     * 玩转游戏-获取主页游戏数据 猜你喜欢
+     */
+    @GET("app/find/recommend/user_like")
+    Observable<BaseMessage> getUserLikeList();
+    /**
+     * 玩转游戏-获取主页游戏数据 1:天天更新 2:重点推荐
+     * display_type
+     * integer
+     * (query)
+     * 1:天天更新 2:重点推荐
+     */
+    @GET("app/find/recommend")
+    Observable<BaseMessage> getRecommendList(@Query("display_type") int display_type);
+    /**
+     * 玩转游戏-获取主页游戏数据 1:天天更新 2:重点推荐 更多
+     * display_type
+     * integer
+     * (query)
+     * 1:天天更新 2:重点推荐
+     */
+    @GET("app/find/recommend/list")
+    Observable<BaseMessage> getRecommendListMore(@Query("display_type") int display_type);
+    /**
+     * 玩转游戏-获取主页 获取标签列表
+     */
+    @GET("app/find/game/tags")
+    Observable<BaseMessage> getGameTagList();
     /**
     /**
      *
      *
      * type: 1002:快发出包 1003:腾讯出包 1004:小米出包
      * type: 1002:快发出包 1003:腾讯出包 1004:小米出包
@@ -1017,6 +1047,12 @@ public interface ApiService {
     Observable<BaseMessage> gameBanner(@Query("platform") int platform);
     Observable<BaseMessage> gameBanner(@Query("platform") int platform);
     /**
     /**
      * platform 平台 1:andriod 2:ios
      * platform 平台 1:andriod 2:ios
+     * 获取游戏中心主页活动数据
+     */
+    @GET("app/game_banner/activity?platform=1")
+    Observable<BaseMessage> gameBannerAct();
+    /**
+     * platform 平台 1:andriod 2:ios
      * @return
      * @return
      */
      */
     @GET("app/find/{id}")
     @GET("app/find/{id}")

+ 11 - 4
app/src/main/java/com/sheep/gamegroup/model/entity/GameEntityList.java

@@ -3,18 +3,25 @@ package com.sheep.gamegroup.model.entity;
 import com.sheep.gamegroup.util.ListUtil;
 import com.sheep.gamegroup.util.ListUtil;
 
 
 import java.util.List;
 import java.util.List;
-
 /**
 /**
- * Created by ljy on 2018/9/4.
+ * Created by realicing on 2018/10/30.
+ * realicing@sina.com
  */
  */
-
 public class GameEntityList{
 public class GameEntityList{
     private List<GameEntity> list;
     private List<GameEntity> list;
-
+    private GameListType gameListType;
+    public GameEntityList(GameListType gameListType, List<GameEntity> list) {
+        this.gameListType = gameListType;
+        this.list = list;
+    }
     public GameEntityList(List<GameEntity> list) {
     public GameEntityList(List<GameEntity> list) {
         this.list = list;
         this.list = list;
     }
     }
 
 
+    public GameListType getGameListType() {
+        return gameListType;
+    }
+
     public List<GameEntity> getList() {
     public List<GameEntity> getList() {
         return list;
         return list;
     }
     }

+ 72 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/GameListTag.java

@@ -0,0 +1,72 @@
+package com.sheep.gamegroup.model.entity;
+
+/**
+ * Created by realicing on 2018/10/30.
+ * realicing@sina.com
+ * 游戏列表标签
+ */
+public class GameListTag {
+    private int Id;
+
+    private String Name;
+
+    private String Icon;
+
+    private int Status;
+
+    private int Sort;
+
+    private int CreateTime;
+
+    private int UpdateTime;
+
+    public void setId(int Id){
+        this.Id = Id;
+    }
+    public int getId(){
+        return this.Id;
+    }
+    public void setName(String Name){
+        this.Name = Name;
+    }
+    public String getName(){
+        return this.Name;
+    }
+    public void setIcon(String Icon){
+        this.Icon = Icon;
+    }
+    public String getIcon(){
+        return this.Icon;
+    }
+    public void setStatus(int Status){
+        this.Status = Status;
+    }
+    public int getStatus(){
+        return this.Status;
+    }
+    public void setSort(int Sort){
+        this.Sort = Sort;
+    }
+    public int getSort(){
+        return this.Sort;
+    }
+    public void setCreateTime(int CreateTime){
+        this.CreateTime = CreateTime;
+    }
+    public int getCreateTime(){
+        return this.CreateTime;
+    }
+    public void setUpdateTime(int UpdateTime){
+        this.UpdateTime = UpdateTime;
+    }
+    public int getUpdateTime(){
+        return this.UpdateTime;
+    }
+
+    public GameListType toGameListType() {
+        GameListType gameListType = new GameListType();
+        gameListType.setTag_id(Id);
+        gameListType.setTitle(Name);
+        return gameListType;
+    }
+}

+ 98 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/GameListType.java

@@ -0,0 +1,98 @@
+package com.sheep.gamegroup.model.entity;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Created by realicing on 2018/10/30.
+ * realicing@sina.com
+ */
+public class GameListType implements Serializable {
+    private String title;
+    private int daily_play;
+    private int is_hot;
+    private int per_page;
+    private int download_type;
+    private int tag_id;
+    private int type;
+    private int display_type;
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public int getDaily_play() {
+        return daily_play;
+    }
+
+    public void setDaily_play(int daily_play) {
+        this.daily_play = daily_play;
+    }
+
+    public int getIs_hot() {
+        return is_hot;
+    }
+
+    public void setIs_hot(int is_hot) {
+        this.is_hot = is_hot;
+    }
+
+    public int getPer_page() {
+        return per_page;
+    }
+
+    public void setPer_page(int per_page) {
+        this.per_page = per_page;
+    }
+
+    public int getDownload_type() {
+        return download_type;
+    }
+
+    public void setDownload_type(int download_type) {
+        this.download_type = download_type;
+    }
+
+    public int getTag_id() {
+        return tag_id;
+    }
+
+    public void setTag_id(int tag_id) {
+        this.tag_id = tag_id;
+    }
+
+    public int getType() {
+        return type;
+    }
+
+    public void setType(int type) {
+        this.type = type;
+    }
+
+    public int getDisplay_type() {
+        return display_type;
+    }
+
+    public void setDisplay_type(int display_type) {
+        this.display_type = display_type;
+    }
+
+    public Map<String, Object> getMap() {
+        Map<String, Object> map = new HashMap<>();
+        if(download_type > 0){
+            map.put("download_type", download_type);
+        } else if(tag_id > 0){
+            map.put("tag_id", tag_id);
+        } else {
+            map.put("is_hot", is_hot);
+            map.put("daily_play", daily_play);
+            map.put("type", type);
+        }
+        return map;
+    }
+}

+ 25 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/GameListTypeList.java

@@ -0,0 +1,25 @@
+package com.sheep.gamegroup.model.entity;
+
+import java.util.List;
+
+/**
+ * Created by realicing on 2018/10/30.
+ * realicing@sina.com
+ */
+public class GameListTypeList<T> {
+    private List<T> list;
+    private GameListType gameListType;
+    public GameListTypeList(GameListType gameListType, List<T> list) {
+        this.gameListType = gameListType;
+        this.list = list;
+    }
+
+    public GameListType getGameListType() {
+        return gameListType;
+    }
+
+    public List<T> getList() {
+        return list;
+    }
+
+}

+ 161 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/GameRecommend.java

@@ -0,0 +1,161 @@
+package com.sheep.gamegroup.model.entity;
+
+/**
+ * Created by realicing on 2018/10/31.
+ * realicing@sina.com
+ * EndTime:	integer ($int64)
+ * 结束时间
+ * CreateTime:	integer ($int64)
+ * Order:	integer ($int64)
+ * 排序序号:倒序
+ * Url:	string
+ * 背景图地址
+ * StartTime:	integer ($int64)
+ * 开始时间
+ * Status:	integer ($int64)
+ * 1 已经下线 2 已上线 3 即将上线
+ * Platform:	integer ($int32)
+ * 平台 1:android 2:ios
+ * UpdateTime:	integer ($int64)
+ * IsDisplay:	integer ($int32)
+ * 状态 1显示 0不显示
+ * Title:	string
+ * 标题
+ * Id:	integer ($int64)
+ * AppId:	integer ($int64)
+ * 关联 application表id
+ * DisplayType:	integer ($int32)
+ * 1:天天更新 2:重点推荐
+ */
+public class GameRecommend {
+    private int Id;
+
+    private String Url;
+
+    private int Platform;
+
+    private int AppId;
+
+    private int IsDisplay;
+
+    private int UpdateTime;
+
+    private int CreateTime;
+
+    private String Title;
+
+    private int StartTime;
+
+    private int EndTime;
+
+    private int Status;
+
+    private int Order;
+
+    private int DisplayType;
+
+    public void setId(int Id) {
+        this.Id = Id;
+    }
+
+    public int getId() {
+        return this.Id;
+    }
+
+    public void setUrl(String Url) {
+        this.Url = Url;
+    }
+
+    public String getUrl() {
+        return this.Url;
+    }
+
+    public void setPlatform(int Platform) {
+        this.Platform = Platform;
+    }
+
+    public int getPlatform() {
+        return this.Platform;
+    }
+
+    public void setAppId(int AppId) {
+        this.AppId = AppId;
+    }
+
+    public int getAppId() {
+        return this.AppId;
+    }
+
+    public void setIsDisplay(int IsDisplay) {
+        this.IsDisplay = IsDisplay;
+    }
+
+    public int getIsDisplay() {
+        return this.IsDisplay;
+    }
+
+    public void setUpdateTime(int UpdateTime) {
+        this.UpdateTime = UpdateTime;
+    }
+
+    public int getUpdateTime() {
+        return this.UpdateTime;
+    }
+
+    public void setCreateTime(int CreateTime) {
+        this.CreateTime = CreateTime;
+    }
+
+    public int getCreateTime() {
+        return this.CreateTime;
+    }
+
+    public void setTitle(String Title) {
+        this.Title = Title;
+    }
+
+    public String getTitle() {
+        return this.Title;
+    }
+
+    public void setStartTime(int StartTime) {
+        this.StartTime = StartTime;
+    }
+
+    public int getStartTime() {
+        return this.StartTime;
+    }
+
+    public void setEndTime(int EndTime) {
+        this.EndTime = EndTime;
+    }
+
+    public int getEndTime() {
+        return this.EndTime;
+    }
+
+    public void setStatus(int Status) {
+        this.Status = Status;
+    }
+
+    public int getStatus() {
+        return this.Status;
+    }
+
+    public void setOrder(int Order) {
+        this.Order = Order;
+    }
+
+    public int getOrder() {
+        return this.Order;
+    }
+
+    public void setDisplayType(int DisplayType) {
+        this.DisplayType = DisplayType;
+    }
+
+    public int getDisplayType() {
+        return this.DisplayType;
+    }
+
+}

+ 19 - 0
app/src/main/java/com/sheep/gamegroup/model/util/AbsSubscriber.java

@@ -0,0 +1,19 @@
+package com.sheep.gamegroup.model.util;
+
+import rx.Subscriber;
+
+/**
+ * Created by realicing on 2018/10/30.
+ * realicing@sina.com
+ */
+public abstract class AbsSubscriber<T> extends Subscriber<T> {
+    @Override
+    public void onCompleted() {
+
+    }
+
+    @Override
+    public void onError(Throwable e) {
+
+    }
+}

+ 15 - 12
app/src/main/java/com/sheep/gamegroup/util/CommonUtil.java

@@ -2306,20 +2306,23 @@ public class CommonUtil {
     }
     }
 
 
     public void clickBanner(Activity activity, int position, List<SlideshowEty> slideshowEtyLists) {
     public void clickBanner(Activity activity, int position, List<SlideshowEty> slideshowEtyLists) {
-        SlideshowEty clickedGameObj = ListUtil.getItem(slideshowEtyLists, position);
-        if (clickedGameObj == null) {
+        clickBanner(activity, ListUtil.getItem(slideshowEtyLists, position));
+    }
+
+    public void clickBanner(Activity activity, SlideshowEty item) {
+        if (item == null) {
             return;
             return;
         }
         }
         UMConfigUtils.onEvent(UMConfigUtils.Event.BANNER_CLICK_HORIZONTAL);
         UMConfigUtils.onEvent(UMConfigUtils.Event.BANNER_CLICK_HORIZONTAL);
-        UMConfigUtils.IdEvent.BANNER.commit(clickedGameObj.getId());
+        UMConfigUtils.IdEvent.BANNER.commit(item.getId());
         Ext ext;
         Ext ext;
-        switch (clickedGameObj.getType()) {// 0,类型 1跳转试玩赚钱、2单个任务详情、3信用卡办理、4 H5页面、5 微信二维码任务
+        switch (item.getType()) {// 0,类型 1跳转试玩赚钱、2单个任务详情、3信用卡办理、4 H5页面、5 微信二维码任务
             case 1:
             case 1:
                 Jump2View.getInstance()
                 Jump2View.getInstance()
                         .goTryplayView(activity, null);
                         .goTryplayView(activity, null);
                 break;
                 break;
             case 2:
             case 2:
-                ext = EntityUtils.getExtInfo(clickedGameObj.getExt());
+                ext = EntityUtils.getExtInfo(item.getExt());
                 if (ext == null) {
                 if (ext == null) {
                     G.showToast(R.string.error_data);
                     G.showToast(R.string.error_data);
                     return;
                     return;
@@ -2331,8 +2334,8 @@ public class CommonUtil {
                         .goCreditCardTaskList(activity, 3);
                         .goCreditCardTaskList(activity, 3);
                 break;
                 break;
             case 4:
             case 4:
-                if (!TextUtils.isEmpty(clickedGameObj.getObjects())) {
-                    ext = EntityUtils.getExtInfo(clickedGameObj.getExt());
+                if (!TextUtils.isEmpty(item.getObjects())) {
+                    ext = EntityUtils.getExtInfo(item.getExt());
                     if (ext == null) {
                     if (ext == null) {
                         G.showToast(R.string.error_data);
                         G.showToast(R.string.error_data);
                         return;
                         return;
@@ -2345,8 +2348,8 @@ public class CommonUtil {
 
 
                 break;
                 break;
             case 5:
             case 5:
-                if (!TextUtils.isEmpty(clickedGameObj.getObjects())) {
-                    Jump2View.getInstance().goWeb(activity, clickedGameObj.getObjects(), "微信二维码辅助好友注册任务");
+                if (!TextUtils.isEmpty(item.getObjects())) {
+                    Jump2View.getInstance().goWeb(activity, item.getObjects(), "微信二维码辅助好友注册任务");
                 }
                 }
 
 
                 break;
                 break;
@@ -2376,7 +2379,7 @@ public class CommonUtil {
                 Jump2View.getInstance().goXiaomiGameList(activity, null);
                 Jump2View.getInstance().goXiaomiGameList(activity, null);
                 break;
                 break;
             case JUMP_GMAE://游戏详情
             case JUMP_GMAE://游戏详情
-                ext = EntityUtils.getExtInfo(clickedGameObj.getExt());
+                ext = EntityUtils.getExtInfo(item.getExt());
                 if (ext == null) {
                 if (ext == null) {
                     G.showToast(R.string.error_data);
                     G.showToast(R.string.error_data);
                     return;
                     return;
@@ -2387,7 +2390,7 @@ public class CommonUtil {
             case JUMP_FIND_ACT://发现--活动
             case JUMP_FIND_ACT://发现--活动
             case JUMP_FIND_INFORMATION://webView资讯
             case JUMP_FIND_INFORMATION://webView资讯
             case JUMP_FIND_GMAE://发现中的游戏详情
             case JUMP_FIND_GMAE://发现中的游戏详情
-                ext = EntityUtils.getExtInfo(clickedGameObj.getExt());
+                ext = EntityUtils.getExtInfo(item.getExt());
                 if (ext == null) {
                 if (ext == null) {
                     G.showToast(R.string.error_data);
                     G.showToast(R.string.error_data);
                     return;
                     return;
@@ -2395,7 +2398,7 @@ public class CommonUtil {
                 Jump2View.getInstance().goFindItem(activity, ext.getId());
                 Jump2View.getInstance().goFindItem(activity, ext.getId());
                 break;
                 break;
             case JUMP_WATCH_FOCUS://看点
             case JUMP_WATCH_FOCUS://看点
-                ext = EntityUtils.getExtInfo(clickedGameObj.getExt());
+                ext = EntityUtils.getExtInfo(item.getExt());
                 if (ext == null) {
                 if (ext == null) {
                     G.showToast(R.string.error_data);
                     G.showToast(R.string.error_data);
                     return;
                     return;

+ 39 - 11
app/src/main/java/com/sheep/gamegroup/util/Jump2View.java

@@ -25,6 +25,7 @@ import com.sheep.gamegroup.model.entity.DialogConfig;
 import com.sheep.gamegroup.model.entity.DialogEntity;
 import com.sheep.gamegroup.model.entity.DialogEntity;
 import com.sheep.gamegroup.model.entity.FindApp;
 import com.sheep.gamegroup.model.entity.FindApp;
 import com.sheep.gamegroup.model.entity.FindItem;
 import com.sheep.gamegroup.model.entity.FindItem;
+import com.sheep.gamegroup.model.entity.GameListType;
 import com.sheep.gamegroup.model.entity.HomeListEntity;
 import com.sheep.gamegroup.model.entity.HomeListEntity;
 import com.sheep.gamegroup.model.entity.LoginEntity;
 import com.sheep.gamegroup.model.entity.LoginEntity;
 import com.sheep.gamegroup.model.entity.NewbieTask;
 import com.sheep.gamegroup.model.entity.NewbieTask;
@@ -43,7 +44,6 @@ import com.sheep.gamegroup.view.activity.ActBindMobileRegister;
 import com.sheep.gamegroup.view.activity.ActCreditCardTaskList;
 import com.sheep.gamegroup.view.activity.ActCreditCardTaskList;
 import com.sheep.gamegroup.view.activity.ActCreditCardWeb;
 import com.sheep.gamegroup.view.activity.ActCreditCardWeb;
 import com.sheep.gamegroup.view.activity.ActDownloadWelfareList;
 import com.sheep.gamegroup.view.activity.ActDownloadWelfareList;
-import com.sheep.gamegroup.view.activity.ActEverydayPlayGame;
 import com.sheep.gamegroup.view.activity.ActExchangeCMCC;
 import com.sheep.gamegroup.view.activity.ActExchangeCMCC;
 import com.sheep.gamegroup.view.activity.ActFindGame;
 import com.sheep.gamegroup.view.activity.ActFindGame;
 import com.sheep.gamegroup.view.activity.ActFindInformation;
 import com.sheep.gamegroup.view.activity.ActFindInformation;
@@ -67,6 +67,9 @@ import com.sheep.gamegroup.view.activity.ActNewbieTaskList;
 import com.sheep.gamegroup.view.activity.ActNotice;
 import com.sheep.gamegroup.view.activity.ActNotice;
 import com.sheep.gamegroup.view.activity.ActPay;
 import com.sheep.gamegroup.view.activity.ActPay;
 import com.sheep.gamegroup.view.activity.ActPlayGameDetail;
 import com.sheep.gamegroup.view.activity.ActPlayGameDetail;
+import com.sheep.gamegroup.view.activity.ActPlayGameList;
+import com.sheep.gamegroup.view.activity.ActPlayGameRecommendList;
+import com.sheep.gamegroup.view.activity.ActPlayGameUserLikeList;
 import com.sheep.gamegroup.view.activity.ActReservation;
 import com.sheep.gamegroup.view.activity.ActReservation;
 import com.sheep.gamegroup.view.activity.ActSearchApp;
 import com.sheep.gamegroup.view.activity.ActSearchApp;
 import com.sheep.gamegroup.view.activity.ActSearchGame;
 import com.sheep.gamegroup.view.activity.ActSearchGame;
@@ -278,7 +281,7 @@ public class Jump2View {
                         @Override
                         @Override
                         public void onNext(BaseMessage baseMessage) {
                         public void onNext(BaseMessage baseMessage) {
                             CommendApp result = baseMessage.getData(CommendApp.class);
                             CommendApp result = baseMessage.getData(CommendApp.class);
-                            if(!result.getNeed()){//不需要展示
+                            if (!result.getNeed()) {//不需要展示
                                 DataUtil.putAsBoolean(ActMain.FIRST_SHOW_MAIN, false);
                                 DataUtil.putAsBoolean(ActMain.FIRST_SHOW_MAIN, false);
                             }
                             }
                             goHomePageView(context, object);
                             goHomePageView(context, object);
@@ -295,6 +298,7 @@ public class Jump2View {
         }
         }
         goHomePageView(context, object);
         goHomePageView(context, object);
     }
     }
+
     /**
     /**
      * 跳到首页面
      * 跳到首页面
      *
      *
@@ -1796,19 +1800,39 @@ public class Jump2View {
     }
     }
 
 
     /**
     /**
-     * 每日必做、近期最热
+     * 每日必做、近期最热
      */
      */
-    public void goEverydayOrCurrentHotGame(Activity activity, int type) {
-        Intent intent = new Intent(activity, ActEverydayPlayGame.class);
-        intent.putExtra("type", type);
+    public void goActPlayGameList(Activity activity, GameListType gameListType) {
+//        Intent intent = new Intent(activity, TextUtils.equals("猜你喜欢", gameListType.getTitle()) ? ActPlayGameUserLikeList.class : ActPlayGameList.class);
+        Intent intent;
+        switch (gameListType.getTitle()) {
+            case "天天更新":
+            case "重点推荐":
+                intent = new Intent(activity, ActPlayGameRecommendList.class);
+                break;
+            case "猜你喜欢":
+                intent = new Intent(activity, ActPlayGameUserLikeList.class);
+                break;
+            default:
+                intent = new Intent(activity, ActPlayGameList.class);
+                break;
+        }
+        DataUtil.putObject(intent, gameListType);
         activity.startActivity(intent);
         activity.startActivity(intent);
-        GAME_EVERY_DAY_MORE.onEvent("type", type);
+        GAME_EVERY_DAY_MORE.onEvent("title", gameListType.getTitle());
     }
     }
 
 
     /**
     /**
      * 游戏详情
      * 游戏详情
      */
      */
     public void goPlayGameDetail(Activity activity, int id) {
     public void goPlayGameDetail(Activity activity, int id) {
+        if (activity == null) {
+            activity = ActivityManager.getInstance().currentActivity();
+        }
+        if (activity == null) {
+            G.showToast(R.string.coming_soon);
+            return;
+        }
         Intent intent = new Intent(activity, ActPlayGameDetail.class);
         Intent intent = new Intent(activity, ActPlayGameDetail.class);
         intent.putExtra("id", id);
         intent.putExtra("id", id);
         activity.startActivity(intent);
         activity.startActivity(intent);
@@ -2010,13 +2034,14 @@ public class Jump2View {
      */
      */
     public void goActPay(Activity activity, String order_no, String token) {
     public void goActPay(Activity activity, String order_no, String token) {
         activity.startActivityForResult(new Intent(activity, ActPay.class)
         activity.startActivityForResult(new Intent(activity, ActPay.class)
-                .putExtra("order_no", order_no)
-                .putExtra("token", token),
+                        .putExtra("order_no", order_no)
+                        .putExtra("token", token),
                 ActPay.RESULT_CODE);
                 ActPay.RESULT_CODE);
     }
     }
 
 
     /**
     /**
      * 启动下载后台服务进行下载
      * 启动下载后台服务进行下载
+     *
      * @param context
      * @param context
      * @param downLoadInfo
      * @param downLoadInfo
      */
      */
@@ -2026,18 +2051,21 @@ public class Jump2View {
 
 
     /**
     /**
      * 有米科技
      * 有米科技
+     *
      * @param activity
      * @param activity
      */
      */
     public void goTestYm(Activity activity) {
     public void goTestYm(Activity activity) {
         activity.startActivity(new Intent(activity, PermissionCheckActivity.class));
         activity.startActivity(new Intent(activity, PermissionCheckActivity.class));
     }
     }
+
     /**
     /**
      * 有米科技
      * 有米科技
+     *
      * @param activity
      * @param activity
      */
      */
     public void goYm(final Activity activity) {
     public void goYm(final Activity activity) {
-        if(activity instanceof BaseActYmPermissionCheck) {
-            if(YmConfig.isToastTotalPrice()) {
+        if (activity instanceof BaseActYmPermissionCheck) {
+            if (YmConfig.isToastTotalPrice()) {
                 //获取总积分
                 //获取总积分
                 SheepApp.getInstance().getNetComponent().getApiService().getYmTotalPrice()
                 SheepApp.getInstance().getNetComponent().getApiService().getYmTotalPrice()
                         .subscribeOn(Schedulers.io())
                         .subscribeOn(Schedulers.io())

+ 23 - 0
app/src/main/java/com/sheep/gamegroup/util/ObservableUtil.java

@@ -0,0 +1,23 @@
+package com.sheep.gamegroup.util;
+
+import com.sheep.gamegroup.model.api.ApiService;
+import com.sheep.gamegroup.model.entity.BaseMessage;
+import com.sheep.gamegroup.model.entity.GameListType;
+
+import rx.Observable;
+
+/**
+ * Created by realicing on 2018/10/31.
+ * realicing@sina.com
+ */
+public class ObservableUtil {
+    //根据游戏列表类型来获取Observable
+    public static Observable<BaseMessage> getObservable(ApiService apiService, GameListType gameListType) {
+        switch (gameListType.getTitle()) {
+            case "猜你喜欢":
+                return apiService.getUserLikeList();
+            default:
+                return apiService.getPlayGameList(1, 20, gameListType.getMap());
+        }
+    }
+}

+ 12 - 0
app/src/main/java/com/sheep/gamegroup/util/StringUtils.java

@@ -16,6 +16,7 @@ import java.text.SimpleDateFormat;
 import java.util.Calendar;
 import java.util.Calendar;
 import java.util.GregorianCalendar;
 import java.util.GregorianCalendar;
 import java.util.Hashtable;
 import java.util.Hashtable;
+import java.util.Map;
 import java.util.regex.Matcher;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.regex.Pattern;
 
 
@@ -291,4 +292,15 @@ public class StringUtils {
         }
         }
         return message;
         return message;
     }
     }
+
+    //组装参数
+    public static String addParams(Map<String, Object> map) {
+        StringBuilder stringBuilder = new StringBuilder();
+        for (Map.Entry<String, Object> stringObjectEntry : map.entrySet()) {
+            stringBuilder.append(stringObjectEntry.getKey());
+            stringBuilder.append("=");
+            stringBuilder.append(stringObjectEntry.getValue());
+        }
+        return stringBuilder.toString();
+    }
 }
 }

+ 4 - 0
app/src/main/java/com/sheep/gamegroup/util/TestUtil.java

@@ -610,4 +610,8 @@ public class TestUtil {
 //        return BuildConfig.DEBUG;//测试充值与绑定微信和身份信息逻辑
 //        return BuildConfig.DEBUG;//测试充值与绑定微信和身份信息逻辑
         return false;
         return false;
     }
     }
+    //开启后可跳转各种广告与升级
+    public static boolean isDev() {
+        return BuildConfig.DEBUG;
+    }
 }
 }

+ 10 - 3
app/src/main/java/com/sheep/gamegroup/util/ViewUtil.java

@@ -1648,7 +1648,7 @@ public class ViewUtil {
     }
     }
 
 
     /**
     /**
-     * 标签类型(0无,1热门,2最新,3现金,4活跃,5福利)
+     * 标签类型(0无,1热门,2最新,3现金,4活跃,5福利,6红包
      * homepage item statues
      * homepage item statues
      */
      */
     public void showGridviewStatues(Context context, TextView textView, HomeListEntity entity) {
     public void showGridviewStatues(Context context, TextView textView, HomeListEntity entity) {
@@ -1669,8 +1669,8 @@ public class ViewUtil {
                 break;
                 break;
             case 2:
             case 2:
                 textView.setVisibility(View.VISIBLE);
                 textView.setVisibility(View.VISIBLE);
-                textView.setBackgroundResource(R.drawable.shape_red_stroke_rectangle_no_lb);
-                textView.setTextColor(context.getResources().getColor(R.color.red_FD2D54));
+                textView.setBackgroundResource(R.drawable.shape_f07422_stroke_retangle_no_lb);
+                textView.setTextColor(context.getResources().getColor(R.color.red_F07422));
                 textView.setText("最新");
                 textView.setText("最新");
                 textView.setPadding(padding2, padding1, padding2, padding1);
                 textView.setPadding(padding2, padding1, padding2, padding1);
                 break;
                 break;
@@ -1695,6 +1695,13 @@ public class ViewUtil {
                 textView.setText("福利");
                 textView.setText("福利");
                 textView.setPadding(padding2, padding1, padding2, padding1);
                 textView.setPadding(padding2, padding1, padding2, padding1);
                 break;
                 break;
+            case 6:
+                textView.setVisibility(View.VISIBLE);
+                textView.setBackgroundResource(R.drawable.shape_red_stroke_rectangle_no_lb);
+                textView.setTextColor(context.getResources().getColor(R.color.red_FD2D54));
+                textView.setText("红包");
+                textView.setPadding(padding2, padding1, padding2, padding1);
+                break;
         }
         }
 
 
     }
     }

+ 0 - 54
app/src/main/java/com/sheep/gamegroup/view/activity/ActEverydayPlayGame.java

@@ -1,54 +0,0 @@
-package com.sheep.gamegroup.view.activity;
-
-import android.support.v7.widget.RecyclerView;
-
-import com.sheep.gamegroup.model.api.ApiService;
-import com.sheep.gamegroup.model.entity.BaseMessage;
-import com.sheep.gamegroup.model.entity.GameEntity;
-import com.sheep.gamegroup.model.entity.PlayGameEntity;
-import com.sheep.gamegroup.view.adapter.PlayGameItemAdapter;
-import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
-
-import java.util.Locale;
-
-import rx.Observable;
-
-/**
- * 每日必做和热门
- * Created by ljy on 2018/9/3.
- */
-
-public class ActEverydayPlayGame extends BaseListActivity<GameEntity> {
-    private int type;
-    @Override
-    protected RecyclerView.Adapter getAdapter() {
-        return new PlayGameItemAdapter(activity, list);
-    }
-
-    @Override
-    protected String getKey(int page, int per_page) {
-        return type == 0 ?String.format(Locale.CHINA, "app/find?page=%d&per_page=%d&is_hot=%d&daily_play=%d&type=%d", page, per_page, 0, 1, 0)
-                :String.format(Locale.CHINA, "app/find?page=%d&per_page=%d&is_hot=%d&daily_play=%d&type=%d", page, per_page, 1, 0, 0);
-    }
-
-    @Override
-    protected Observable<BaseMessage> getApi(ApiService apiService) {
-        return type == 0 ? apiService.playgameDailyOrHotOrTypePlay(page, per_page, 0, 1, 0)
-                : apiService.playgameDailyOrHotOrTypePlay(page, per_page, 1, 0, 0);
-    }
-
-    @Override
-    protected Class<GameEntity> getTClass() {
-            return GameEntity.class;
-    }
-
-    @Override
-    protected int getType() {
-        type = getIntent().getIntExtra("type", 0);
-        TitleBarUtils
-                .getInstance()
-                .setTitle(activity, type==0?"每日必做":"近期最热")
-                .setTitleFinish(activity);
-        return type;
-    }
-}

+ 1 - 2
app/src/main/java/com/sheep/gamegroup/view/activity/ActMain.java

@@ -17,7 +17,6 @@ import android.widget.TextView;
 
 
 import com.kfzs.duanduan.utils.StatusBarUtils;
 import com.kfzs.duanduan.utils.StatusBarUtils;
 import com.kfzs.duanduan.view.DialogStorageLow;
 import com.kfzs.duanduan.view.DialogStorageLow;
-import com.sheep.gamegroup.absBase.BaseActivity;
 import com.sheep.gamegroup.event.BigEvent;
 import com.sheep.gamegroup.event.BigEvent;
 import com.sheep.gamegroup.greendao.download.DownLoadInfo;
 import com.sheep.gamegroup.greendao.download.DownLoadInfo;
 import com.sheep.gamegroup.helper.DownloadHelper;
 import com.sheep.gamegroup.helper.DownloadHelper;
@@ -336,7 +335,7 @@ public class ActMain extends BaseActYmPermissionCheck  {
                 DataUtil.putAsBoolean("tryShowHalfScreenAd", true);
                 DataUtil.putAsBoolean("tryShowHalfScreenAd", true);
             }
             }
         } else {
         } else {
-            if (onResumeCount == 0) {
+            if (onResumeCount == 0 && !TestUtil.isDev()) {
                 SysAppUtil.showVersionInfo(this, SpUtils.getIgnoreMd5(), new Action1<Integer>() {
                 SysAppUtil.showVersionInfo(this, SpUtils.getIgnoreMd5(), new Action1<Integer>() {
                     @Override
                     @Override
                     public void call(Integer integer) {
                     public void call(Integer integer) {

+ 53 - 0
app/src/main/java/com/sheep/gamegroup/view/activity/ActPlayGameList.java

@@ -0,0 +1,53 @@
+package com.sheep.gamegroup.view.activity;
+
+import android.support.v7.widget.RecyclerView;
+
+import com.sheep.gamegroup.model.api.ApiService;
+import com.sheep.gamegroup.model.entity.BaseMessage;
+import com.sheep.gamegroup.model.entity.GameEntity;
+import com.sheep.gamegroup.model.entity.GameListType;
+import com.sheep.gamegroup.util.DataUtil;
+import com.sheep.gamegroup.util.StringUtils;
+import com.sheep.gamegroup.view.adapter.PlayGameItemAdapter;
+import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
+
+import java.util.Locale;
+
+import rx.Observable;
+/**
+ * Created by realicing on 2018/10/31.
+ * realicing@sina.com
+ * 游戏列表
+ */
+public class ActPlayGameList extends BaseListActivity2<GameEntity> {
+    private GameListType gameListType;
+
+    @Override
+    public void initView() {
+        gameListType = DataUtil.getObject(getIntent(), GameListType.class);
+        TitleBarUtils
+                .getInstance()
+                .setTitle(this, gameListType.getTitle())
+                .setTitleFinish(this);
+    }
+    @Override
+    protected RecyclerView.Adapter getAdapter() {
+        return new PlayGameItemAdapter(this, list);
+    }
+
+    @Override
+    protected String getKey(int page, int per_page) {
+        return String.format(Locale.CHINA, "app/find?page=%d&per_page=%d&%s", page, per_page, StringUtils.addParams(gameListType.getMap()));
+    }
+
+    @Override
+    protected Observable<BaseMessage> getApi(ApiService apiService) {
+        return apiService.getPlayGameList(page, per_page, gameListType.getMap());
+    }
+
+    @Override
+    protected Class<GameEntity> getTClass() {
+            return GameEntity.class;
+    }
+
+}

+ 59 - 0
app/src/main/java/com/sheep/gamegroup/view/activity/ActPlayGameRecommendList.java

@@ -0,0 +1,59 @@
+package com.sheep.gamegroup.view.activity;
+
+import android.support.v7.widget.RecyclerView;
+
+import com.sheep.gamegroup.model.api.ApiService;
+import com.sheep.gamegroup.model.entity.BaseMessage;
+import com.sheep.gamegroup.model.entity.GameEntity;
+import com.sheep.gamegroup.model.entity.GameListType;
+import com.sheep.gamegroup.util.DataUtil;
+import com.sheep.gamegroup.view.adapter.PlayGameItemAdapter;
+import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
+
+import java.util.Locale;
+
+import rx.Observable;
+
+/**
+ * Created by realicing on 2018/10/31.
+ * realicing@sina.com
+ * 猜你喜欢游戏列表
+ */
+public class ActPlayGameRecommendList extends BaseListActivity2<GameEntity> {
+
+    private GameListType gameListType;
+    @Override
+    public void initView() {
+        gameListType = DataUtil.getObject(getIntent(), GameListType.class);
+        TitleBarUtils
+                .getInstance()
+                .setTitle(this, gameListType.getTitle())
+                .setTitleFinish(this);
+    }
+    @Override
+    protected RecyclerView.Adapter getAdapter() {
+        return new PlayGameItemAdapter(this, list);
+    }
+
+    @Override
+    protected String getKey(int page, int per_page) {
+        return String.format(Locale.CHINA, "app/find/recommend/list?display_type=%d", gameListType.getDisplay_type());
+    }
+
+    @Override
+    protected Observable<BaseMessage> getApi(ApiService apiService) {
+        return apiService.getRecommendListMore(gameListType.getDisplay_type());
+    }
+
+    @Override
+    protected Class<GameEntity> getTClass() {
+            return GameEntity.class;
+    }
+
+    @Override
+    public void notifyDataSetChanged() {
+        if(!list.isEmpty())
+            setNoMore(true);
+        super.notifyDataSetChanged();
+    }
+}

+ 59 - 0
app/src/main/java/com/sheep/gamegroup/view/activity/ActPlayGameUserLikeList.java

@@ -0,0 +1,59 @@
+package com.sheep.gamegroup.view.activity;
+
+import android.support.v7.widget.RecyclerView;
+
+import com.sheep.gamegroup.model.api.ApiService;
+import com.sheep.gamegroup.model.entity.BaseMessage;
+import com.sheep.gamegroup.model.entity.GameEntity;
+import com.sheep.gamegroup.model.entity.GameListType;
+import com.sheep.gamegroup.util.DataUtil;
+import com.sheep.gamegroup.util.StringUtils;
+import com.sheep.gamegroup.view.adapter.PlayGameItemAdapter;
+import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
+
+import java.util.Locale;
+
+import rx.Observable;
+
+/**
+ * Created by realicing on 2018/10/31.
+ * realicing@sina.com
+ * 猜你喜欢游戏列表
+ */
+public class ActPlayGameUserLikeList extends BaseListActivity2<GameEntity> {
+
+    @Override
+    public void initView() {
+        GameListType gameListType = DataUtil.getObject(getIntent(), GameListType.class);
+        TitleBarUtils
+                .getInstance()
+                .setTitle(this, gameListType.getTitle())
+                .setTitleFinish(this);
+    }
+    @Override
+    protected RecyclerView.Adapter getAdapter() {
+        return new PlayGameItemAdapter(this, list);
+    }
+
+    @Override
+    protected String getKey(int page, int per_page) {
+        return "app/find/recommend/user_like";
+    }
+
+    @Override
+    protected Observable<BaseMessage> getApi(ApiService apiService) {
+        return apiService.getUserLikeList();
+    }
+
+    @Override
+    protected Class<GameEntity> getTClass() {
+            return GameEntity.class;
+    }
+
+    @Override
+    public void notifyDataSetChanged() {
+        if(!list.isEmpty())
+            setNoMore(true);
+        super.notifyDataSetChanged();
+    }
+}

+ 127 - 114
app/src/main/java/com/sheep/gamegroup/view/activity/BaseListActivity.java

@@ -1,10 +1,7 @@
 package com.sheep.gamegroup.view.activity;
 package com.sheep.gamegroup.view.activity;
 
 
-import android.app.Activity;
-import android.os.Bundle;
 import android.support.v7.widget.LinearLayoutManager;
 import android.support.v7.widget.LinearLayoutManager;
 import android.support.v7.widget.RecyclerView;
 import android.support.v7.widget.RecyclerView;
-import android.util.Log;
 import android.view.View;
 import android.view.View;
 
 
 import com.jcodecraeer.xrecyclerview.XRecyclerView;
 import com.jcodecraeer.xrecyclerview.XRecyclerView;
@@ -29,45 +26,51 @@ import rx.functions.Action1;
 import rx.schedulers.Schedulers;
 import rx.schedulers.Schedulers;
 
 
 /**
 /**
- * Created by ljy on 2018/9/3.
+ * Created by realicing on 2018/9/3.
+ * realicing@sina.com
+ * 自己可以进行刷新与加载更多,使用com.jcodecraeer.xrecyclerview.XRecyclerView来实现,子类提供网络接口相关
  */
  */
-
-public abstract class BaseListActivity<T> extends BaseActivity {
-
-    @BindView(R.id.title)
-    View title;
-    @BindView(R.id.empty_view)
-    View empty_view;
-    @BindView(R.id.check_net_ll)
-    View check_net_ll;
-    @BindView(R.id.view_list)
-    XRecyclerView view_list;
-    protected Activity activity;
-
+public abstract class BaseListActivity2<T> extends BaseActivity {
     @Override
     @Override
-    protected int getLayoutId() {
+    public int getLayoutId() {
         return R.layout.net_empty_xrecycler;
         return R.layout.net_empty_xrecycler;
     }
     }
 
 
     @Override
     @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        activity = this;
-        getType();
-        initView();
-        initListener();
-        if(!refreshDataAfterOnResume())
-            ViewUtil.refreshXrv(view_list);
+    public void initData() {
+        switch (refreshDataType()) {
+            case REFRESH_ON_CREATE:
+                ViewUtil.refreshXrv(view_list);
+                break;
+            case REFRESH_ON_RESUME:
+                break;
+            case REFRESH_ON_YOURSELF:
+            default:
+                notifyDataSetChanged();
+                break;
+        }
     }
     }
 
 
+    public static final int REFRESH_ON_CREATE = 0;
+    public static final int REFRESH_ON_RESUME = 1;
+    public static final int REFRESH_ON_YOURSELF = -1;
+    @BindView(R.id.title)
+    protected View title;
+    @BindView(R.id.empty_view)
+    protected View empty_view;
+    @BindView(R.id.check_net_ll)
+    protected View check_net_ll;
+    @BindView(R.id.view_list)
+    protected XRecyclerView view_list;
+
+    protected BaseMessage lastMessage;//最后一个网络获取的结果
     protected int page = 1;//页数
     protected int page = 1;//页数
     protected int per_page = DataUtil.PER_PAGE;
     protected int per_page = DataUtil.PER_PAGE;
-    protected BaseMessage lastMessage;//最后一个网络获取的结果
-    private boolean noMore = false;
-    public void initView() {
-//        title.setVisibility(View.GONE);
-    }
-    private View bottomLine;
+    private boolean loadMore;
+
+    protected View bottomLine;
+
+    @Override
     public void initListener() {
     public void initListener() {
         view_list.setLoadingListener(new XRecyclerView.LoadingListener() {
         view_list.setLoadingListener(new XRecyclerView.LoadingListener() {
             @Override
             @Override
@@ -77,71 +80,45 @@ public abstract class BaseListActivity<T> extends BaseActivity {
 
 
             @Override
             @Override
             public void onLoadMore() {
             public void onLoadMore() {
-                if(ListUtil.size(list) >= per_page*page){
-                    page += 1;
-                    initData();
-                }else {
-                    view_list.setNoMore(true);
-                    setNoMore(true);
-                }
+                loadMoreData();
+
             }
             }
         });
         });
-        bottomLine = ViewUtil.setBottomLine(view_list);
+        bottomLine = ViewUtil.setBottomLine(view_list, getNoMoreCallBack());
         view_list.setLayoutManager(new LinearLayoutManager(SheepApp.getInstance()));
         view_list.setLayoutManager(new LinearLayoutManager(SheepApp.getInstance()));
         view_list.setAdapter(getAdapter());
         view_list.setAdapter(getAdapter());
-        view_list.addOnScrollListener(new RecyclerView.OnScrollListener() {
-            boolean isSlidingToLast;
-            @Override
-            public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
-                super.onScrollStateChanged(recyclerView, newState);
-
-                RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager();
-
-                if(layoutManager instanceof LinearLayoutManager){
-                    LinearLayoutManager linearLayoutManager = (LinearLayoutManager) layoutManager;
-
-                    //获取最后一个完全显示的item的position
-                    int lastVisibleItem = linearLayoutManager.findLastCompletelyVisibleItemPosition();
-                    int totalCount = linearLayoutManager.getItemCount();
-                    Log.e("lastvisi_item_-----", lastVisibleItem+","+totalCount);
-
-                    if(newState == RecyclerView.SCROLL_STATE_IDLE && isSlidingToLast){//滑动到了底部
-                        if(ListUtil.size(list) >= per_page*page){
-
-
-                        }
-
-                    }
-                }
-            }
-
-            @Override
-            public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
-                super.onScrolled(recyclerView, dx, dy);
-                Log.e("dx-----", dx+","+dy);
-                if (dy > 0) {
-                    //大于0表示正在向下滚动
-                    isSlidingToLast = true;
-                } else {
-                    //小于等于0表示停止或向上滚动
-                    isSlidingToLast = false;
-                }
+    }
 
 
+    protected void loadMoreData() {
+        if (!loadMore) {
+            loadMore = true;
+            if (ListUtil.size(list) >= per_page * page) {
+                page += 1;
+                mInitData();
+            } else {
+                view_list.setNoMore(true);
+                setNoMore(true);
             }
             }
-        });
-
+        } else {
+            view_list.loadMoreComplete();
+        }
     }
     }
 
 
+    public void setNoMore(boolean noMore) {
+        this.noMore = noMore;
+    }
 
 
     protected List<T> list = ListUtil.emptyList();
     protected List<T> list = ListUtil.emptyList();
     protected List<T> lastCacheList = ListUtil.emptyList();
     protected List<T> lastCacheList = ListUtil.emptyList();
+
     //默认先获取缓存
     //默认先获取缓存
-    protected boolean isFirstGetACache(){
+    protected boolean isFirstGetACache() {
         return true;
         return true;
     }
     }
-    public void initData() {
+
+    public void mInitData() {
         final String urlKey = getKey(page, per_page);
         final String urlKey = getKey(page, per_page);
-        if(isFirstGetACache()) {
+        if (isFirstGetACache()) {
             //先尝试获取缓存数据
             //先尝试获取缓存数据
             lastCacheList = DataUtil.getInstance().getCacheList(urlKey, getTClass());
             lastCacheList = DataUtil.getInstance().getCacheList(urlKey, getTClass());
             loadList(lastCacheList);
             loadList(lastCacheList);
@@ -149,11 +126,11 @@ public abstract class BaseListActivity<T> extends BaseActivity {
         SysAppUtil.checkNet(new Action1<Integer>() {
         SysAppUtil.checkNet(new Action1<Integer>() {
             @Override
             @Override
             public void call(Integer result) {
             public void call(Integer result) {
-                if(result != 0){//无网络
-                    if(check_net_ll != null)
+                if (result != 0) {//无网络
+                    if (check_net_ll != null)
                         check_net_ll.setVisibility(View.VISIBLE);
                         check_net_ll.setVisibility(View.VISIBLE);
                 } else {
                 } else {
-                    if(check_net_ll != null)
+                    if (check_net_ll != null)
                         check_net_ll.setVisibility(View.GONE);
                         check_net_ll.setVisibility(View.GONE);
                 }
                 }
             }
             }
@@ -166,12 +143,12 @@ public abstract class BaseListActivity<T> extends BaseActivity {
                     public void onNext(BaseMessage baseMessage) {
                     public void onNext(BaseMessage baseMessage) {
                         lastMessage = baseMessage;
                         lastMessage = baseMessage;
                         boolean isNewData = DataUtil.getInstance().isNewData(urlKey);
                         boolean isNewData = DataUtil.getInstance().isNewData(urlKey);
-                        if(isNewData || !isFirstGetACache()) {
-                            if(isFirstGetACache())
+                        if (isNewData || !isFirstGetACache()) {
+                            if (isFirstGetACache())
                                 ListUtil.removeAll(list, lastCacheList);
                                 ListUtil.removeAll(list, lastCacheList);
                             List<T> newList = baseMessage.getDatas(getTClass());
                             List<T> newList = baseMessage.getDatas(getTClass());
                             loadList(newList);
                             loadList(newList);
-                        }else {
+                        } else {
                             notifyDataSetChanged();
                             notifyDataSetChanged();
                         }
                         }
                     }
                     }
@@ -183,52 +160,88 @@ public abstract class BaseListActivity<T> extends BaseActivity {
                 });
                 });
     }
     }
 
 
-    public void refreshData(){
+    public Action1<String> getNoMoreCallBack() {
+        return null;
+    }
+
+
+    @Override
+    public void onResume() {
+        super.onResume();
+        if (refreshDataType() == REFRESH_ON_RESUME) {
+            ViewUtil.refreshXrv(view_list);
+        }
+    }
+
+    /**
+     * 在哪里初始化数据:0 onViewCreated后, 1 onResume后, -1 不初始化
+     *
+     * @return
+     */
+    public int refreshDataType() {
+        return REFRESH_ON_CREATE;
+    }
+
+    public void clear() {
         lastMessage = null;
         lastMessage = null;
         setNoMore(false);
         setNoMore(false);
         empty_view.setVisibility(View.INVISIBLE);
         empty_view.setVisibility(View.INVISIBLE);
         list.clear();
         list.clear();
-        view_list.getAdapter().notifyDataSetChanged();
         page = 1;
         page = 1;
-        initData();
     }
     }
-    private void loadList(List<T> newList){
-        ListUtil.addAllItem(list, newList);
+
+    public void refreshData() {
+        clear();
+        view_list.getAdapter().notifyDataSetChanged();
+        mInitData();
+    }
+
+    protected List<T> newList;
+
+    protected void loadList(List<T> addList) {
+        ListUtil.addAllItem(list, addList);
+        newList = addList;
         notifyDataSetChanged();
         notifyDataSetChanged();
     }
     }
-    protected void notifyDataSetChanged(){
 
 
-        if(view_list == null)
+    public void notifyDataSetChanged() {
+        if (view_list == null)
             view_list = findViewById(R.id.view_list);
             view_list = findViewById(R.id.view_list);
-        if(empty_view == null)
-            empty_view = findViewById(R.id.empty_view);
-        if(empty_view == null)
+        if (empty_view == null)
             empty_view = findViewById(R.id.empty_view);
             empty_view = findViewById(R.id.empty_view);
-        CommonUtil.getInstance().updateEmptyView(empty_view, list.isEmpty());
-        bottomLine.setVisibility(list.isEmpty() ? View.INVISIBLE : View.VISIBLE);
-        if(page == 1){
+        loadMore = false;
+        updateEmptyView();
+        if (page == 1) {
             view_list.refreshComplete();
             view_list.refreshComplete();
         } else {
         } else {
             view_list.loadMoreComplete();
             view_list.loadMoreComplete();
         }
         }
         view_list.getAdapter().notifyDataSetChanged();
         view_list.getAdapter().notifyDataSetChanged();
+        notifyData();
+        view_list.getFootView().setVisibility(view_list.getAdapter().getItemCount() == 0 ? View.GONE : View.VISIBLE);
     }
     }
 
 
-    /**
-     * 每次都在onResume方法中进行更新数据
-     * @return
-     */
-    public boolean refreshDataAfterOnResume() {
-        return false;
+    protected void updateEmptyView() {
+        CommonUtil.getInstance().updateEmptyView(empty_view, list.isEmpty());
     }
     }
+
     @Override
     @Override
-    public void onResume() {
-        super.onResume();
-        if(refreshDataAfterOnResume()){
-            ViewUtil.refreshXrv(view_list);
+    protected void onDestroy() {
+        super.onDestroy();
+        // any time,when you finish your activity or fragment,call this below
+        if (view_list != null) {
+            view_list.destroy(); // this will totally release XR's memory
+            view_list = null;
         }
         }
     }
     }
 
 
+
+    private boolean noMore = false;
+
+    public boolean isNoMore() {
+        return noMore;
+    }
+
     protected abstract RecyclerView.Adapter getAdapter();
     protected abstract RecyclerView.Adapter getAdapter();
 
 
     protected abstract String getKey(int page, int per_page);
     protected abstract String getKey(int page, int per_page);
@@ -237,8 +250,8 @@ public abstract class BaseListActivity<T> extends BaseActivity {
 
 
     protected abstract Class<T> getTClass();
     protected abstract Class<T> getTClass();
 
 
-    protected abstract int getType();
-    public void setNoMore(boolean noMore) {
-        this.noMore = noMore;
+    //刷新数据的回调,子类可以实现自己的需求
+    public void notifyData() {
+
     }
     }
 }
 }

+ 3 - 1
app/src/main/java/com/sheep/gamegroup/view/activity/SplashAct.java

@@ -31,6 +31,8 @@ import com.sheep.gamegroup.util.Jump2View;
 import com.sheep.gamegroup.util.LogUtil;
 import com.sheep.gamegroup.util.LogUtil;
 import com.sheep.gamegroup.util.RxjavaCountDownTimer;
 import com.sheep.gamegroup.util.RxjavaCountDownTimer;
 import com.sheep.gamegroup.util.SysAppUtil;
 import com.sheep.gamegroup.util.SysAppUtil;
+import com.sheep.gamegroup.util.TestUtil;
+import com.sheep.jiuyan.samllsheep.BuildConfig;
 import com.sheep.jiuyan.samllsheep.R;
 import com.sheep.jiuyan.samllsheep.R;
 import com.sheep.jiuyan.samllsheep.SheepApp;
 import com.sheep.jiuyan.samllsheep.SheepApp;
 
 
@@ -134,7 +136,7 @@ public class SplashAct extends BaseActivity implements EasyPermissions.Permissio
                         sendHandlerMessages(100);
                         sendHandlerMessages(100);
                     break;
                     break;
                 case 1:
                 case 1:
-                    if(SysAppUtil.isNewSmallSheep()){//新版本只显示引导页面,不展示弹窗和开屏广告
+                    if(SysAppUtil.isNewSmallSheep() || TestUtil.isDev()){//新版本只显示引导页面,不展示弹窗和开屏广告
                         isLoadingData = false;
                         isLoadingData = false;
                         sendHandlerMessages(200);
                         sendHandlerMessages(200);
                     } else {
                     } else {

+ 76 - 0
app/src/main/java/com/sheep/gamegroup/view/adapter/AdpGameCenter1_2List.java

@@ -0,0 +1,76 @@
+package com.sheep.gamegroup.view.adapter;
+
+import android.app.Activity;
+import android.content.Context;
+import android.support.v7.widget.LinearLayoutManager;
+import android.support.v7.widget.RecyclerView;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.kfzs.appstore.utils.adapter.recyclerview.RecyclerViewAdapter;
+import com.kfzs.appstore.utils.adapter.recyclerview.ViewHolder;
+import com.sheep.gamegroup.model.entity.GameEntity;
+import com.sheep.gamegroup.model.entity.GameEntityList;
+import com.sheep.gamegroup.model.entity.GameListTypeList;
+import com.sheep.gamegroup.model.entity.GameRecommend;
+import com.sheep.gamegroup.util.Jump2View;
+import com.sheep.gamegroup.util.ViewUtil;
+import com.sheep.jiuyan.samllsheep.R;
+import com.sheep.jiuyan.samllsheep.SheepApp;
+
+import java.util.List;
+
+
+/**
+ * Created by realicing on 2018/10/30.
+ * realicing@sina.com
+ * 游戏主页上每一屏显示有1.2个元素
+ */
+public class AdpGameCenter1_2List extends RecyclerViewAdapter<GameListTypeList<GameRecommend>> {
+    public AdpGameCenter1_2List(Context context, List<GameListTypeList<GameRecommend>> gameListTypeLists) {
+        super(context, R.layout.item_play_game_list, gameListTypeLists);
+    }
+
+    @Override
+    public void convert(ViewHolder viewHolder, final GameListTypeList<GameRecommend> gameListTypeList, int position) {
+        TextView item_play_game_list_tv = viewHolder.itemView.findViewById(R.id.item_play_game_list_tv);
+        TextView item_play_game_list_more_tv = viewHolder.itemView.findViewById(R.id.item_play_game_list_more_tv);
+        ViewUtil.setText(item_play_game_list_tv, gameListTypeList.getGameListType().getTitle());
+        item_play_game_list_more_tv.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                if(mContext instanceof Activity)
+                    Jump2View.getInstance().goActPlayGameList((Activity) mContext, gameListTypeList.getGameListType());
+            }
+        });
+        RecyclerView recyclerView = viewHolder.itemView.findViewById(R.id.item_play_game_list_rv);
+        LinearLayoutManager playHotManager = new LinearLayoutManager(SheepApp.getInstance(), LinearLayoutManager.HORIZONTAL, false);
+        recyclerView.setHasFixedSize(true);
+        recyclerView.setNestedScrollingEnabled(false);
+        recyclerView.setLayoutManager(playHotManager);
+        recyclerView.setAdapter(new AdbCommonRecycler<GameRecommend>(SheepApp.getInstance(), gameListTypeList.getList()) {
+            @Override
+            public int getViewIdByType(int type) {
+                return R.layout.item_play_game;
+            }
+
+            @Override
+            public void convert(com.sheep.gamegroup.util.ViewHolder holder, GameRecommend item) {
+                int index = holder.getAdapterPosition();
+                TextView item_play_game_name =  holder.itemView.findViewById(R.id.item_play_game_name);
+                View item_play_game_start =  holder.itemView.findViewById(R.id.item_play_game_start);
+                View item_play_game_end =  holder.itemView.findViewById(R.id.item_play_game_end);
+                ImageView item_play_game_iv =  holder.itemView.findViewById(R.id.item_play_game_iv);
+                ViewUtil.setVisibility(item_play_game_start, index == 0 );
+                ViewUtil.setVisibility(item_play_game_end, index + 1 == listData.size());
+                if(item == null){
+                    ViewUtil.setDefaultText(item_play_game_name);
+                } else {
+                    ViewUtil.setText(item_play_game_name, item.getTitle());
+                    ViewUtil.setImage(item_play_game_iv, item.getUrl(), mContext.getResources().getDimensionPixelSize(R.dimen.content_padding_3));
+                }
+            }
+        });
+    }
+}

+ 85 - 0
app/src/main/java/com/sheep/gamegroup/view/adapter/AdpGameCenter3_3List.java

@@ -0,0 +1,85 @@
+package com.sheep.gamegroup.view.adapter;
+
+import android.app.Activity;
+import android.content.Context;
+import android.support.v7.widget.LinearLayoutManager;
+import android.support.v7.widget.RecyclerView;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.kfzs.appstore.utils.adapter.recyclerview.RecyclerViewAdapter;
+import com.kfzs.appstore.utils.adapter.recyclerview.ViewHolder;
+import com.sheep.gamegroup.model.entity.GameEntity;
+import com.sheep.gamegroup.model.entity.GameEntityList;
+import com.sheep.gamegroup.util.GlideImageLoader;
+import com.sheep.gamegroup.util.Jump2View;
+import com.sheep.gamegroup.util.ViewUtil;
+import com.sheep.jiuyan.samllsheep.R;
+import com.sheep.jiuyan.samllsheep.SheepApp;
+
+import java.util.List;
+
+import static com.sheep.gamegroup.view.adapter.PlayGameListAdapter.setOnClickGameEntity;
+
+
+/**
+ * Created by realicing on 2018/10/30.
+ * realicing@sina.com
+ * 游戏主页上每一屏显示有3.3个元素
+ */
+public class AdpGameCenter3_3List extends RecyclerViewAdapter<GameEntityList> {
+    public AdpGameCenter3_3List(Context context, List<GameEntityList> datas) {
+        super(context, R.layout.item_play_game_list, datas);
+    }
+
+    public AdpGameCenter3_3List setShowFirstTop(boolean showFirstTop) {
+        isShowFirstTop = showFirstTop;
+        return this;
+    }
+
+    private boolean isShowFirstTop = true;
+
+    @Override
+    public void convert(ViewHolder viewHolder, final GameEntityList gameEntityList, int position) {
+        View item_play_game_list_top = viewHolder.itemView.findViewById(R.id.item_play_game_list_top);
+        TextView item_play_game_list_tv = viewHolder.itemView.findViewById(R.id.item_play_game_list_tv);
+        TextView item_play_game_list_more_tv = viewHolder.itemView.findViewById(R.id.item_play_game_list_more_tv);
+        if(!isShowFirstTop)//不显示第一项的线
+            ViewUtil.setVisibility(item_play_game_list_top, position != 0);
+        ViewUtil.setText(item_play_game_list_tv, gameEntityList.getGameListType().getTitle());
+        item_play_game_list_more_tv.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                if(mContext instanceof Activity)
+                    Jump2View.getInstance().goActPlayGameList((Activity) mContext, gameEntityList.getGameListType());
+            }
+        });
+        RecyclerView recyclerView = viewHolder.itemView.findViewById(R.id.item_play_game_list_rv);
+        LinearLayoutManager playHotManager = new LinearLayoutManager(SheepApp.getInstance(), LinearLayoutManager.HORIZONTAL, false);
+        recyclerView.setHasFixedSize(true);
+        recyclerView.setNestedScrollingEnabled(false);
+        recyclerView.setLayoutManager(playHotManager);
+        recyclerView.setAdapter(new AdbCommonRecycler<GameEntity>(SheepApp.getInstance(), gameEntityList.getList()) {
+            @Override
+            public int getViewIdByType(int type) {
+                return R.layout.item_hot_welfare;
+            }
+
+            @Override
+            public void convert(com.sheep.gamegroup.util.ViewHolder holder, GameEntity item) {
+                ImageView item_hot_welfare_iv =  holder.itemView.findViewById(R.id.item_hot_welfare_iv);
+                TextView item_hot_welfare_tv = holder.itemView.findViewById(R.id.item_hot_welfare_tv);
+                if(item == null){
+                    ViewUtil.setDefaultText(item_hot_welfare_tv);
+                } else {
+                    // 加载数据
+                    ViewUtil.setText(item_hot_welfare_tv, item.getApp().getName());
+                    GlideImageLoader.setGameImage(item_hot_welfare_iv, item.getApp().getIcon());
+                    if(mContext instanceof Activity)
+                        setOnClickGameEntity((Activity) mContext, holder.itemView, item);
+                }
+            }
+        });
+    }
+}

+ 268 - 223
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtPlayGame.java

@@ -3,8 +3,6 @@ package com.sheep.gamegroup.view.fragment;
 import android.app.Activity;
 import android.app.Activity;
 import android.content.Context;
 import android.content.Context;
 import android.support.annotation.NonNull;
 import android.support.annotation.NonNull;
-import android.support.design.widget.TabLayout;
-import android.support.v4.view.ViewPager;
 import android.support.v4.widget.NestedScrollView;
 import android.support.v4.widget.NestedScrollView;
 import android.support.v7.widget.LinearLayoutManager;
 import android.support.v7.widget.LinearLayoutManager;
 import android.support.v7.widget.RecyclerView;
 import android.support.v7.widget.RecyclerView;
@@ -15,24 +13,28 @@ import android.widget.TextView;
 
 
 import com.bumptech.glide.Glide;
 import com.bumptech.glide.Glide;
 import com.bumptech.glide.request.RequestOptions;
 import com.bumptech.glide.request.RequestOptions;
+import com.kfzs.appstore.utils.adapter.recyclerview.RecyclerViewAdapter;
 import com.scwang.smartrefresh.layout.SmartRefreshLayout;
 import com.scwang.smartrefresh.layout.SmartRefreshLayout;
 import com.scwang.smartrefresh.layout.api.RefreshLayout;
 import com.scwang.smartrefresh.layout.api.RefreshLayout;
-import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
+import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
 import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.BaseMessage;
-import com.sheep.gamegroup.model.entity.FindTag;
 import com.sheep.gamegroup.model.entity.GameEntity;
 import com.sheep.gamegroup.model.entity.GameEntity;
+import com.sheep.gamegroup.model.entity.GameEntityList;
+import com.sheep.gamegroup.model.entity.GameListTag;
+import com.sheep.gamegroup.model.entity.GameListType;
+import com.sheep.gamegroup.model.entity.GameListTypeList;
+import com.sheep.gamegroup.model.entity.GameRecommend;
 import com.sheep.gamegroup.model.entity.SlideshowEty;
 import com.sheep.gamegroup.model.entity.SlideshowEty;
+import com.sheep.gamegroup.model.util.AbsSubscriber;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
 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.GlideImageLoader;
-import com.sheep.gamegroup.util.Jump2View;
 import com.sheep.gamegroup.util.ListUtil;
 import com.sheep.gamegroup.util.ListUtil;
+import com.sheep.gamegroup.util.ObservableUtil;
 import com.sheep.gamegroup.util.RefreshUtil;
 import com.sheep.gamegroup.util.RefreshUtil;
-import com.sheep.gamegroup.util.ViewHolder;
 import com.sheep.gamegroup.util.ViewUtil;
 import com.sheep.gamegroup.util.ViewUtil;
-import com.sheep.gamegroup.view.adapter.AdbCommonRecycler;
-import com.sheep.gamegroup.view.adapter.TitleFragmentListAdapter;
+import com.sheep.gamegroup.view.adapter.AdpGameCenter1_2List;
+import com.sheep.gamegroup.view.adapter.AdpGameCenter3_3List;
 import com.sheep.jiuyan.samllsheep.R;
 import com.sheep.jiuyan.samllsheep.R;
 import com.sheep.jiuyan.samllsheep.SheepApp;
 import com.sheep.jiuyan.samllsheep.SheepApp;
 import com.sheep.jiuyan.samllsheep.base.BaseFragment;
 import com.sheep.jiuyan.samllsheep.base.BaseFragment;
@@ -48,36 +50,27 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.List;
 
 
 import butterknife.BindView;
 import butterknife.BindView;
-import butterknife.OnClick;
 import butterknife.Unbinder;
 import butterknife.Unbinder;
+import rx.Observable;
 import rx.android.schedulers.AndroidSchedulers;
 import rx.android.schedulers.AndroidSchedulers;
+import rx.functions.Func1;
 import rx.schedulers.Schedulers;
 import rx.schedulers.Schedulers;
 
 
-import static com.sheep.gamegroup.model.entity.TaskEty.TASK_TYPE_GAME_OTHER;
-import static com.sheep.gamegroup.model.entity.TaskEty.TASK_TYPE_GAME_SHEEP;
-import static com.sheep.gamegroup.model.entity.TaskEty.TASK_TYPE_GAME_TECENT;
-import static com.sheep.gamegroup.model.entity.TaskEty.TASK_TYPE_GAME_XIAO_MI;
-import static com.sheep.gamegroup.view.adapter.PlayGameListAdapter.setOnClickGameEntity;
-
 /**
 /**
- * Created by ljy on 2018/9/3.
+ * Created by realicing on 2018/10/30.
+ * realicing@sina.com
  */
  */
-
 public class FgtPlayGame extends BaseFragment {
 public class FgtPlayGame extends BaseFragment {
     @BindView(R.id.banner)
     @BindView(R.id.banner)
     Banner banner;
     Banner banner;
-    @BindView(R.id.every_day_more_tv)
-    TextView everyDayMoreTv;
-    @BindView(R.id.every_day_play_list)
-    RecyclerView everyDayPlayList;
-    @BindView(R.id.recent_hot_more_tv)
-    TextView recentHotMoreTv;
-    @BindView(R.id.recent_hoe_list)
-    RecyclerView recentHoeList;
-    @BindView(R.id.tabLayout)
-    TabLayout indicator;
-    @BindView(R.id.viewpager_act_game_details)
-    ViewPager pager;
+    @BindView(R.id.play_game_act)
+    RecyclerView play_game_act;
+    @BindView(R.id.play_game_list_3_rv)
+    RecyclerView play_game_list_3_rv;
+    @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)
     @BindView(R.id.refresh)
     SmartRefreshLayout refresh;
     SmartRefreshLayout refresh;
     @BindView(R.id.scrollView)
     @BindView(R.id.scrollView)
@@ -85,21 +78,27 @@ public class FgtPlayGame extends BaseFragment {
     Unbinder unbinder;
     Unbinder unbinder;
 
 
     private Activity activity;
     private Activity activity;
-    private List<GameEntity> everyDayPlayListData = new ArrayList<>();
-    private List<GameEntity> hotListData = new ArrayList<>();
-
+    //游戏首页活动列表
+    private List<SlideshowEty> gameActList = new ArrayList<>();
+    //每日必玩", "近期最热", "猜你喜欢
+    private List<GameListType> gameListTypeList3 = new ArrayList<>();
+    private List<GameEntityList> gameEntityList3 = new ArrayList<>();
+    //天天更新与重点推荐
+    private List<GameListType> gameListTypeList2 = new ArrayList<>();
+    private List<GameListTypeList<GameRecommend>> gameListTypeList2List = new ArrayList<>();
+    //预下载和tag列表的数据
+    private List<GameEntityList> 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<>();
 
 
-    private List<FindTag> list = ListUtil.emptyList();
-    private TitleFragmentListAdapter mAdapter;
-    private int curPosition = 0;
 
 
     @Override
     @Override
     public int getLayoutId() {
     public int getLayoutId() {
         return R.layout.fgt_play_game;
         return R.layout.fgt_play_game;
     }
     }
 
 
+    public static final int[] gameActBgIds = {R.drawable.shape_purple_gradient_solid_rectangle_5, R.drawable.shape_orange_gradient_solid_rectangle_5, R.drawable.shape_light_blue_gradient_solid_rectangle_5};
+
     @Override
     @Override
     public void onViewCreated() {
     public void onViewCreated() {
         activity = getActivity();
         activity = getActivity();
@@ -109,129 +108,205 @@ public class FgtPlayGame extends BaseFragment {
         bannerLayoutParams.height = G.WIDTH * 25 / 72;
         bannerLayoutParams.height = G.WIDTH * 25 / 72;
         banner.setLayoutParams(bannerLayoutParams);
         banner.setLayoutParams(bannerLayoutParams);
 
 
-        //每日必玩、近期最热
-        LinearLayoutManager playHotManager = new LinearLayoutManager(SheepApp.getInstance(), LinearLayoutManager.HORIZONTAL, false);
-        //每日必玩
-        everyDayPlayList.setHasFixedSize(true);
-        everyDayPlayList.setNestedScrollingEnabled(false);
-        everyDayPlayList.setLayoutManager(playHotManager);
-        everyDayPlayList.setAdapter(new AdbCommonRecycler<GameEntity>(SheepApp.getInstance(), everyDayPlayListData) {
+        //游戏首页活动列表
+        LinearLayoutManager playGameActManager = new LinearLayoutManager(SheepApp.getInstance(), LinearLayoutManager.HORIZONTAL, false);
+        play_game_act.setHasFixedSize(true);
+        play_game_act.setNestedScrollingEnabled(false);
+        play_game_act.setLayoutManager(playGameActManager);
+        play_game_act.setAdapter(new RecyclerViewAdapter<SlideshowEty>(SheepApp.getInstance(), R.layout.item_game_act, gameActList) {
             @Override
             @Override
-            public int getViewIdByType(int type) {
-                return R.layout.item_hot_welfare;
-            }
-
-            @Override
-            public void convert(ViewHolder holder, GameEntity welfareCenter) {
-                ImageView item_hot_welfare_iv =  holder.itemView.findViewById(R.id.item_hot_welfare_iv);
-                TextView item_hot_welfare_tv = holder.itemView.findViewById(R.id.item_hot_welfare_tv);
-                if(welfareCenter == null){
-                    ViewUtil.setDefaultText(item_hot_welfare_tv);
+            public void convert(com.kfzs.appstore.utils.adapter.recyclerview.ViewHolder viewHolder, final SlideshowEty item, int position) {
+                View item_game_act_start = viewHolder.itemView.findViewById(R.id.item_game_act_start);
+                View item_game_act_content = viewHolder.itemView.findViewById(R.id.item_game_act_content);
+                View item_game_act_end = viewHolder.itemView.findViewById(R.id.item_game_act_end);
+                ImageView item_game_act_iv = viewHolder.itemView.findViewById(R.id.item_game_act_iv);
+                TextView item_game_act_tv = viewHolder.itemView.findViewById(R.id.item_game_act_tv);
+                ViewUtil.setVisibility(item_game_act_start, position == 0);
+                ViewUtil.setVisibility(item_game_act_end, position + 1 == gameActList.size());
+                item_game_act_content.setBackgroundResource(gameActBgIds[position % gameActBgIds.length]);
+                if (item == null) {
+                    ViewUtil.setDefaultText(item_game_act_tv);
                 } else {
                 } else {
-                    // 加载数据
-                    ViewUtil.setText(item_hot_welfare_tv, welfareCenter.getApp().getName());
-                    GlideImageLoader.setGameImage(item_hot_welfare_iv, welfareCenter.getApp().getIcon());
-                    setOnClickGameEntity(activity, holder.itemView, welfareCenter);
+                    ViewUtil.setImage(item_game_act_iv, item.getUrl());
+                    ViewUtil.setText(item_game_act_tv, item.getTitle());
                 }
                 }
-            }
-        });
-        //近期最热
-        LinearLayoutManager hotManager = new LinearLayoutManager(SheepApp.getInstance(), LinearLayoutManager.HORIZONTAL, false);
-        recentHoeList.setHasFixedSize(true);
-        recentHoeList.setNestedScrollingEnabled(false);
-        recentHoeList.setLayoutManager(hotManager);
-        recentHoeList.setAdapter(new AdbCommonRecycler<GameEntity>(SheepApp.getInstance(), hotListData) {
-            @Override
-            public int getViewIdByType(int type) {
-                return R.layout.item_hot_welfare;
-            }
+                viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
+                    @Override
+                    public void onClick(View view) {
+                        try {
+                            CommonUtil.getInstance().clickBanner(activity, item);
+                        } catch (Exception e) {
+                            G.showToast(e.getMessage());
+                        }
+                    }
+                });
 
 
-            @Override
-            public void convert(ViewHolder holder, GameEntity welfareCenter) {
-                ImageView item_hot_welfare_iv = holder.itemView.findViewById(R.id.item_hot_welfare_iv);
-                TextView item_hot_welfare_tv = holder.itemView.findViewById(R.id.item_hot_welfare_tv);
-                if(welfareCenter == null){
-                    ViewUtil.setDefaultText(item_hot_welfare_tv);
-                } else {
-                    // 加载数据
-                    ViewUtil.setText(item_hot_welfare_tv, welfareCenter.getApp().getName());
-                    GlideImageLoader.setGameImage(item_hot_welfare_iv, welfareCenter.getApp().getIcon());
-                    setOnClickGameEntity(activity, holder.itemView, welfareCenter);
-                }
             }
             }
         });
         });
-        refresh.setOnRefreshLoadMoreListener(new OnRefreshLoadMoreListener() {
-            @Override
-            public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
-                FgtPlayGameSon item = (FgtPlayGameSon) mAdapter.getItem(curPosition);
-                if (item == null) {
-                    notifyDataSetChanged();
-                    return;
-                }
-                item.loadMoreData();
-                notifyDataSetChanged();
-            }
+
+        //每日必玩、近期最热、猜你喜欢
+        play_game_list_3_rv.setHasFixedSize(true);
+        play_game_list_3_rv.setNestedScrollingEnabled(false);
+        play_game_list_3_rv.setLayoutManager(new LinearLayoutManager(SheepApp.getInstance()));
+        play_game_list_3_rv.setAdapter(new AdpGameCenter3_3List(activity, gameEntityList3).setShowFirstTop(false));
+        //天天更新、重点推荐
+        play_game_list_2_rv.setHasFixedSize(true);
+        play_game_list_2_rv.setNestedScrollingEnabled(false);
+        play_game_list_2_rv.setLayoutManager(new LinearLayoutManager(SheepApp.getInstance()));
+        play_game_list_2_rv.setAdapter(new AdpGameCenter1_2List(activity, gameListTypeList2List));
+        //预下载与其它列表
+        play_game_list_x_rv.setHasFixedSize(true);
+        play_game_list_x_rv.setNestedScrollingEnabled(false);
+        play_game_list_x_rv.setLayoutManager(new LinearLayoutManager(SheepApp.getInstance()));
+        play_game_list_x_rv.setAdapter(new AdpGameCenter3_3List(activity, gameEntityListx));
+
+        refresh.setOnRefreshListener(new OnRefreshListener() {
 
 
             @Override
             @Override
             public void onRefresh(@NonNull RefreshLayout refreshLayout) {
             public void onRefresh(@NonNull RefreshLayout refreshLayout) {
                 initData();
                 initData();
             }
             }
         });
         });
-        RefreshUtil.newInstance().publicParameterRefresh(refresh, activity);
-
-        mAdapter = new TitleFragmentListAdapter(getChildFragmentManager());
+        RefreshUtil.newInstance().publicParameter(refresh, activity);
+        initGameListType3List();
+        initGameListType2List();
+        refresh.autoRefresh();
+    }
 
 
-        //tab
-        initTab();
-        initData();
+    public static final String[] gameListType3Titles = {"每日必玩", "近期最热", "猜你喜欢"};
+    public static final int[] gameListType3IsHots = {1, 0, 0};
+    public static final int[] gameListType3DailyPlays = {0, 1, 0};
+
+    private void initGameListType3List() {
+        //每日必玩", "近期最热", "猜你喜欢
+        for (int i = 0; i < gameListType3Titles.length; i++) {
+            GameListType gameListType = new GameListType();
+            gameListType.setTitle(gameListType3Titles[i]);
+            gameListType.setPer_page(20);
+            gameListType.setIs_hot(gameListType3IsHots[i]);
+            gameListType.setDaily_play(gameListType3DailyPlays[i]);
+            gameListTypeList3.add(gameListType);
+        }
     }
     }
 
 
-    @Override
-    public void onStart() {
-        super.onStart();
-        //结束轮播
-        banner.startAutoPlay();
+    public static final String[] gameListType2Titles = {"天天更新", "重点推荐"};
+    public static final int[] gameListType2DisplayTypes = {1, 2};
+
+    private void initGameListType2List() {
+        //天天更新", "重点推荐
+        for (int i = 0; i < gameListType2Titles.length; i++) {
+            GameListType gameListType = new GameListType();
+            gameListType.setTitle(gameListType2Titles[i]);
+            gameListType.setDisplay_type(gameListType2DisplayTypes[i]);
+            gameListTypeList2.add(gameListType);
+        }
     }
     }
 
 
-    @Override
-    public void onStop() {
-        super.onStop();
-        //结束轮播
-        banner.stopAutoPlay();
+    private void initData() {
+        initBanner();
+        initBannerAct();
+        initGameList3();
+        initRecommendList();
+        initGameTagList();
     }
     }
 
 
-    private void bindBanner() {
-        //结束轮播
-        banner.stopAutoPlay();
-        banner.setVisibility(View.VISIBLE);
-        //设置图片加载器
-        banner.setImageLoader(new ImageLoader() {
-            @Override
-            public void displayImage(Context context, Object o, ImageView imageView) {
-                if (o instanceof SlideshowEty)
-                    Glide.with(context).load(((SlideshowEty) o).getUrl()).apply(new RequestOptions().dontAnimate()).into(imageView);
-            }
-        })
-                .setDelayTime(4000)
-                .setBannerStyle(BannerConfig.CIRCLE_INDICATOR_TITLE_INSIDE)
-                //设置图片集合
-                .setImages(slideshowEtyLists).setBannerTitles(slideshowTitleList)
-                .setOnBannerListener(new OnBannerListener() {
+    private void initBannerAct() {
+        SheepApp.getInstance().getNetComponent().getApiService().gameBannerAct()
+                .subscribeOn(Schedulers.io())
+                .observeOn(AndroidSchedulers.mainThread())
+                .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
                     @Override
                     @Override
-                    public void OnBannerClick(int i) {
-                        try {
-                            CommonUtil.getInstance().clickBanner(activity, i, slideshowEtyLists);
-                        } catch (Exception e) {
-                            G.showToast(e.getMessage());
+                    public void onNext(BaseMessage baseMessage) {
+                        ArrayList<SlideshowEty> newList = baseMessage.getDataList(SlideshowEty.class);
+                        gameActList.clear();
+                        if (ListUtil.isEmpty(newList)) {
+                            gameActList.addAll(newList);
                         }
                         }
+                        play_game_act.getAdapter().notifyDataSetChanged();
+                    }
+
+                    @Override
+                    public void onError(BaseMessage baseMessage) {
+                        notifyDataSetChanged();
                     }
                     }
                 });
                 });
+    }
 
 
-        //banner设置方法全部调用完毕时最后调用
-        banner.start();
+    //天天更新、重点推荐
+    private void initRecommendList() {
+        Observable.from(gameListTypeList2)
+                .subscribe(new AbsSubscriber<GameListType>() {
+                    @Override
+                    public void onNext(final GameListType gameListType) {
+                        SheepApp.getInstance().getNetComponent().getApiService().getRecommendList(gameListType.getDisplay_type())
+                                .subscribeOn(Schedulers.io())
+                                .observeOn(AndroidSchedulers.mainThread())
+                                .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
+                                    @Override
+                                    public void onNext(BaseMessage baseMessage) {
+                                        List<GameRecommend> newList = baseMessage.getDatas(GameRecommend.class);
+                                        if (!ListUtil.isEmpty(newList)) {
+                                            gameListTypeList2List.add(new GameListTypeList<>(gameListType, newList));
+                                            play_game_list_2_rv.getAdapter().notifyDataSetChanged();
+                                            notifyDataSetChanged();
+                                        }
+                                    }
+
+                                    @Override
+                                    public void onError(BaseMessage baseMessage) {
+                                        notifyDataSetChanged();
+                                    }
+                                });
+                    }
+                });
+    }
+
+    //预下载下面的tagList
+    private void initGameTagList() {
+        gameEntityListx.clear();
+        //预下载
+        GameListType gameListType = new GameListType();
+        gameListType.setTitle("预下载");
+        gameListType.setDownload_type(1);
+        initGameList(play_game_list_x_rv, gameEntityListx, gameListType);
+        //其它tag
+        SheepApp.getInstance().getNetComponent().getApiService().getGameTagList()
+                .subscribeOn(Schedulers.io())
+                .map(new Func1<BaseMessage, List<GameListTag>>() {
+                    @Override
+                    public List<GameListTag> call(BaseMessage baseMessage) {
+                        return baseMessage.getDataList(GameListTag.class);
+                    }
+                })
+                .filter(new Func1<List<GameListTag>, Boolean>() {
+                    @Override
+                    public Boolean call(List<GameListTag> gameListTags) {
+                        return !ListUtil.isEmpty(gameListTags);
+                    }
+                })
+                .flatMap(new Func1<List<GameListTag>, Observable<GameListTag>>() {
+                    @Override
+                    public Observable<GameListTag> call(List<GameListTag> gameListTagList) {
+                        return Observable.from(gameListTagList);
+                    }
+                })
+                .filter(new Func1<GameListTag, Boolean>() {
+                    @Override
+                    public Boolean call(GameListTag gameListTag) {
+                        return gameListTag != null;
+                    }
+                })
+                .subscribe(new AbsSubscriber<GameListTag>() {
+
+                    @Override
+                    public void onNext(GameListTag gameListTag) {
+                        initGameList(play_game_list_x_rv, gameEntityListx, gameListTag.toGameListType());
+                    }
+                });
     }
     }
 
 
-    private void initData(){
+    //刷新banner数据
+    private void initBanner() {
         //轮播
         //轮播
         List<SlideshowEty> cacheSlideshowEtyList = DataUtil.getInstance().getCacheList(ApiKey.slideshowGame, SlideshowEty.class);
         List<SlideshowEty> cacheSlideshowEtyList = DataUtil.getInstance().getCacheList(ApiKey.slideshowGame, SlideshowEty.class);
         if (ListUtil.isEmpty(cacheSlideshowEtyList)) {
         if (ListUtil.isEmpty(cacheSlideshowEtyList)) {
@@ -277,41 +352,79 @@ public class FgtPlayGame extends BaseFragment {
                         notifyDataSetChanged();
                         notifyDataSetChanged();
                     }
                     }
                 });
                 });
+    }
 
 
-        //每日必玩
-        SheepApp.getInstance().getNetComponent().getApiService().playgameDailyOrHotOrTypePlay(1, 10, 0,1,0)
-                .subscribeOn(Schedulers.io())
-                .observeOn(AndroidSchedulers.mainThread())
-                .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
+    private void bindBanner() {
+        //结束轮播
+        banner.stopAutoPlay();
+        banner.setVisibility(View.VISIBLE);
+        //设置图片加载器
+        banner.setImageLoader(new ImageLoader() {
+            @Override
+            public void displayImage(Context context, Object o, ImageView imageView) {
+                if (o instanceof SlideshowEty)
+                    Glide.with(context).load(((SlideshowEty) o).getUrl()).apply(new RequestOptions().dontAnimate()).into(imageView);
+            }
+        })
+                .setDelayTime(4000)
+                .setBannerStyle(BannerConfig.CIRCLE_INDICATOR_TITLE_INSIDE)
+                //设置图片集合
+                .setImages(slideshowEtyLists).setBannerTitles(slideshowTitleList)
+                .setOnBannerListener(new OnBannerListener() {
                     @Override
                     @Override
-                    public void onNext(BaseMessage baseMessage) {
-                        List<GameEntity> newList = baseMessage.getDatas(GameEntity.class);
-                        if(!ListUtil.isEmpty(newList)) {//有缓存时不会加载,没有缓存时获取到数据会加载
-                            everyDayPlayListData.clear();
-                            everyDayPlayListData.addAll(newList);
-                            everyDayPlayList.getAdapter().notifyDataSetChanged();
-                            notifyDataSetChanged();
+                    public void OnBannerClick(int i) {
+                        try {
+                            CommonUtil.getInstance().clickBanner(activity, i, slideshowEtyLists);
+                        } catch (Exception e) {
+                            G.showToast(e.getMessage());
                         }
                         }
                     }
                     }
+                });
+
+        //banner设置方法全部调用完毕时最后调用
+        banner.start();
+    }
+
+    @Override
+    public void onStart() {
+        super.onStart();
+        //结束轮播
+        banner.startAutoPlay();
+    }
+
+    @Override
+    public void onStop() {
+        super.onStop();
+        //结束轮播
+        banner.stopAutoPlay();
+    }
+
+    //刷新每日必玩、近期最热、猜你喜欢的数据
+    private void initGameList3() {
+        gameEntityList3.clear();
+        Observable.from(gameListTypeList3)
+                .subscribe(new AbsSubscriber<GameListType>() {
 
 
                     @Override
                     @Override
-                    public void onError(BaseMessage baseMessage) {
-                        notifyDataSetChanged();
+                    public void onNext(final GameListType gameListType) {
+                        initGameList(play_game_list_3_rv, gameEntityList3, gameListType);
                     }
                     }
                 });
                 });
+    }
 
 
-        //近期最热
-        SheepApp.getInstance().getNetComponent().getApiService().playgameDailyOrHotOrTypePlay(1, 10, 1,0,0)
-                .subscribeOn(Schedulers.io())
+    private void initGameList(final RecyclerView playGameListRv, final List<GameEntityList> gameEntityListList, final GameListType gameListType) {
+        if (gameListType == null) {
+            return;
+        }
+        ObservableUtil.getObservable(SheepApp.getInstance().getNetComponent().getApiService(), gameListType).subscribeOn(Schedulers.io())
                 .observeOn(AndroidSchedulers.mainThread())
                 .observeOn(AndroidSchedulers.mainThread())
                 .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
                 .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
                     @Override
                     @Override
                     public void onNext(BaseMessage baseMessage) {
                     public void onNext(BaseMessage baseMessage) {
                         List<GameEntity> newList = baseMessage.getDatas(GameEntity.class);
                         List<GameEntity> newList = baseMessage.getDatas(GameEntity.class);
-                        if(!ListUtil.isEmpty(newList)) {//有缓存时不会加载,没有缓存时获取到数据会加载
-                            hotListData.clear();
-                            hotListData.addAll(newList);
-                            recentHoeList.getAdapter().notifyDataSetChanged();
+                        if (!ListUtil.isEmpty(newList)) {
+                            gameEntityListList.add(new GameEntityList(gameListType, newList));
+                            playGameListRv.getAdapter().notifyDataSetChanged();
                             notifyDataSetChanged();
                             notifyDataSetChanged();
                         }
                         }
                     }
                     }
@@ -321,79 +434,11 @@ public class FgtPlayGame extends BaseFragment {
                         notifyDataSetChanged();
                         notifyDataSetChanged();
                     }
                     }
                 });
                 });
-        if (!isFirst) {
-            for (int i = 0; i < mAdapter.getCount(); i++) {
-                FgtPlayGameSon item = (FgtPlayGameSon) mAdapter.getItem(i);
-                item.refreshData();
-            }
-        }
-        isFirst = false;
     }
     }
 
 
-    private boolean isFirst = true;
     private void notifyDataSetChanged() {
     private void notifyDataSetChanged() {
-        if(refresh != null) {
+        if (refresh != null) {
             refresh.finishRefresh();
             refresh.finishRefresh();
-            refresh.finishLoadMore();
-        }
-    }
-
-    /**
-     * tab
-     * @param
-     */
-    private void initTab(){
-        List<FindTag> newList = new ArrayList<>();
-        newList.add(new FindTag(TASK_TYPE_GAME_SHEEP, "平台游戏"));
-        newList.add(new FindTag(TASK_TYPE_GAME_XIAO_MI, "小米游戏"));
-        newList.add(new FindTag(TASK_TYPE_GAME_TECENT, "腾讯游戏"));
-        newList.add(new FindTag(TASK_TYPE_GAME_OTHER, "其他"));
-        if (!ListUtil.isEmpty(newList)) {
-            list.clear();
-            ListUtil.addAll(list, newList);
-            int position = 0;
-            for(FindTag findTag:list){
-                FgtPlayGameSon item = FgtPlayGameSon.newInstance(findTag.getId());
-                item.setViewPager(pager);
-                item.setSmartRefreshLayout(refresh);
-                if(position == 0)
-                    item.setFirstPage(true);
-                mAdapter.add(item, findTag.getName());
-                position ++;
-            }
-            pager.setAdapter(mAdapter);
-            indicator.setupWithViewPager(pager);
-            pager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
-                @Override
-                public void onPageScrolled(int i, float v, int i1) {
-
-                }
-
-                @Override
-                public void onPageSelected(int i) {
-                    curPosition = i;
-                }
-
-                @Override
-                public void onPageScrollStateChanged(int i) {
-
-                }
-            });
-            CommonUtil.getInstance().reflex(indicator, activity);
-            pager.setOffscreenPageLimit(list.size());
-            notifyDataSetChanged();
-        }
-    }
-
-    @OnClick({R.id.every_day_more_tv, R.id.recent_hot_more_tv})
-    public void onViewClicked(View view) {
-        switch (view.getId()) {
-            case R.id.every_day_more_tv:
-                Jump2View.getInstance().goEverydayOrCurrentHotGame(activity, 0);
-                break;
-            case R.id.recent_hot_more_tv:
-                Jump2View.getInstance().goEverydayOrCurrentHotGame(activity, 1);
-                break;
         }
         }
     }
     }
 }
 }

+ 112 - 113
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtPlayGameSon.java

@@ -1,113 +1,112 @@
-package com.sheep.gamegroup.view.fragment;
-
-import android.os.Bundle;
-import android.support.v7.widget.RecyclerView;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-
-import com.sheep.gamegroup.event.BigEvent;
-import com.sheep.gamegroup.model.api.ApiService;
-import com.sheep.gamegroup.model.entity.BaseMessage;
-import com.sheep.gamegroup.model.entity.GameEntity;
-import com.sheep.gamegroup.model.entity.GameEntityList;
-import com.sheep.gamegroup.util.CommonUtil;
-import com.sheep.gamegroup.util.ListUtil;
-import com.sheep.gamegroup.util.LogUtil;
-import com.sheep.gamegroup.view.adapter.PlayGameListAdapter;
-import com.sheep.jiuyan.samllsheep.R;
-
-import org.greenrobot.eventbus.Subscribe;
-
-import java.util.List;
-import java.util.Locale;
-
-import rx.Observable;
-
-/**
- * Created by ljy on 2018/9/3.
- */
-
-public class FgtPlayGameSon extends BaseListFragment3<GameEntity> {
-    private int type;
-
-    //第一次就展示在viewpager中的页面
-    public boolean firstPage = false;
-
-    public void setFirstPage(boolean firstPage) {
-        this.firstPage = firstPage;
-    }
-    @Override
-    protected void initDataOnVisibleToUser() {
-        if(activity == null)
-            onViewCreated();
-        if(!firstPage && firstVisibleToUser) {
-            refreshData();
-        }
-    }
-
-    @Override
-    public int refreshDataType() {
-        if(firstPage){
-            return REFRESH_ON_CREATE;
-        }
-        return REFRESH_ON_YOURSELF;
-    }
-
-    public static FgtPlayGameSon newInstance(int type){
-        FgtPlayGameSon fgt = new FgtPlayGameSon();
-        Bundle bundle = new Bundle();
-        bundle.putInt("type", type);
-        fgt.setArguments(bundle);
-        return fgt;
-    }
-
-    @Override
-    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
-        View rootView = super.onCreateView(inflater, container, savedInstanceState);
-        Bundle bundle = getArguments();
-        if(bundle != null){
-            type = bundle.getInt("type", 1002);
-        }
-        return rootView;
-    }
-
-    private GameEntityList gameEntityList = new GameEntityList(list);
-    private List<GameEntityList> gameEntityListList = ListUtil.emptyList();
-    @Override
-    protected RecyclerView.Adapter getAdapter() {
-        if(gameEntityListList.isEmpty())
-            gameEntityListList.add(gameEntityList);
-        return new PlayGameListAdapter(activity, gameEntityListList);
-    }
-
-    @Override
-    protected String getKey(int page, int per_page) {
-        return String.format(Locale.CHINA, "app/find?page=%d&per_page=%d&is_hot=%d&daily_play=%d&type=%d", page, per_page, 0, 0, type);
-    }
-
-    @Override
-    protected Observable<BaseMessage> getApi(ApiService apiService) {
-        return apiService.playgameDailyOrHotOrTypePlay(page, per_page, 0, 0, type);
-    }
-
-    @Override
-    protected Class<GameEntity> getTClass() {
-        return GameEntity.class;
-    }
-
-    @Subscribe
-    public void onEventMainThread(BigEvent event){
-        CommonUtil.getInstance().setEventResultViewStatus(event, view_list);
-    }
-
-    @Override
-    protected boolean isFirstGetACache() {
-        return false;
-    }
-
-    @Override
-    protected int getItemHeight() {
-        return getResources().getDimensionPixelSize(R.dimen.content_padding_96);
-    }
-}
+//package com.sheep.gamegroup.view.fragment;
+//
+//import android.os.Bundle;
+//import android.support.v7.widget.RecyclerView;
+//import android.view.LayoutInflater;
+//import android.view.View;
+//import android.view.ViewGroup;
+//
+//import com.sheep.gamegroup.event.BigEvent;
+//import com.sheep.gamegroup.model.api.ApiService;
+//import com.sheep.gamegroup.model.entity.BaseMessage;
+//import com.sheep.gamegroup.model.entity.GameEntity;
+//import com.sheep.gamegroup.model.entity.GameEntityList;
+//import com.sheep.gamegroup.util.CommonUtil;
+//import com.sheep.gamegroup.util.ListUtil;
+//import com.sheep.gamegroup.view.adapter.PlayGameListAdapter;
+//import com.sheep.jiuyan.samllsheep.R;
+//
+//import org.greenrobot.eventbus.Subscribe;
+//
+//import java.util.List;
+//import java.util.Locale;
+//
+//import rx.Observable;
+//
+///**
+// * Created by ljy on 2018/9/3.
+// */
+//
+//public class FgtPlayGameSon extends BaseListFragment3<GameEntity> {
+//    private int type;
+//
+//    //第一次就展示在viewpager中的页面
+//    public boolean firstPage = false;
+//
+//    public void setFirstPage(boolean firstPage) {
+//        this.firstPage = firstPage;
+//    }
+//    @Override
+//    protected void initDataOnVisibleToUser() {
+//        if(activity == null)
+//            onViewCreated();
+//        if(!firstPage && firstVisibleToUser) {
+//            refreshData();
+//        }
+//    }
+//
+//    @Override
+//    public int refreshDataType() {
+//        if(firstPage){
+//            return REFRESH_ON_CREATE;
+//        }
+//        return REFRESH_ON_YOURSELF;
+//    }
+//
+//    public static FgtPlayGameSon newInstance(int type){
+//        FgtPlayGameSon fgt = new FgtPlayGameSon();
+//        Bundle bundle = new Bundle();
+//        bundle.putInt("type", type);
+//        fgt.setArguments(bundle);
+//        return fgt;
+//    }
+//
+//    @Override
+//    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+//        View rootView = super.onCreateView(inflater, container, savedInstanceState);
+//        Bundle bundle = getArguments();
+//        if(bundle != null){
+//            type = bundle.getInt("type", 1002);
+//        }
+//        return rootView;
+//    }
+//
+//    private GameEntityList gameEntityList = new GameEntityList(list);
+//    private List<GameEntityList> gameEntityListList = ListUtil.emptyList();
+//    @Override
+//    protected RecyclerView.Adapter getAdapter() {
+//        if(gameEntityListList.isEmpty())
+//            gameEntityListList.add(gameEntityList);
+//        return new PlayGameListAdapter(activity, gameEntityListList);
+//    }
+//
+//    @Override
+//    protected String getKey(int page, int per_page) {
+//        return String.format(Locale.CHINA, "app/find?page=%d&per_page=%d&is_hot=%d&daily_play=%d&type=%d", page, per_page, 0, 0, type);
+//    }
+//
+//    @Override
+//    protected Observable<BaseMessage> getApi(ApiService apiService) {
+//        return apiService.getPlayGameList(page, per_page, 0, 0, type);
+//    }
+//
+//    @Override
+//    protected Class<GameEntity> getTClass() {
+//        return GameEntity.class;
+//    }
+//
+//    @Subscribe
+//    public void onEventMainThread(BigEvent event){
+//        CommonUtil.getInstance().setEventResultViewStatus(event, view_list);
+//    }
+//
+//    @Override
+//    protected boolean isFirstGetACache() {
+//        return false;
+//    }
+//
+//    @Override
+//    protected int getItemHeight() {
+//        return getResources().getDimensionPixelSize(R.dimen.content_padding_96);
+//    }
+//}

+ 9 - 0
app/src/main/res/drawable/shape_black_solid_rectangle_tl_br_12.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+    <corners
+        android:bottomRightRadius="12dp"
+        android:topLeftRadius="12dp" />
+    <solid android:color="#000000" />
+
+</shape>

+ 17 - 0
app/src/main/res/drawable/shape_light_blue_gradient_solid_rectangle_5.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+    <solid android:color="#ff32a5f9" />
+    <gradient
+        android:angle="-90"
+        android:centerColor="#ff49bde9"
+        android:endColor="#ff2ea1fa"
+        android:startColor="#ff6be2da"
+        android:type="linear"
+        android:useLevel="true" />
+    <corners
+        android:bottomLeftRadius="5dp"
+        android:bottomRightRadius="5dp"
+        android:topLeftRadius="5dp"
+        android:topRightRadius="5dp" />
+</shape>

+ 17 - 0
app/src/main/res/drawable/shape_orange_gradient_solid_rectangle_5.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+    <solid android:color="#ff32a5f9" />
+    <gradient
+        android:angle="-90"
+        android:centerColor="#fffd9797"
+        android:endColor="#fffd7697"
+        android:startColor="#ffffc296"
+        android:type="linear"
+        android:useLevel="true" />
+    <corners
+        android:bottomLeftRadius="5dp"
+        android:bottomRightRadius="5dp"
+        android:topLeftRadius="5dp"
+        android:topRightRadius="5dp" />
+</shape>

+ 17 - 0
app/src/main/res/drawable/shape_purple_gradient_solid_rectangle_5.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+    <solid android:color="#ff32a5f9" />
+    <gradient
+        android:angle="-90"
+        android:centerColor="#ffb870fc"
+        android:endColor="#ff9d57fb"
+        android:startColor="#ffbf83f6"
+        android:type="linear"
+        android:useLevel="true" />
+    <corners
+        android:bottomLeftRadius="5dp"
+        android:bottomRightRadius="5dp"
+        android:topLeftRadius="5dp"
+        android:topRightRadius="5dp" />
+</shape>

+ 7 - 44
app/src/main/res/layout/fgt_play_game.xml

@@ -1,6 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
 <?xml version="1.0" encoding="utf-8"?>
 <com.scwang.smartrefresh.layout.SmartRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
 <com.scwang.smartrefresh.layout.SmartRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
     android:id="@+id/refresh"
     android:id="@+id/refresh"
     android:layout_width="match_parent"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:layout_height="match_parent"
@@ -10,10 +9,7 @@
         android:id="@+id/scrollView"
         android:id="@+id/scrollView"
         android:layout_width="match_parent"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:layout_height="match_parent"
-        android:layout_gravity="fill_vertical"
-        android:fillViewport="true"
-        android:scrollbars="none"
-        app:layout_behavior="@string/appbar_scrolling_view_behavior">
+        android:scrollbars="none">
 
 
         <LinearLayout
         <LinearLayout
             android:layout_width="match_parent"
             android:layout_width="match_parent"
@@ -29,54 +25,21 @@
                 android:layout_width="match_parent"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content" />
                 android:layout_height="wrap_content" />
 
 
-            <RelativeLayout style="@style/style_wc_rl">
-
-                <TextView
-                    style="@style/style_wc_line_title"
-                    android:text="每日必玩" />
-
-                <TextView
-                    android:id="@+id/every_day_more_tv"
-                    style="@style/style_wc_more"
-                    android:text="更多" />
-            </RelativeLayout>
-
             <android.support.v7.widget.RecyclerView
             <android.support.v7.widget.RecyclerView
-                android:id="@+id/every_day_play_list"
+                android:id="@+id/play_game_list_3_rv"
                 android:layout_width="match_parent"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content" />
                 android:layout_height="wrap_content" />
 
 
-            <View
-                android:layout_width="match_parent"
-                android:layout_height="10dp"
-                android:background="#fff5f5f5" />
-
-            <RelativeLayout style="@style/style_wc_rl">
-
-                <TextView
-                    style="@style/style_wc_line_title"
-                    android:text="近期最热" />
-
-                <TextView
-                    android:id="@+id/recent_hot_more_tv"
-                    style="@style/style_wc_more"
-                    android:text="更多" />
-            </RelativeLayout>
-
             <android.support.v7.widget.RecyclerView
             <android.support.v7.widget.RecyclerView
-                android:id="@+id/recent_hoe_list"
+                android:id="@+id/play_game_list_2_rv"
                 android:layout_width="match_parent"
                 android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:paddingBottom="4dp"
-                android:paddingTop="4dp" />
+                android:layout_height="wrap_content" />
 
 
-            <View
+            <android.support.v7.widget.RecyclerView
+                android:id="@+id/play_game_list_x_rv"
                 android:layout_width="match_parent"
                 android:layout_width="match_parent"
-                android:layout_height="10dp"
-                android:background="#fff5f5f5" />
+                android:layout_height="wrap_content" />
 
 
-            <!--选项卡-->
-            <include layout="@layout/tablayout_viewpager_layout" />
         </LinearLayout>
         </LinearLayout>
 
 
     </android.support.v4.widget.NestedScrollView>
     </android.support.v4.widget.NestedScrollView>

+ 43 - 0
app/src/main/res/layout/item_game_act.xml

@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
+    android:layout_marginTop="20dp">
+
+    <View
+        android:id="@+id/item_game_act_start"
+        android:layout_width="16dp"
+        android:layout_height="62dp" />
+
+    <RelativeLayout
+        android:id="@+id/item_game_act_content"
+        android:layout_width="117dp"
+        android:layout_height="62dp"
+        android:layout_marginEnd="14dp"
+        android:background="@drawable/shape_purple_gradient_solid_rectangle_5"
+        android:paddingStart="10dp"
+        android:paddingEnd="10dp">
+
+        <TextView
+            android:id="@+id/item_game_act_tv"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_centerVertical="true"
+            android:text="@string/default_game_act_name"
+            android:textColor="@color/white"
+            android:textSize="12sp" />
+
+        <ImageView
+            android:id="@+id/item_game_act_iv"
+            android:layout_width="35dp"
+            android:layout_height="30dp"
+            android:layout_alignParentEnd="true"
+            android:layout_centerVertical="true"
+            android:src="@drawable/icon" />
+    </RelativeLayout>
+
+    <View
+        android:id="@+id/item_game_act_end"
+        android:layout_width="2dp"
+        android:layout_height="62dp" />
+</LinearLayout>

+ 14 - 13
app/src/main/res/layout/item_hot_welfare.xml

@@ -3,30 +3,31 @@
     android:layout_width="wrap_content"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:layout_height="wrap_content"
     android:layout_gravity="center"
     android:layout_gravity="center"
-    android:paddingStart="16dp"
-    android:paddingEnd="6dp"
+    android:orientation="vertical"
+    android:paddingStart="10dp"
     android:paddingTop="20dp"
     android:paddingTop="20dp"
-    android:paddingBottom="20dp"
-    android:orientation="vertical">
+    android:paddingBottom="20dp">
 
 
     <ImageView
     <ImageView
         android:id="@+id/item_hot_welfare_iv"
         android:id="@+id/item_hot_welfare_iv"
-        android:layout_width="62dp"
-        android:layout_height="62dp"
+        android:layout_width="83dp"
+        android:layout_height="83dp"
+        android:layout_marginStart="6dp"
+        android:layout_marginEnd="6dp"
         android:layout_gravity="center"
         android:layout_gravity="center"
-        android:src="@drawable/icon_lj"/>
+        android:src="@drawable/icon_lj" />
 
 
     <TextView
     <TextView
         android:id="@+id/item_hot_welfare_tv"
         android:id="@+id/item_hot_welfare_tv"
-        android:layout_width="wrap_content"
-        android:maxEms="5"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_height="wrap_content"
         android:layout_gravity="center_horizontal"
         android:layout_gravity="center_horizontal"
         android:layout_marginTop="12dp"
         android:layout_marginTop="12dp"
         android:ellipsize="end"
         android:ellipsize="end"
-        android:textColor="#333333"
-        android:textSize="12sp"
         android:gravity="center"
         android:gravity="center"
-        android:lines="2"
-        android:text=""/>
+        android:maxEms="5"
+        android:maxLines="1"
+        android:text=""
+        android:textColor="#333333"
+        android:textSize="12sp" />
 </LinearLayout>
 </LinearLayout>

+ 49 - 0
app/src/main/res/layout/item_play_game.xml

@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content">
+
+    <View
+        android:id="@+id/item_play_game_start"
+        android:layout_width="11dp"
+        android:layout_height="146dp" />
+
+    <RelativeLayout
+        android:layout_width="270dp"
+        android:layout_height="146dp"
+        android:layout_marginTop="16dp"
+        android:layout_marginBottom="16dp"
+        android:layout_marginStart="5dp"
+        android:layout_marginEnd="5dp">
+
+        <ImageView
+            android:id="@+id/item_play_game_iv"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:scaleType="centerCrop"
+            android:src="@mipmap/home_blue_bg" />
+
+        <TextView
+            android:id="@+id/item_play_game_name"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_alignParentStart="true"
+            android:layout_alignParentBottom="true"
+            android:layout_marginStart="5dp"
+            android:layout_marginBottom="5dp"
+            android:background="@drawable/shape_black_solid_rectangle_tl_br_12"
+            android:text="战舰世界闪击战"
+            android:paddingTop="5dp"
+            android:paddingBottom="5dp"
+            android:paddingStart="10dp"
+            android:paddingEnd="10dp"
+            android:textColor="#ffffffff"
+            android:textSize="13sp"
+            />
+    </RelativeLayout>
+
+    <View
+        android:id="@+id/item_play_game_end"
+        android:layout_width="11dp"
+        android:layout_height="146dp" />
+</LinearLayout>

+ 32 - 0
app/src/main/res/layout/item_play_game_list.xml

@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:orientation="vertical">
+
+    <View
+        android:id="@+id/item_play_game_list_top"
+        android:layout_width="match_parent"
+        android:layout_height="10dp"
+        android:background="#fff5f5f5" />
+
+    <RelativeLayout style="@style/style_wc_rl">
+
+        <TextView
+            android:id="@+id/item_play_game_list_tv"
+            style="@style/style_wc_line_title"
+            android:text="猜你喜欢" />
+
+        <TextView
+            android:id="@+id/item_play_game_list_more_tv"
+            style="@style/style_wc_more"
+            android:text="更多" />
+    </RelativeLayout>
+
+    <android.support.v7.widget.RecyclerView
+        android:id="@+id/item_play_game_list_rv"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:paddingTop="4dp"
+        android:paddingBottom="4dp" />
+</LinearLayout>

+ 1 - 0
app/src/main/res/values/strings.xml

@@ -108,6 +108,7 @@
     <string name="gift_bag_code">礼包码:%s</string>
     <string name="gift_bag_code">礼包码:%s</string>
 
 
     <string name="change_login_ing">登录授权中&#8230;</string>
     <string name="change_login_ing">登录授权中&#8230;</string>
+    <string name="default_game_act_name">万圣节\n抽奖活动</string>
     <string name="image_des">icon</string>
     <string name="image_des">icon</string>
     <string name="search_but_text">搜索</string>
     <string name="search_but_text">搜索</string>
     <string name="search_hint_txt">搜索任务名称/游戏名称</string>
     <string name="search_hint_txt">搜索任务名称/游戏名称</string>