Переглянути джерело

修复试玩赚钱中可能重复显示的bug;
修复邀请赚钱等界面中ViewPager不能自适应高度的问题;
删除重复的游戏bean类;
添加游戏详情页面第一页面(还差调试接口与评论)

zengjiebin 7 роки тому
батько
коміт
8b534c719a
79 змінених файлів з 1937 додано та 927 видалено
  1. 2 2
      app/build.gradle
  2. 4 1
      app/proguard-rules.pro
  3. 3 0
      app/src/main/AndroidManifest.xml
  4. 0 79
      app/src/main/java/com/kfzs/duanduan/view/ViewPagerAutoHeigh.java
  5. 119 0
      app/src/main/java/com/sheep/gamegroup/absBase/AbsDownloadListener.java
  6. 154 0
      app/src/main/java/com/sheep/gamegroup/absBase/AbsGetDownloadListener.java
  7. 3 4
      app/src/main/java/com/sheep/gamegroup/view/activity/BaseListActivity2.java
  8. 10 0
      app/src/main/java/com/sheep/gamegroup/absBase/ICallBack2.java
  9. 10 0
      app/src/main/java/com/sheep/gamegroup/absBase/ILoadMore.java
  10. 10 0
      app/src/main/java/com/sheep/gamegroup/absBase/IRefresh.java
  11. 2 1
      app/src/main/java/com/sheep/gamegroup/helper/DownloadHelper.java
  12. 37 67
      app/src/main/java/com/sheep/gamegroup/helper/FindAppHelper.java
  13. 2 8
      app/src/main/java/com/sheep/gamegroup/helper/ImageListHelper.java
  14. 22 1
      app/src/main/java/com/sheep/gamegroup/model/api/ApiService.java
  15. 3 4
      app/src/main/java/com/sheep/gamegroup/model/entity/CommendApp.java
  16. 31 0
      app/src/main/java/com/sheep/gamegroup/model/entity/Entry.java
  17. 3 3
      app/src/main/java/com/sheep/gamegroup/model/entity/FindAppReservation.java
  18. 3 3
      app/src/main/java/com/sheep/gamegroup/model/entity/FindItem.java
  19. 142 75
      app/src/main/java/com/sheep/gamegroup/model/entity/FindApp.java
  20. 53 15
      app/src/main/java/com/sheep/gamegroup/model/entity/GameEntity.java
  21. 0 39
      app/src/main/java/com/sheep/gamegroup/model/entity/GameEntityList.java
  22. 75 0
      app/src/main/java/com/sheep/gamegroup/model/entity/GameInfoList.java
  23. 3 3
      app/src/main/java/com/sheep/gamegroup/model/entity/GiftBagApp.java
  24. 7 6
      app/src/main/java/com/sheep/gamegroup/model/entity/GameListTypeList.java
  25. 0 398
      app/src/main/java/com/sheep/gamegroup/model/entity/PlayGameEntity.java
  26. 22 19
      app/src/main/java/com/sheep/gamegroup/util/CommonUtil.java
  27. 56 0
      app/src/main/java/com/sheep/gamegroup/util/DownloadTextUtl.java
  28. 1 1
      app/src/main/java/com/sheep/gamegroup/util/DownloadUtil.java
  29. 5 5
      app/src/main/java/com/sheep/gamegroup/util/Jump2View.java
  30. 1 1
      app/src/main/java/com/sheep/gamegroup/util/ListUtil.java
  31. 37 0
      app/src/main/java/com/sheep/gamegroup/util/TagListUtil.java
  32. 1 0
      app/src/main/java/com/sheep/gamegroup/util/TestUtil.java
  33. 29 0
      app/src/main/java/com/sheep/gamegroup/util/TextViewUtil.java
  34. 17 0
      app/src/main/java/com/sheep/gamegroup/util/ViewUtil.java
  35. 10 11
      app/src/main/java/com/sheep/gamegroup/view/activity/ActFindGame.java
  36. 5 11
      app/src/main/java/com/sheep/gamegroup/view/activity/ActFindInformation.java
  37. 266 0
      app/src/main/java/com/sheep/gamegroup/view/activity/ActGcGameAppDetail.java
  38. 25 26
      app/src/main/java/com/sheep/gamegroup/view/activity/ActPlayGameDetail.java
  39. 1 0
      app/src/main/java/com/sheep/gamegroup/view/activity/ActPlayGameList.java
  40. 1 0
      app/src/main/java/com/sheep/gamegroup/view/activity/ActPlayGameRecommendList.java
  41. 1 3
      app/src/main/java/com/sheep/gamegroup/view/activity/ActPlayGameUserLikeList.java
  42. 6 6
      app/src/main/java/com/sheep/gamegroup/view/activity/ActReservation.java
  43. 14 9
      app/src/main/java/com/sheep/gamegroup/view/activity/TaskDetailAct.java
  44. 7 8
      app/src/main/java/com/sheep/gamegroup/view/adapter/AdpGameCenter1_2List.java
  45. 14 13
      app/src/main/java/com/sheep/gamegroup/view/adapter/AdpGameCenter3_3List.java
  46. 42 0
      app/src/main/java/com/sheep/gamegroup/view/adapter/AdpGcGameAppInfoList.java
  47. 2 2
      app/src/main/java/com/sheep/gamegroup/view/adapter/GiftCenterAdapter.java
  48. 5 4
      app/src/main/java/com/sheep/gamegroup/view/adapter/PlayGameListAdapter.java
  49. 4 7
      app/src/main/java/com/sheep/gamegroup/view/fragment/BaseListFragment.java
  50. 4 2
      app/src/main/java/com/sheep/gamegroup/view/fragment/BaseListFragment2.java
  51. 4 2
      app/src/main/java/com/sheep/gamegroup/view/fragment/BaseListFragment3.java
  52. 8 9
      app/src/main/java/com/sheep/gamegroup/view/fragment/FgtAskGetMoney.java
  53. 1 6
      app/src/main/java/com/sheep/gamegroup/view/fragment/FgtAskGetMoneyFriend.java
  54. 0 3
      app/src/main/java/com/sheep/gamegroup/view/fragment/FgtAskGetMoneyRank.java
  55. 7 7
      app/src/main/java/com/sheep/gamegroup/view/fragment/FgtFindChild.java
  56. 3 3
      app/src/main/java/com/sheep/gamegroup/view/fragment/FgtFriendExtractPage.java
  57. 209 0
      app/src/main/java/com/sheep/gamegroup/view/fragment/FgtGcGameAppDetail.java
  58. 14 13
      app/src/main/java/com/sheep/gamegroup/view/fragment/FgtPlayGame.java
  59. 2 3
      app/src/main/java/com/sheep/gamegroup/view/fragment/FgtPlayGameDetail.java
  60. 4 4
      app/src/main/java/com/sheep/gamegroup/view/fragment/FgtTryMakeMoney.java
  61. 1 1
      app/src/main/java/com/sheep/jiuyan/samllsheep/base/BaseFragment.java
  62. 2 2
      app/src/main/java/com/sheep/jiuyan/samllsheep/net/Network.java
  63. 12 18
      app/src/main/java/com/sheep/jiuyan/samllsheep/service/DownloadService.java
  64. 8 0
      app/src/main/res/drawable/shape_oval_light_blue.xml
  65. 172 0
      app/src/main/res/layout/act_gc_game_app_detail.xml
  66. 1 1
      app/src/main/res/layout/act_play_game_detail_layout.xml
  67. 2 4
      app/src/main/res/layout/fgt_askgetmoney_friend.xml
  68. 19 0
      app/src/main/res/layout/fgt_gc_game_app_detail.xml
  69. 1 1
      app/src/main/res/layout/friend_list.xml
  70. 2 1
      app/src/main/res/layout/friend_list_empty.xml
  71. 0 1
      app/src/main/res/layout/homepage_act_layout.xml
  72. 33 0
      app/src/main/res/layout/item_gc_game_app_63.xml
  73. 33 0
      app/src/main/res/layout/item_gc_game_app_detail_list.xml
  74. 37 0
      app/src/main/res/layout/item_gc_game_app_intro.xml
  75. 44 0
      app/src/main/res/layout/item_gc_game_info.xml
  76. 13 0
      app/src/main/res/layout/item_tag.xml
  77. 1 2
      app/src/main/res/layout/x_ask_getmoney_act_layout.xml
  78. 0 1
      app/src/main/res/values/dimens.xml
  79. 30 8
      view/src/main/java/com/kfzs/android/view/widget/WrapContentHeightViewPager.java

+ 2 - 2
app/build.gradle

@@ -275,7 +275,7 @@ dependencies {
     implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0-alpha-14'
 
     implementation 'org.greenrobot:greendao:3.2.2'
-
+    //okDownload
     // core
     implementation "com.liulishuo.okdownload:okdownload:1.0.4"
     // provide sqlite to store breakpoints
@@ -286,7 +286,7 @@ dependencies {
     implementation 'com.trello.rxlifecycle2:rxlifecycle-components:2.2.2'
 
     implementation 'com.squareup.retrofit2:adapter-rxjava2:2.4.0'
-
+    //有米科技
     implementation(name: 'YoumiSdk_v8.3.0_2018-09-20', ext: 'aar')
 }
 

+ 4 - 1
app/proguard-rules.pro

@@ -460,4 +460,7 @@
 #==================compile 'com.haibin:calendarview:3.4.4'==========================
  -keepclasseswithmembers class * {
      public <init>(android.content.Context);
- }
+ }
+#==================com.github.lsjwzh.RecyclerViewPager==========================
+ -keep class com.lsjwzh.widget.recyclerviewpager.**
+ -dontwarn com.lsjwzh.widget.recyclerviewpager.**

+ 3 - 0
app/src/main/AndroidManifest.xml

@@ -673,6 +673,9 @@
             android:name="com.sheep.gamegroup.view.activity.ActPlayGameRecommendList"
             android:screenOrientation="portrait" />
         <activity
+            android:name="com.sheep.gamegroup.view.activity.ActGcGameAppDetail"
+            android:screenOrientation="portrait" />
+        <activity
             android:name="com.sheep.gamegroup.view.activity.ActPlayGameDetail"
             android:screenOrientation="portrait" />
         <activity

+ 0 - 79
app/src/main/java/com/kfzs/duanduan/view/ViewPagerAutoHeigh.java

@@ -1,79 +0,0 @@
-package com.kfzs.duanduan.view;
-
-import android.content.Context;
-import android.support.v4.view.ViewPager;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.MotionEvent;
-import android.view.View;
-
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-
-/**
- * @ Created by Dlg
- * @ <p>TiTle:  ViewPagerAutoHeigh</p>
- * @ <p>Description:</p>
- * @ date:  2017/6/19 16:45
- * @ QQ:    315096953
- */
-
-public class ViewPagerAutoHeigh extends ViewPager {
-
-    private int current;
-    private int[] mHeight = new int[10];
-    /**
-     * 保存position与对于的View
-     */
-    private HashMap<Integer, View> mChildrenViews = new LinkedHashMap<Integer, View>();
-    private HashMap<Integer, Integer> mChildrenHeight = new LinkedHashMap<Integer, Integer>();
-
-    private boolean scrollble = true;
-
-    public ViewPagerAutoHeigh(Context context) {
-        super(context);
-    }
-
-    public ViewPagerAutoHeigh(Context context, AttributeSet attrs) {
-        super(context, attrs);
-    }
-
-    @Override
-    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
-        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
-
-        for (int i = 0; i < getChildCount(); i++) {
-            View child = getChildAt(i);
-            child.measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
-            int h = child.getMeasuredHeight();
-            mHeight[i] = h < 300 ? 300:h;
-        }
-        heightMeasureSpec = MeasureSpec.makeMeasureSpec(mHeight[getCurrentItem()], MeasureSpec.EXACTLY);
-//        Log.e("-----------onMeasure", mChildrenHeight.get(current) + ",minHeight:" + mIntHeight);
-        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
-    }
-
-    public void reSetHeight() {
-        invalidate();
-//        ViewGroup.LayoutParams layoutParams = getLayoutParams();
-//        layoutParams.height = mHeight[getCurrentItem()];
-//        setLayoutParams(layoutParams);
-    }
-
-    @Override
-    public boolean onTouchEvent(MotionEvent ev) {
-        if (!scrollble) {
-            return true;
-        }
-        return super.onTouchEvent(ev);
-    }
-
-
-    public boolean isScrollble() {
-        return scrollble;
-    }
-
-    public void setScrollble(boolean scrollble) {
-        this.scrollble = scrollble;
-    }
-}

+ 119 - 0
app/src/main/java/com/sheep/gamegroup/absBase/AbsDownloadListener.java

@@ -0,0 +1,119 @@
+package com.sheep.gamegroup.absBase;
+
+import android.content.Intent;
+
+import com.sheep.gamegroup.event.BigEvent;
+import com.sheep.gamegroup.greendao.download.DownLoadInfo;
+
+
+import static android.content.Intent.ACTION_PACKAGE_ADDED;
+import static android.content.Intent.ACTION_PACKAGE_REMOVED;
+
+/**
+ * Created by realicing on 2018/10/31.
+ * realicing@sina.com
+ * 下载和应用安装的回调,使用时请在Activity的onCreate中注册并在onDestroy中取消注册
+ * 并在onEventMainThread(Intent intent)和onEventMainThread(BigEvent event)中添加org.greenrobot.eventbus.Subscribe注解
+ * 如:
+ EventBus.getDefault().register(this);
+ private AbsDownloadListener absDownloadListener = new AbsDownloadListener() {
+@Override public void removedApk(String packageName) {
+
+}
+
+@Override public void addedApk(String packageName) {
+
+}
+
+@Override public void running(DownLoadInfo task) {
+
+}
+
+@Override public void taskStop(DownLoadInfo task) {
+
+}
+
+@Override public void taskComplete(DownLoadInfo task) {
+
+}
+
+@Override public void taskCancel(DownLoadInfo task) {
+
+}
+
+@Override public void taskFail(DownLoadInfo task) {
+
+}
+};
+ @Subscribe public void onEventMainThread(Intent intent) {
+ absDownloadListener.onEventMainThread(intent);
+ }
+ @Subscribe public void onEventMainThread(BigEvent event) {
+ absDownloadListener.onEventMainThread(event);
+ }
+ @Override protected void onDestroy() {
+ super.onDestroy();
+ EventBus.getDefault().unregister(this);
+ }
+
+ */
+public abstract class AbsDownloadListener {
+
+    public void onEventMainThread(Intent intent) {
+        if (intent != null && intent.getAction() != null && intent.getDataString() != null && intent.getDataString().contains("package:")) {
+            String packageName = intent.getDataString().replace("package:", "");
+            switch (intent.getAction()) {
+                case ACTION_PACKAGE_ADDED:
+                    addedApk(packageName);
+                    break;
+                case ACTION_PACKAGE_REMOVED:
+                    removedApk(packageName);
+                    break;
+            }
+        }
+    }
+
+    //卸载应用的回调
+    public abstract void removedApk(String packageName);
+
+    //安装应用的回调
+    public abstract void addedApk(String packageName);
+
+    public void onEventMainThread(BigEvent event) {
+        if (event.getData() instanceof DownLoadInfo) {
+            DownLoadInfo task = (DownLoadInfo) event.getData();
+            switch (event.getEventTypes()) {
+                case DOWNLOAD_RUNNING:
+                    running(task);
+                    break;
+                case DOWNLOAD_STOP:
+                    taskStop(task);
+                    break;
+                case DOWNLOAD_COMPLETE:
+                    taskComplete(task);
+                    break;
+                case DOWNLOAD_CANCEL:
+                    taskCancel(task);
+                    break;
+                case DOWNLOAD_FAIL:
+                    taskFail(task);
+                    break;
+            }
+        }
+    }
+
+    //下载中的的回调
+    public abstract void running(DownLoadInfo task);
+
+    //下载暂停的回调
+    public abstract void taskStop(DownLoadInfo task);
+
+    //下载完成的回调
+    public abstract void taskComplete(DownLoadInfo task);
+
+    //取消下载的回调
+    public abstract void taskCancel(DownLoadInfo task);
+
+    //下载失败的回调
+    public abstract void taskFail(DownLoadInfo task);
+}

+ 154 - 0
app/src/main/java/com/sheep/gamegroup/absBase/AbsGetDownloadListener.java

@@ -0,0 +1,154 @@
+package com.sheep.gamegroup.absBase;
+
+import android.content.Intent;
+import android.text.TextUtils;
+import android.widget.TextView;
+
+import com.sheep.gamegroup.event.BigEvent;
+import com.sheep.gamegroup.greendao.download.DownLoadInfo;
+import com.sheep.gamegroup.helper.DownloadHelper;
+import com.sheep.gamegroup.util.DownloadTextUtl;
+import com.sheep.gamegroup.util.DownloadUtil;
+import com.sheep.jiuyan.samllsheep.utils.PackageUtil;
+
+import rx.functions.Action1;
+
+/**
+ * Created by realicing on 2018/11/1.
+ * realicing@sina.com
+ */
+public abstract class AbsGetDownloadListener {
+    private boolean showSimpleText;
+
+    public AbsGetDownloadListener(boolean showSimpleText) {
+        this.showSimpleText = showSimpleText;
+    }
+
+    private AbsDownloadListener absDownloadListener = new AbsDownloadListener() {
+        @Override
+        public void removedApk(final String packageName) {
+            checkPackageName(packageName, new ICallBack2<TextView, String>() {
+                @Override
+                public void call(TextView textView, String downloadUrl) {
+                    String path = PackageUtil.isExistsFile(packageName, downloadUrl);
+                    if (TextUtils.isEmpty(path)) {
+                        textView.setText(DownloadTextUtl.getStartDownloadText(showSimpleText));
+                    } else {
+                        textView.setText(DownloadTextUtl.getStartInstallText(showSimpleText));
+                    }
+                }
+            });
+        }
+
+        @Override
+        public void addedApk(String packageName) {
+            checkPackageName(packageName, new ICallBack2<TextView, String>() {
+                @Override
+                public void call(TextView textView, String downloadUrl) {
+                    textView.setText(DownloadTextUtl.getStartOpenText(showSimpleText));
+                }
+            });
+        }
+
+        @Override
+        public void running(final DownLoadInfo task) {
+            checkUrl(task.getMDownloadUrl(), new Action1<TextView>() {
+                @Override
+                public void call(TextView textView) {
+                    if (textView != null) {
+                        textView.setText(DownloadTextUtl.getProgressText(showSimpleText, task));
+                    }
+                }
+            });
+        }
+
+        @Override
+        public void taskStop(final DownLoadInfo task) {
+            checkUrl(task.getMDownloadUrl(), new Action1<TextView>() {
+                @Override
+                public void call(TextView textView) {
+                    if (textView != null) {
+                        textView.setText(DownloadTextUtl.getContinueDownloadText(showSimpleText));
+                    }
+                }
+            });
+        }
+
+        @Override
+        public void taskComplete(final DownLoadInfo task) {
+            checkUrl(task.getMDownloadUrl(), new Action1<TextView>() {
+                @Override
+                public void call(TextView textView) {
+                    if (textView != null) {
+                        textView.setText(DownloadTextUtl.getStartInstallText(showSimpleText));
+                        DownloadHelper downloadHelper = getDownloadHelper(task.getMDownloadUrl());
+                        if (downloadHelper != null)
+                            downloadHelper.updateState(DownloadUtil.STATUS_FINISH);
+                    }
+                }
+            });
+        }
+
+        @Override
+        public void taskCancel(final DownLoadInfo task) {
+            checkUrl(task.getMDownloadUrl(), new Action1<TextView>() {
+                @Override
+                public void call(TextView textView) {
+                    if (textView != null) {
+                        textView.setText(DownloadTextUtl.getTaskCancelText(showSimpleText));
+                    }
+                }
+            });
+        }
+
+        @Override
+        public void taskFail(final DownLoadInfo task) {
+            checkUrl(task.getMDownloadUrl(), new Action1<TextView>() {
+                @Override
+                public void call(TextView textView) {
+                    if (textView != null) {
+                        textView.setText(DownloadTextUtl.getFailDownloadText(showSimpleText));
+                    }
+                }
+            });
+        }
+    };
+
+
+    private void checkUrl(String downloadUrl, Action1<TextView> action1) {
+        try {
+            action1.call(getTextView(downloadUrl));
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    private void checkPackageName(String packageName, ICallBack2<TextView, String> action1) {
+        try {
+            action1.call(getTextView2(packageName), getDownloadUrl(packageName));
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    //根据包名获取下载地址
+    public abstract String getDownloadUrl(String packageName);
+
+    //根据包名获取TextView
+    public abstract TextView getTextView2(String packageName);
+
+    //根据下载地址获取TextView
+    public abstract TextView getTextView(String downloadUrl);
+
+    //根据下载地址获取DownloadHelper
+    public abstract DownloadHelper getDownloadHelper(String downloadUrl);
+
+
+    public void onEventMainThread(Intent intent) {
+        absDownloadListener.onEventMainThread(intent);
+    }
+
+    public void onEventMainThread(BigEvent bigEvent) {
+        absDownloadListener.onEventMainThread(bigEvent);
+    }
+}

+ 3 - 4
app/src/main/java/com/sheep/gamegroup/view/activity/BaseListActivity2.java

@@ -1,11 +1,10 @@
-package com.sheep.gamegroup.view.activity;
+package com.sheep.gamegroup.absBase;
 
 import android.support.v7.widget.LinearLayoutManager;
 import android.support.v7.widget.RecyclerView;
 import android.view.View;
 
 import com.jcodecraeer.xrecyclerview.XRecyclerView;
-import com.sheep.gamegroup.absBase.BaseActivity;
 import com.sheep.gamegroup.model.api.ApiService;
 import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
@@ -30,7 +29,7 @@ import rx.schedulers.Schedulers;
  * realicing@sina.com
  * 自己可以进行刷新与加载更多,使用com.jcodecraeer.xrecyclerview.XRecyclerView来实现,子类提供网络接口相关
  */
-public abstract class BaseListActivity2<T> extends BaseActivity {
+public abstract class BaseListActivity2<T> extends BaseActivity implements IRefresh, ILoadMore {
     @Override
     public int getLayoutId() {
         return R.layout.net_empty_xrecycler;
@@ -89,7 +88,7 @@ public abstract class BaseListActivity2<T> extends BaseActivity {
         view_list.setAdapter(getAdapter());
     }
 
-    protected void loadMoreData() {
+    public void loadMoreData() {
         if (!loadMore) {
             loadMore = true;
             if (ListUtil.size(list) >= per_page * page) {

+ 10 - 0
app/src/main/java/com/sheep/gamegroup/absBase/ICallBack2.java

@@ -0,0 +1,10 @@
+package com.sheep.gamegroup.absBase;
+
+/**
+ * Created by realicing on 2018/11/1.
+ * realicing@sina.com
+ * 两个参数的回调
+ */
+public interface ICallBack2<P1, P2> {
+    void call(P1 p1, P2 p2);
+}

+ 10 - 0
app/src/main/java/com/sheep/gamegroup/absBase/ILoadMore.java

@@ -0,0 +1,10 @@
+package com.sheep.gamegroup.absBase;
+
+/**
+ * Created by realicing on 2018/10/31.
+ * realicing@sina.com
+ * 上拉加载更多的接口
+ */
+public interface ILoadMore {
+    void loadMoreData();
+}

+ 10 - 0
app/src/main/java/com/sheep/gamegroup/absBase/IRefresh.java

@@ -0,0 +1,10 @@
+package com.sheep.gamegroup.absBase;
+
+/**
+ * Created by realicing on 2018/10/31.
+ * realicing@sina.com
+ * 下拉刷新数据的接口
+ */
+public interface IRefresh {
+    void refreshData();
+}

+ 2 - 1
app/src/main/java/com/sheep/gamegroup/helper/DownloadHelper.java

@@ -46,6 +46,7 @@ public class DownloadHelper {
         updateDownloadTaskView(activity, iTask, down_tv, callBack,0);
     }
     public void updateDownloadTaskView(final Activity activity, final IDownload iTask, final TextView down_tv, final Action1<Object> callBack,int type) {
+        final boolean showSimpleText = down_tv.getText().length() < 4;
         if(downloadUtil == null){
             downloadUtil = new DownloadUtil(activity);
         }
@@ -62,7 +63,7 @@ public class DownloadHelper {
 //                if(callBack != null)
 //                    callBack.call(o);
             }
-        });
+        }, showSimpleText);
         if(type == 0){
             down_tv.setOnClickListener(new View.OnClickListener() {
                 @Override

+ 37 - 67
app/src/main/java/com/sheep/gamegroup/helper/FindAppHelper.java

@@ -5,13 +5,13 @@ import android.view.Gravity;
 import android.view.View;
 import android.widget.TextView;
 
-import com.sheep.gamegroup.util.DownloadUtil;
 import com.sheep.gamegroup.model.api.IDownload;
 import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.DialogConfig;
-import com.sheep.gamegroup.model.entity.FindApp;
-import com.sheep.gamegroup.model.entity.PlayGameEntity;
+import com.sheep.gamegroup.model.entity.GameApp;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
+import com.sheep.gamegroup.util.DownloadTextUtl;
+import com.sheep.gamegroup.util.DownloadUtil;
 import com.sheep.gamegroup.util.TimeUtil;
 import com.sheep.gamegroup.util.ViewUtil;
 import com.sheep.jiuyan.samllsheep.SheepApp;
@@ -29,7 +29,7 @@ import static com.sheep.gamegroup.util.UMConfigUtils.Event.FIND_APP;
  * Created by realicing on 2018/6/29.
  * realicing@sina.com
  */
-public class FindAppHelper{
+public class FindAppHelper {
     private DownloadHelper downloadHelper = new DownloadHelper();
 
     public DownloadHelper getDownloadHelper() {
@@ -39,40 +39,40 @@ public class FindAppHelper{
     public void updateState(int status) {
         downloadHelper.updateState(status);
     }
+
     public void updateDownloadTaskView(final Activity activity, final IDownload iTask, final TextView down_tv) {
-        updateDownloadTaskView(activity,iTask,down_tv, 0);
+        updateDownloadTaskView(activity, iTask, down_tv, 0);
     }
+
     public void updateDownloadTaskView(final Activity activity, final IDownload iTask, final TextView down_tv, int type) {
         downloadHelper.updateDownloadTaskView(activity, iTask, down_tv, new Action1<Object>() {
             @Override
             public void call(Object object) {
-                boolean installed = object instanceof  Integer && DownloadUtil.STATUS_INIT != (int)object;//-1 点击下载按钮的回调;其它状态直接回调不需要点击按钮
-                boolean downloadLinkError = object instanceof  Boolean && !(boolean)object;//false 下载地址错误会传false过来
-                if(installed || downloadLinkError){
-                    if(iTask instanceof FindApp) {
-                        FindApp findApp = (FindApp) iTask;
-                        recordAppDownloads(activity, findApp, null);
-                        FIND_APP.onEvent("application_id", findApp.getId(), "action", down_tv.getText());
-                    }else if(iTask instanceof PlayGameEntity) {
-                        PlayGameEntity findApp = (PlayGameEntity) iTask;
+                boolean installed = object instanceof Integer && DownloadUtil.STATUS_INIT != (int) object;//-1 点击下载按钮的回调;其它状态直接回调不需要点击按钮
+                boolean downloadLinkError = object instanceof Boolean && !(boolean) object;//false 下载地址错误会传false过来
+                if (installed || downloadLinkError) {
+                    if (iTask instanceof GameApp) {
+                        GameApp findApp = (GameApp) iTask;
                         recordAppDownloads(activity, findApp, null);
                         FIND_APP.onEvent("application_id", findApp.getId(), "action", down_tv.getText());
                     }
                 }
             }
-        },type);
+        }, type);
     }
 
     /**
      * 更新预约下载状态与响应点击
+     *
      * @param activity
      * @param findApp
      * @param reservation_tv
      */
-    public void updateReservationView(final Activity activity, final FindApp findApp, final TextView reservation_tv) {
-        if(findApp.isCanRecord()) {
+    public void updateReservationView(final Activity activity, final GameApp findApp, final TextView reservation_tv) {
+        final boolean showSimpleText = reservation_tv.getText().length() < 4;
+        if (findApp.isCanRecord()) {
             reservation_tv.setEnabled(true);
-            reservation_tv.setText("预约下载");
+            reservation_tv.setText(DownloadTextUtl.getReservationText(showSimpleText));
             reservation_tv.setOnClickListener(new View.OnClickListener() {
                 @Override
                 public void onClick(View view) {
@@ -83,51 +83,55 @@ public class FindAppHelper{
             });
         } else {
             reservation_tv.setEnabled(false);
-            reservation_tv.setText("已经预约");
+            reservation_tv.setText(DownloadTextUtl.getHasReservationText(showSimpleText));
         }
     }
-    public void updateReservationView(final Activity activity, final PlayGameEntity findApp, final TextView reservation_tv, int type) {
-        if(findApp.isCanRecord()) {
+
+    public void updateReservationView(final Activity activity, final GameApp gameApp, final TextView reservation_tv, int type) {
+        final boolean showSimpleText = reservation_tv.getText().length() < 4;
+        if (gameApp.isCanRecord()) {
             reservation_tv.setEnabled(true);
-            reservation_tv.setText("预约下载");
-            if(type == 0){
+            reservation_tv.setText(DownloadTextUtl.getReservationText(showSimpleText));
+            if (type == 0) {
                 reservation_tv.setOnClickListener(new View.OnClickListener() {
                     @Override
                     public void onClick(View view) {
-                        FIND_APP.onEvent("application_id", findApp.getId(), "action", "预约下载");
+                        FIND_APP.onEvent("application_id", gameApp.getId(), "action", "预约下载");
                         reservation_tv.setEnabled(false);
-                        recordAppDownloads(activity, findApp, reservation_tv);
+                        recordAppDownloads(activity, gameApp, reservation_tv);
                     }
                 });
             }
 
         } else {
             reservation_tv.setEnabled(false);
-            reservation_tv.setText("已经预约");
+            reservation_tv.setText(DownloadTextUtl.getHasReservationText(showSimpleText));
         }
     }
 
 
     /**
      * 点击预约下载与立即下载时,需要调用这个接口记录到服务器
+     *
      * @param findApp
      */
-    private void recordAppDownloads(final Activity activity, final FindApp findApp, final TextView textView) {
+    private void recordAppDownloads(final Activity activity, final GameApp findApp, final TextView textView) {
         SheepApp.getInstance().getNetComponent().getApiService().recordAppDownloads(findApp.getId())
                 .subscribeOn(Schedulers.io())
                 .observeOn(AndroidSchedulers.mainThread())
                 .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
                     @Override
                     public void onNext(BaseMessage baseMessage) {
+                        final boolean showSimpleText = textView.getText().length() < 4;
                         findApp.setRecord(2);//设置为不可记录
-                        if(findApp.isCanDownload()){
+                        if (findApp.isCanDownload()) {
                             //提交下载成功
-                            if(textView != null)
+                            if (textView != null)
                                 textView.setEnabled(true);
                         } else {//提交预约成功
-                            if(textView != null) {
+                            if (textView != null) {
                                 textView.setEnabled(false);
-                                textView.setText("已经预约");
+                                textView.setText(DownloadTextUtl.getHasReservationText(showSimpleText));
                             }
                             ViewUtil.showMsgDialog(activity, new DialogConfig().setTitle("预约成功")
                                     .setMsg(String.format(Locale.CHINA, "请在%s准时到小绵羊下载哦", TimeUtil.TimeStamp2Date(findApp.getDownload_at(), "yyyy年MM月dd日HH时mm分")))
@@ -137,44 +141,10 @@ public class FindAppHelper{
 
                     @Override
                     public void onError(BaseMessage baseMessage) {
-                        if(!findApp.isCanDownload()){
-                            G.showToast("预约失败");
-                        }
-                        if(textView != null)
-                            textView.setEnabled(true);
-                    }
-                });
-    }
-    private void recordAppDownloads(final Activity activity, final PlayGameEntity items, final TextView textView) {
-
-        SheepApp.getInstance().getNetComponent().getApiService().recordAppDownloads(items.getId())
-                .subscribeOn(Schedulers.io())
-                .observeOn(AndroidSchedulers.mainThread())
-                .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
-                    @Override
-                    public void onNext(BaseMessage baseMessage) {
-                        items.setRecord(2);//设置为不可记录
-                        if(items.isCanDownload()){
-                            //提交下载成功
-                            if(textView != null)
-                                textView.setEnabled(true);
-                        } else {//提交预约成功
-                            if(textView != null) {
-                                textView.setEnabled(false);
-                                textView.setText("已经预约");
-                            }
-                            ViewUtil.showMsgDialog(activity, new DialogConfig().setTitle("预约成功")
-                                    .setMsg(String.format(Locale.CHINA, "请在%s准时到小绵羊下载哦", TimeUtil.TimeStamp2Date(items.getDownload_at(), "yyyy年MM月dd日HH时mm分")))
-                                    .setMsgGravity(Gravity.START).setBtnLeftText("我知道了"));
-                        }
-                    }
-
-                    @Override
-                    public void onError(BaseMessage baseMessage) {
-                        if(!items.isCanDownload()){
+                        if (!findApp.isCanDownload()) {
                             G.showToast("预约失败");
                         }
-                        if(textView != null)
+                        if (textView != null)
                             textView.setEnabled(true);
                     }
                 });

+ 2 - 8
app/src/main/java/com/sheep/gamegroup/helper/ImageListHelper.java

@@ -18,13 +18,12 @@ import java.util.ArrayList; /**
  * realicing@sina.com
  */
 public class ImageListHelper {
-    private RecyclerViewAdapter mRecyclerViewAdapter;
-    public void initList(final Activity activity, final RecyclerView recyclerView, final ArrayList<String> pictureList) {
+    public static void initList(final Activity activity, final RecyclerView recyclerView, final ArrayList<String> pictureList) {
         recyclerView.setVisibility(View.VISIBLE);
         recyclerView.setLayoutManager(new LinearLayoutManager(recyclerView.getContext(), LinearLayoutManager.HORIZONTAL, false));
         recyclerView.setNestedScrollingEnabled(false);
 
-        mRecyclerViewAdapter = new RecyclerViewAdapter<String>(recyclerView.getContext(), R.layout.item_image, pictureList) {
+        RecyclerViewAdapter mRecyclerViewAdapter = new RecyclerViewAdapter<String>(recyclerView.getContext(), R.layout.item_image, pictureList) {
             @Override
             public void convert(ViewHolder viewHolder, String url, final int position) {
                 View view = viewHolder.getView(R.id.img_detail);
@@ -46,9 +45,4 @@ public class ImageListHelper {
         };
         recyclerView.setAdapter(mRecyclerViewAdapter);
     }
-
-    public void notifyDataSetChanged() {
-        if(mRecyclerViewAdapter != null)
-            mRecyclerViewAdapter.notifyDataSetChanged();
-    }
 }

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

@@ -994,6 +994,7 @@ public interface ApiService {
      */
     @GET("app/auth/need_code")
     Observable<BaseMessage> needCode(@Query("mobile") String mobile);
+//---------------------------start 玩转游戏------------------------------
     /**
      * 玩转游戏——每日必玩
      * 玩转游戏——近期最热
@@ -1032,6 +1033,26 @@ public interface ApiService {
      */
     @GET("app/find/game/tags")
     Observable<BaseMessage> getGameTagList();
+
+    /**
+     * 玩转游戏-游戏详情 相关游戏
+     * app_id 应用的id
+     */
+    @GET("app/find/detail/relevant_games")
+    Observable<BaseMessage> getDetailRelevantGames(@Query("app_id") int app_id);
+
+    /**
+     * 玩转游戏-游戏详情 热门试玩
+     * app_id 应用的id
+     */
+    @GET("app/find/detail/hot_games")
+    Observable<BaseMessage> getDetailHotGames(@Query("app_id") int app_id);
+    /**
+     *
+     */
+    @GET("")
+    Observable<BaseMessage> get(@Query("app_id") int app_id);
+//---------------------------start 玩转游戏------------------------------
     /**
      *
      * type: 1002:快发出包 1003:腾讯出包 1004:小米出包
@@ -1128,6 +1149,6 @@ public interface ApiService {
      * @return
      */
     @GET("youmi/youmi_total_price")
-    Observable<BaseMessage> getYmTotalPrice();
+    Observable<BaseMessage> getYmTotalPrice(@Query("uid") String uid);
 //---------------------------end 有米科技相关接口-------------------------------------
 }

+ 3 - 4
app/src/main/java/com/sheep/gamegroup/model/entity/CommendApp.java

@@ -1,7 +1,6 @@
 package com.sheep.gamegroup.model.entity;
 
 import android.support.annotation.IntDef;
-import android.support.annotation.StringDef;
 
 import com.sheep.gamegroup.util.ListUtil;
 
@@ -15,7 +14,7 @@ import java.util.List;
  */
 public class CommendApp {
 
-    private FindApp app;
+    private GameApp app;
 
     private int order;
 
@@ -31,11 +30,11 @@ public class CommendApp {
 
     private List<GiftBagApp> has_gift_bag;
 
-    public void setApp(FindApp app) {
+    public void setApp(GameApp app) {
         this.app = app;
     }
 
-    public FindApp getApp() {
+    public GameApp getApp() {
         return this.app;
     }
 

+ 31 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/Entry.java

@@ -0,0 +1,31 @@
+package com.sheep.gamegroup.model.entity;
+
+/**
+ * Created by realicing on 2018/11/1.
+ * realicing@sina.com
+ */
+public class Entry<K, V> {
+    public Entry(K k, V v) {
+        this.k = k;
+        this.v = v;
+    }
+
+    private K k;
+    private V v;
+
+    public K getK() {
+        return k;
+    }
+
+    public void setK(K k) {
+        this.k = k;
+    }
+
+    public V getV() {
+        return v;
+    }
+
+    public void setV(V v) {
+        this.v = v;
+    }
+}

+ 3 - 3
app/src/main/java/com/sheep/gamegroup/model/entity/FindAppReservation.java

@@ -13,7 +13,7 @@ public class FindAppReservation {
 
     private int ApplicationId;
 
-    private FindApp application;
+    private GameApp application;
 
     private int Id;
 
@@ -45,10 +45,10 @@ public class FindAppReservation {
     public int getApplicationId(){
         return this.ApplicationId;
     }
-    public void setApplication(FindApp application){
+    public void setApplication(GameApp application){
         this.application = application;
     }
-    public FindApp getApplication(){
+    public GameApp getApplication(){
         return this.application;
     }
     public void setId(int Id){

+ 3 - 3
app/src/main/java/com/sheep/gamegroup/model/entity/FindItem.java

@@ -52,7 +52,7 @@ public class FindItem {
 
     private int type;//类型 1:游戏 2:咨询 3:转跳 4:任务 5:栏目
 
-    private FindApp application;
+    private GameApp application;
 
     public void setUpdated_at(int updated_at){
         this.updated_at = updated_at;
@@ -169,11 +169,11 @@ public class FindItem {
         return this.type;
     }
 
-    public FindApp getApplication() {
+    public GameApp getApplication() {
         return application;
     }
 
-    public void setApplication(FindApp application) {
+    public void setApplication(GameApp application) {
         this.application = application;
     }
 

+ 142 - 75
app/src/main/java/com/sheep/gamegroup/model/entity/FindApp.java

@@ -1,13 +1,20 @@
 package com.sheep.gamegroup.model.entity;
 
-import com.sheep.gamegroup.model.api.IDownload;
+import android.text.TextUtils;
+
+import com.sheep.gamegroup.helper.DownloadHelper;
 import com.sheep.gamegroup.helper.FindAppHelper;
+import com.sheep.gamegroup.model.api.IDownload;
+import com.sheep.gamegroup.util.ListUtil;
+
+import java.io.Serializable;
+import java.util.ArrayList;
 
 /**
  * Created by realicing on 2018/6/28.
  * realicing@sina.com
  */
-public class FindApp implements IDownload {
+public class GameApp implements IDownload, Serializable {
     private int updated_at;
 
     private float score;//评分
@@ -69,6 +76,7 @@ public class FindApp implements IDownload {
     private int IsPlay;
 
     private int IsHot;
+
     public int getAvailable_receive() {
         return available_receive;
     }
@@ -85,118 +93,155 @@ public class FindApp implements IDownload {
         this.receive_account = receive_account;
     }
 
-    public void setUpdated_at(int updated_at){
+    public void setUpdated_at(int updated_at) {
         this.updated_at = updated_at;
     }
-    public int getUpdated_at(){
+
+    public int getUpdated_at() {
         return this.updated_at;
     }
-    public void setScore(float score){
+
+    public void setScore(float score) {
         this.score = score;
     }
-    public float getScore(){
+
+    public float getScore() {
         return this.score;
     }
-    public void setDownload_url(String download_url){
+
+    public void setDownload_url(String download_url) {
         this.download_url = download_url;
     }
-    public String getDownload_url(){
+
+    public String getDownload_url() {
         return this.download_url;
     }
-    public void setPackage_size(String package_size){
+
+    public void setPackage_size(String package_size) {
         this.package_size = package_size;
     }
-    public String getPackage_size(){
+
+    public String getPackage_size() {
         return this.package_size;
     }
-    public void setId(int Id){
+
+    public void setId(int Id) {
         this.Id = Id;
     }
-    public int getId(){
+
+    public int getId() {
         return this.Id;
     }
-    public void setVersions(String versions){
+
+    public void setVersions(String versions) {
         this.versions = versions;
     }
-    public String getVersions(){
+
+    public String getVersions() {
         return this.versions;
     }
-    public void setPictures(String pictures){
+
+    public void setPictures(String pictures) {
         this.pictures = pictures;
     }
-    public String getPictures(){
+
+    public String getPictures() {
         return this.pictures;
     }
-    public void setPackage_name(String package_name){
+
+    public void setPackage_name(String package_name) {
         this.package_name = package_name;
     }
-    public String getPackage_name(){
+
+    public String getPackage_name() {
         return this.package_name;
     }
-    public void setPlatform(int platform){
+
+    public void setPlatform(int platform) {
         this.platform = platform;
     }
-    public int getPlatform(){
+
+    public int getPlatform() {
         return this.platform;
     }
-    public void setStatus(int status){
+
+    public void setStatus(int status) {
         this.status = status;
     }
-    public int getStatus(){
+
+    public int getStatus() {
         return this.status;
     }
-    public void setIcon(String icon){
+
+    public void setIcon(String icon) {
         this.icon = icon;
     }
-    public String getIcon(){
+
+    public String getIcon() {
         return this.icon;
     }
-    public void setName(String name){
+
+    public void setName(String name) {
         this.name = name;
     }
-    public String getName(){
+
+    public String getName() {
         return this.name;
     }
-    public void setCreated_at(int created_at){
+
+    public void setCreated_at(int created_at) {
         this.created_at = created_at;
     }
-    public int getCreated_at(){
+
+    public int getCreated_at() {
         return this.created_at;
     }
-    public void setIntro(String intro){
+
+    public void setIntro(String intro) {
         this.intro = intro;
     }
-    public String getIntro(){
+
+    public String getIntro() {
         return this.intro;
     }
-    public void setDownload_at(int download_at){
+
+    public void setDownload_at(int download_at) {
         this.download_at = download_at;
     }
-    public int getDownload_at(){
+
+    public int getDownload_at() {
         return this.download_at;
     }
-    public void setManufacturer(String manufacturer){
+
+    public void setManufacturer(String manufacturer) {
         this.manufacturer = manufacturer;
     }
-    public String getManufacturer(){
+
+    public String getManufacturer() {
         return this.manufacturer;
     }
-    public void setScore_count(int score_count){
+
+    public void setScore_count(int score_count) {
         this.score_count = score_count;
     }
-    public int getScore_count(){
+
+    public int getScore_count() {
         return this.score_count;
     }
-    public void setDownload_type(int download_type){
+
+    public void setDownload_type(int download_type) {
         this.download_type = download_type;
     }
-    public int getDownload_type(){
+
+    public int getDownload_type() {
         return this.download_type;
     }
-    public void setDownload_count(int download_count){
+
+    public void setDownload_count(int download_count) {
         this.download_count = download_count;
     }
-    public int getDownload_count(){
+
+    public int getDownload_count() {
         return this.download_count;
     }
 
@@ -216,71 +261,79 @@ public class FindApp implements IDownload {
         this.record = record;
     }
 
-    public void setType(String type){
+    public void setType(String type) {
         this.type = type;
     }
-    public String getType(){
+
+    public String getType() {
         return this.type;
     }
-    public void setPackage_id(String package_id){
+
+    public void setPackage_id(String package_id) {
         this.package_id = package_id;
     }
-    public String getPackage_id(){
+
+    public String getPackage_id() {
         return this.package_id;
     }
-    public void setPackage_type(int package_type){
+
+    public void setPackage_type(int package_type) {
         this.package_type = package_type;
     }
-    public int getPackage_type(){
+
+    public int getPackage_type() {
         return this.package_type;
     }
-    public void setDownload_count_increment(int download_count_increment){
+
+    public void setDownload_count_increment(int download_count_increment) {
         this.download_count_increment = download_count_increment;
     }
-    public int getDownload_count_increment(){
+
+    public int getDownload_count_increment() {
         return this.download_count_increment;
     }
-    public void setIs_recommend(int is_recommend){
+
+    public void setIs_recommend(int is_recommend) {
         this.is_recommend = is_recommend;
     }
-    public int getIs_recommend(){
+
+    public int getIs_recommend() {
         return this.is_recommend;
     }
-    public void setGame_tag(String game_tag){
+
+    public void setGame_tag(String game_tag) {
         this.game_tag = game_tag;
     }
-    public String getGame_tag(){
+
+    public String getGame_tag() {
         return this.game_tag;
     }
-    public void setSort(int sort){
+
+    public void setSort(int sort) {
         this.sort = sort;
     }
-    public int getSort(){
+
+    public int getSort() {
         return this.sort;
     }
-    public void setIsPlay(int IsPlay){
+
+    public void setIsPlay(int IsPlay) {
         this.IsPlay = IsPlay;
     }
-    public int getIsPlay(){
+
+    public int getIsPlay() {
         return this.IsPlay;
     }
-    public void setIsHot(int IsHot){
+
+    public void setIsHot(int IsHot) {
         this.IsHot = IsHot;
     }
-    public int getIsHot(){
+
+    public int getIsHot() {
         return this.IsHot;
     }
 
 
-
-
-
-
-
-
-
-
-
     @Override
     public String getPackage_names() {
         return package_name;
@@ -307,23 +360,18 @@ public class FindApp implements IDownload {
     }
 
 
-
-
-
-
-
-
-
     /**
      * 是否可以下载
+     *
      * @return
      */
-    public boolean isCanDownload(){
+    public boolean isCanDownload() {
         return download == 1;//可以下载
     }
 
     /**
      * 是否可以记录
+     *
      * @return
      */
     public boolean isCanRecord() {
@@ -338,9 +386,28 @@ public class FindApp implements IDownload {
 
     /**
      * 更新下载状态
+     *
      * @param status
      */
     public void updateState(int status) {
         findAppHelper.updateState(status);
     }
+
+
+    public DownloadHelper getDownloadHelper() {
+        return findAppHelper.getDownloadHelper();
+    }
+
+
+    public void updateStateRelease(int status) {
+        findAppHelper.getDownloadHelper().updateState(status);
+    }
+
+    //从game_tag中获取tagList
+    public ArrayList<String> getTagList() {
+        if (!TextUtils.isEmpty(game_tag)) {
+            return ListUtil.asList(game_tag.split(","));
+        }
+        return ListUtil.emptyList();
+    }
 }

+ 53 - 15
app/src/main/java/com/sheep/gamegroup/model/entity/GameEntity.java

@@ -1,9 +1,10 @@
 package com.sheep.gamegroup.model.entity;
 
 import android.text.TextUtils;
-import android.widget.TextView;
 
 import com.kfzs.duanduan.utils.NumberFormatUtils;
+import com.sheep.gamegroup.helper.DownloadHelper;
+import com.sheep.gamegroup.model.api.IDownload;
 
 import java.io.Serializable;
 import java.util.List;
@@ -12,10 +13,10 @@ import java.util.List;
  * Created by ljy on 2018/9/4.
  */
 
-public class GameEntity implements Serializable{
+public class GameEntity implements Serializable {
     private int accepted_task_id;//integer($int64)领取福利时使用
 
-    private PlayGameEntity app;
+    private GameApp app;
     private boolean can_download;//boolean
     private int is_reservation;//integer($int64)0 不是 1是预约
 
@@ -53,11 +54,11 @@ public class GameEntity implements Serializable{
         this.accepted_task_id = accepted_task_id;
     }
 
-    public PlayGameEntity getApp() {
+    public GameApp getApp() {
         return app;
     }
 
-    public void setApp(PlayGameEntity app) {
+    public void setApp(GameApp app) {
         this.app = app;
     }
 
@@ -105,24 +106,27 @@ public class GameEntity implements Serializable{
     @Override
     public boolean equals(Object obj) {
         return obj instanceof GameEntity && (((release_task != null && release_task.equals(((GameEntity) obj).release_task))
-         || (app != null && app.equals(((GameEntity) obj).app))));
+                || (app != null && app.equals(((GameEntity) obj).app))));
     }
 
     /**
      * 是有有礼包
+     *
      * @return
      */
-    public boolean isGift(){
+    public boolean isGift() {
         return has_gift_bag != null && has_gift_bag.size() > 0;
     }
+
     /**
      * 获取奖金的文本表示(这里保留两位有效数字,因为服务器可能返回这样的结果:0.6000000238418579)
+     *
      * @return
      */
-    public String getBonusText(){
-        if(release_task != null){
+    public String getBonusText() {
+        if (release_task != null) {
             return NumberFormatUtils.retainMost2(release_task.getBonus());
-        }else {
+        } else {
             return null;
         }
     }
@@ -131,22 +135,22 @@ public class GameEntity implements Serializable{
      * 是否显示整个礼包和福利金额标签
      * trur:不显示
      */
-    public boolean isGiftAndBonus(){
+    public boolean isGiftAndBonus() {
         return !isGift() && TextUtils.isEmpty(getBonusText());
     }
 
     /**
      * 是否游戏任务
      */
-    public boolean isGameTask(){
+    public boolean isGameTask() {
         return release_task != null && release_task.getTask() != null;
     }
 
-    public String downLinks(){
+    public String downLinks() {
         try {
-            if(isGameTask()){
+            if (isGameTask()) {
                 return release_task.getTask().getDownload_link();
-            }else {
+            } else {
                 return app.getDownload_url();
             }
         } catch (Exception e) {
@@ -156,4 +160,38 @@ public class GameEntity implements Serializable{
 
     }
 
+    //根据包名获取下载地址
+    public String getDownloadUrl(String packageName) {
+        IDownload download = getDownload();
+        return download != null && TextUtils.equals(download.getPackage_names(), packageName) ? download.getDownload_link() : null;
+    }
+
+    public IDownload getDownload() {
+        try {
+            if (isGameTask()) {
+                return release_task.getTask();
+            }
+            if (app != null) {
+                return app;
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    //根据下载地址获取对应的downloadHelper
+    public DownloadHelper getDownloadHelper(String downloadUrl) {
+        try {
+            if (isGameTask() && TextUtils.equals(downloadUrl, release_task.getTask().getDownload_link())) {
+                return release_task.getDownloadHelper();
+            }
+            if (app != null && TextUtils.equals(downloadUrl, app.getDownload_link())) {
+                return app.getDownloadHelper();
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
 }

+ 0 - 39
app/src/main/java/com/sheep/gamegroup/model/entity/GameEntityList.java

@@ -1,39 +0,0 @@
-package com.sheep.gamegroup.model.entity;
-
-import com.sheep.gamegroup.util.ListUtil;
-
-import java.util.List;
-/**
- * Created by realicing on 2018/10/30.
- * realicing@sina.com
- */
-public class GameEntityList{
-    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) {
-        this.list = list;
-    }
-
-    public GameListType getGameListType() {
-        return gameListType;
-    }
-
-    public List<GameEntity> getList() {
-        return list;
-    }
-
-    public void setList(List<GameEntity> list) {
-        this.list = list;
-    }
-    public void add(List<GameEntity> list){
-        if(this.list == null){
-            this.list = list;
-        } else {
-            ListUtil.addAll(this.list, list);
-        }
-    }
-}

+ 75 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/GameInfoList.java

@@ -0,0 +1,75 @@
+package com.sheep.gamegroup.model.entity;
+
+import android.support.v7.widget.LinearLayoutManager;
+import android.support.v7.widget.RecyclerView;
+import android.view.View;
+import android.widget.TextView;
+
+import com.sheep.jiuyan.samllsheep.SheepApp;
+
+/**
+ * Created by realicing on 2018/11/1.
+ * realicing@sina.com
+ */
+public class GameInfoList {
+    public GameInfoList(String name, RecyclerView.Adapter adapter) {
+        this.name = name;
+        this.adapter = adapter;
+    }
+    public GameInfoList(String name, RecyclerView.Adapter adapter, View.OnClickListener onClickListener) {
+        this.name = name;
+        this.onClickListener = onClickListener;
+        this.adapter = adapter;
+    }
+
+    private String name;
+    private View.OnClickListener onClickListener;
+    private RecyclerView.Adapter adapter;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public View.OnClickListener getOnClickListener() {
+        return onClickListener;
+    }
+
+    public void setOnClickListener(View.OnClickListener onClickListener) {
+        this.onClickListener = onClickListener;
+    }
+
+    public void setMoreViewOnClickListener(TextView textView) {
+        if(textView != null && onClickListener != null){
+            textView.setOnClickListener(onClickListener);
+        }
+    }
+
+    public RecyclerView.Adapter getAdapter() {
+        return adapter;
+    }
+
+    private RecyclerView.LayoutManager layoutManager;
+
+    //设置水平滑动
+    public GameInfoList setHorizontal(){
+        layoutManager = new LinearLayoutManager(SheepApp.getInstance(), LinearLayoutManager.HORIZONTAL, false);
+        return this;
+    }
+    public void setAdapter(RecyclerView.Adapter adapter) {
+        this.adapter = adapter;
+    }
+
+    public void setLayoutManager(RecyclerView.LayoutManager layoutManager) {
+        this.layoutManager = layoutManager;
+    }
+
+    public RecyclerView.LayoutManager getLayoutManager() {
+        if(layoutManager == null)
+            layoutManager = new LinearLayoutManager(SheepApp.getInstance());
+        return layoutManager;
+    }
+}

+ 3 - 3
app/src/main/java/com/sheep/gamegroup/model/entity/GiftBagApp.java

@@ -8,7 +8,7 @@ public class GiftBagApp {
 
     private GiftBag gift_bag;
 
-    private FindApp app;
+    private GameApp app;
 
     private String code;
 
@@ -28,10 +28,10 @@ public class GiftBagApp {
     public GiftBag getGift_bag(){
         return this.gift_bag;
     }
-    public void setApp(FindApp app){
+    public void setApp(GameApp app){
         this.app = app;
     }
-    public FindApp getApp(){
+    public GameApp getApp(){
         return this.app;
     }
     public void setCode(String code){

+ 7 - 6
app/src/main/java/com/sheep/gamegroup/model/entity/GameListTypeList.java

@@ -6,16 +6,17 @@ import java.util.List;
  * Created by realicing on 2018/10/30.
  * realicing@sina.com
  */
-public class GameListTypeList<T> {
+public class ListTypeList<T, TYPE> {
     private List<T> list;
-    private GameListType gameListType;
-    public GameListTypeList(GameListType gameListType, List<T> list) {
-        this.gameListType = gameListType;
+    private TYPE type;
+
+    public ListTypeList(TYPE type, List<T> list) {
+        this.type = type;
         this.list = list;
     }
 
-    public GameListType getGameListType() {
-        return gameListType;
+    public TYPE getType() {
+        return type;
     }
 
     public List<T> getList() {

+ 0 - 398
app/src/main/java/com/sheep/gamegroup/model/entity/PlayGameEntity.java

@@ -1,398 +0,0 @@
-package com.sheep.gamegroup.model.entity;
-
-import android.text.TextUtils;
-
-import com.sheep.gamegroup.helper.DownloadHelper;
-import com.sheep.gamegroup.helper.FindAppHelper;
-import com.sheep.gamegroup.model.api.IDownload;
-
-import java.io.Serializable;
-
-/**
- * 玩转游戏
- * Created by ljy on 2018/9/3.
- */
-
-public class PlayGameEntity implements IDownload, Serializable {
-    private int Id;//integer($int64)
-    private int IsHot;//integer($int64)是否近期最热 1是 2不是
-
-    private int IsPlay;//integer($int64)是否每日必玩 1是 2不是
-
-    private int available_receive;//integer($int64)0:可领取账号 1:不可领取账号
-
-    private long created_at;//integer($int64)
-    private int download;//integer($int64)1:可下载 其他:不可下载
-
-    private long download_at;//integer($int64)预约下载开放时间
-
-    private long download_count;//integer($int64)下载数量
-
-    private long download_count_increment;//integer($int64)下载数量的增量
-
-    private int download_type;//integer($int32)1:非预约下载 2:预约下载
-
-    private String download_url;//string下载地址
-
-    private String icon;//string应用图标
-
-    private String intro;//string应用简介
-
-    private int is_recommend;//integer($int32)是否推荐:0:不推荐 1:推荐
-
-    private String manufacturer;//string厂商
-
-    private String name;//string应用名称
-
-    private String package_id;//stringGameID
-
-    private String package_name;//string应用包名称
-
-    private String package_size;//number($float)包大小(M)
-
-    private int package_type;//integer($int64)出包类型:1:快发出包 2:腾讯出包 3:小米出包 4:其它
-
-    private String pictures;//string宣传图标(分号隔开)
-
-    private int platform;//integer($int32)平台 0:全 1:安卓 2:IOS
-
-    private int receive_account;//integer($int64)0:未领取账号 1:已领取账号
-
-    private int record;//integer($int64)1:可记录 其他:不可记录
-
-    private float score;//number($float)评分
-
-    private long score_count;//integer($int64)评分人数
-
-    private int sort;//integer($int64)排序:越大越靠前
-
-    private int status;//integer($int32)1:开启 2:关闭
-
-    private String type;//string类型
-
-    private long updated_at;//integer($int64)
-    private String versions;//string版本号
-
-    private String game_tag;//游戏标签,可多选,逗号分割
-
-    public String getGame_tag() {
-        return game_tag;
-    }
-
-    public void setGame_tag(String game_tag) {
-        this.game_tag = game_tag;
-    }
-
-    public int getId() {
-        return Id;
-    }
-
-    public void setId(int id) {
-        Id = id;
-    }
-
-    public int getIsHot() {
-        return IsHot;
-    }
-
-    public void setIsHot(int isHot) {
-        IsHot = isHot;
-    }
-
-    public int getIsPlay() {
-        return IsPlay;
-    }
-
-    public void setIsPlay(int isPlay) {
-        IsPlay = isPlay;
-    }
-
-    public int getAvailable_receive() {
-        return available_receive;
-    }
-
-    public void setAvailable_receive(int available_receive) {
-        this.available_receive = available_receive;
-    }
-
-    public long getCreated_at() {
-        return created_at;
-    }
-
-    public void setCreated_at(long created_at) {
-        this.created_at = created_at;
-    }
-
-    public int getDownload() {
-        return download;
-    }
-
-    public void setDownload(int download) {
-        this.download = download;
-    }
-
-    public long getDownload_at() {
-        return download_at;
-    }
-
-    public void setDownload_at(long download_at) {
-        this.download_at = download_at;
-    }
-
-    public long getDownload_count() {
-        return download_count;
-    }
-
-    public void setDownload_count(long download_count) {
-        this.download_count = download_count;
-    }
-
-    public long getDownload_count_increment() {
-        return download_count_increment;
-    }
-
-    public void setDownload_count_increment(long download_count_increment) {
-        this.download_count_increment = download_count_increment;
-    }
-
-    public int getDownload_type() {
-        return download_type;
-    }
-
-    public void setDownload_type(int download_type) {
-        this.download_type = download_type;
-    }
-
-    public String getDownload_url() {
-        return download_url;
-    }
-
-    public void setDownload_url(String download_url) {
-        this.download_url = download_url;
-    }
-
-
-    @Override
-    public boolean equals(Object obj) {
-        return obj instanceof PlayGameEntity && Id == ((PlayGameEntity) obj).Id;
-    }
-
-    @Override
-    public String getPackage_names() {
-        return package_name;
-    }
-
-    @Override
-    public int getTask_type() {
-        return 0;
-    }
-
-    @Override
-    public String getDownload_link() {
-        return download_url;
-    }
-
-    @Override
-    public String getTask_name() {
-        return name;
-    }
-
-    public String getIcon() {
-        return icon;
-    }
-
-    public void setIcon(String icon) {
-        this.icon = icon;
-    }
-
-    public String getIntro() {
-        return intro;
-    }
-
-    public void setIntro(String intro) {
-        this.intro = intro;
-    }
-
-    public int getIs_recommend() {
-        return is_recommend;
-    }
-
-    public void setIs_recommend(int is_recommend) {
-        this.is_recommend = is_recommend;
-    }
-
-    public String getManufacturer() {
-        return manufacturer;
-    }
-
-    public void setManufacturer(String manufacturer) {
-        this.manufacturer = manufacturer;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public String getPackage_id() {
-        return package_id;
-    }
-
-    public void setPackage_id(String package_id) {
-        this.package_id = package_id;
-    }
-
-    public String getPackage_name() {
-        return package_name;
-    }
-
-    public void setPackage_name(String package_name) {
-        this.package_name = package_name;
-    }
-
-    public String getPackage_size() {
-        return TextUtils.isEmpty(package_size)?"0":package_size;
-    }
-
-    @Override
-    public int getAcceptedTaskId() {
-        return Id;
-    }
-
-    public void setPackage_size(String package_size) {
-        this.package_size = package_size;
-    }
-
-    public int getPackage_type() {
-        return package_type;
-    }
-
-    public void setPackage_type(int package_type) {
-        this.package_type = package_type;
-    }
-
-    public String getPictures() {
-        return pictures;
-    }
-
-    public void setPictures(String pictures) {
-        this.pictures = pictures;
-    }
-
-    public int getPlatform() {
-        return platform;
-    }
-
-    public void setPlatform(int platform) {
-        this.platform = platform;
-    }
-
-    public int getReceive_account() {
-        return receive_account;
-    }
-
-    public void setReceive_account(int receive_account) {
-        this.receive_account = receive_account;
-    }
-
-    public int getRecord() {
-        return record;
-    }
-
-    public void setRecord(int record) {
-        this.record = record;
-    }
-
-    public float getScore() {
-        return score;
-    }
-
-    public void setScore(float score) {
-        this.score = score;
-    }
-
-    public long getScore_count() {
-        return score_count;
-    }
-
-    public void setScore_count(long score_count) {
-        this.score_count = score_count;
-    }
-
-    public int getSort() {
-        return sort;
-    }
-
-    public void setSort(int sort) {
-        this.sort = sort;
-    }
-
-    public int getStatus() {
-        return status;
-    }
-
-    public void setStatus(int status) {
-        this.status = status;
-    }
-
-    public String getType() {
-        return type;
-    }
-
-    public void setType(String type) {
-        this.type = type;
-    }
-
-    public long getUpdated_at() {
-        return updated_at;
-    }
-
-    public void setUpdated_at(long updated_at) {
-        this.updated_at = updated_at;
-    }
-
-    public String getVersions() {
-        return versions;
-    }
-
-    public void setVersions(String versions) {
-        this.versions = versions;
-    }
-    /**
-     * 是否可以下载
-     * @return
-     */
-    public boolean isCanDownload(){
-        return download == 1;//可以下载
-    }
-    /**
-     * 是否可以记录
-     * @return
-     */
-    public boolean isCanRecord() {
-        return record == 1;//1:可记录 其他:不可记录
-    }
-    private FindAppHelper findAppHelper = new FindAppHelper();
-    private DownloadHelper downloadHelper = new DownloadHelper();
-
-    public FindAppHelper getFindAppHelper() {
-        return findAppHelper;
-    }
-    public DownloadHelper getDownloadHelper() {
-        return downloadHelper;
-    }
-
-    /**
-     * 更新下载状态
-     * @param status
-     */
-    public void updateState(int status) {
-        findAppHelper.updateState(status);
-    }
-    public void updateStateRelease(int status) {
-        downloadHelper.updateState(status);
-    }
-}

+ 22 - 19
app/src/main/java/com/sheep/gamegroup/util/CommonUtil.java

@@ -41,13 +41,12 @@ import com.sheep.gamegroup.helper.TaskHelper;
 import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.DialogConfig;
 import com.sheep.gamegroup.model.entity.Ext;
-import com.sheep.gamegroup.model.entity.FindApp;
 import com.sheep.gamegroup.model.entity.FriendAndAwardEntity;
 import com.sheep.gamegroup.model.entity.GameAccountEntity;
+import com.sheep.gamegroup.model.entity.GameApp;
 import com.sheep.gamegroup.model.entity.GameEntity;
 import com.sheep.gamegroup.model.entity.GiftBagApp;
 import com.sheep.gamegroup.model.entity.HomeListEntity;
-import com.sheep.gamegroup.model.entity.PlayGameEntity;
 import com.sheep.gamegroup.model.entity.RobTask;
 import com.sheep.gamegroup.model.entity.RouserArticlesEntity;
 import com.sheep.gamegroup.model.entity.SlideshowEty;
@@ -62,7 +61,6 @@ import com.sheep.gamegroup.model.entity.XiaomiGameEntity;
 import com.sheep.gamegroup.model.util.EntityUtils;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
 import com.sheep.gamegroup.usage.AppUsageManager;
-import com.sheep.gamegroup.view.activity.ActFindInformation;
 import com.sheep.gamegroup.view.activity.GameTaskOrderListAct;
 import com.sheep.gamegroup.view.dialog.DialogNewbieTaskList;
 import com.sheep.gamegroup.view.dialog.DialogShare;
@@ -540,6 +538,7 @@ public class CommonUtil {
 
         }
     }
+
     //以龙猫开头的则认为是龙猫app
     public static final String LONG_MAO_APP_NAME = "龙猫";
     public static final String LONG_MAO_APP_PACKAGE_NAME = "com.cfyl.galesaur.guess";
@@ -1978,7 +1977,7 @@ public class CommonUtil {
     /**
      * 小米游戏账号领取
      */
-    public void xiaomiRevieceAcctoun(TextView find_information_game_task_top, final Object items, final Activity activity) {
+    public void xiaomiRevieceAcctoun(TextView find_information_game_task_top, final Object item, final Activity activity) {
         XIAOMI_GAME_RECEIVE.onEvent();
         find_information_game_task_top.setText("领取福利号");
         find_information_game_task_top.setOnClickListener(new View.OnClickListener() {
@@ -1986,16 +1985,14 @@ public class CommonUtil {
             public void onClick(View v) {
 
                 JSONObject jsonObject = new JSONObject();
-                if (items instanceof XiaomiGameEntity) {
+                if (item instanceof XiaomiGameEntity) {
 
-                    jsonObject.put("id", ((XiaomiGameEntity) items).getId());
-                } else if (items instanceof FindApp) {
-                    jsonObject.put("id", ((FindApp) items).getId());
-                } else if (items instanceof PlayGameEntity) {
-                    jsonObject.put("id", ((PlayGameEntity) items).getId());
+                    jsonObject.put("id", ((XiaomiGameEntity) item).getId());
+                } else if (item instanceof GameApp) {
+                    jsonObject.put("id", ((GameApp) item).getId());
                 }
 
-                ViewUtil.newInstance().showProgress((Activity) activity);
+                ViewUtil.newInstance().showProgress(activity);
                 SheepApp.getInstance()
                         .getNetComponent()
                         .getApiService()
@@ -2006,7 +2003,7 @@ public class CommonUtil {
                             @Override
                             public void onError(BaseMessage baseMessage) {
                                 G.showToast(baseMessage.getMsg());
-                                ViewUtil.newInstance().hideProgress((Activity) activity);
+                                ViewUtil.newInstance().hideProgress(activity);
                             }
 
                             @SuppressLint({"StringFormatInvalid", "LocalSuppress"})
@@ -2084,7 +2081,7 @@ public class CommonUtil {
                         if (tvProgress == null) {
                             return;
                         }
-                        if(isShowSpeed)
+                        if (isShowSpeed)
                             tvProgress.setText(String.format(Locale.CHINA, "%d%%(%s)", Math.abs(p), speed));//添加下载速度
                         else
                             tvProgress.setText(String.format(Locale.CHINA, "%d%%", Math.abs(p)));
@@ -2451,16 +2448,19 @@ public class CommonUtil {
      * 0,--------1,已接受任务 2,正在进行中,3完成任务,4放弃任务,5任务失败,6审核失败,7提交审核,8任务已下线,9至少完成了一个任务了
      */
     public void palyGameDetailBtnValue(final Context context, final GameEntity gameEntity, final TextView detail_task_tv_center, final int type) {
+        if (detail_task_tv_center == null)
+            return;
+        final boolean showSimpleText = detail_task_tv_center.getText().length() < 4;
         final TaskReleaseEty releaseEty = gameEntity.getRelease_task();
         final TaskEty taskEty = releaseEty != null ? releaseEty.getTask() : null;
         if (releaseEty != null && taskEty != null) {//游戏任务
 
             if (taskEty.isGameReservationCantDownload()) {//预约
                 if (gameEntity.getStatus() == 1 || gameEntity.getStatus() == 2 || gameEntity.getStatus() == 3) {
-                    detail_task_tv_center.setText("已经预约");
+                    detail_task_tv_center.setText(DownloadTextUtl.getHasReservationText(showSimpleText));
                     detail_task_tv_center.setEnabled(false);
                 } else {
-                    detail_task_tv_center.setText("预约下载");
+                    detail_task_tv_center.setText(DownloadTextUtl.getReservationText(showSimpleText));
                     detail_task_tv_center.setEnabled(true);
                     if (type == 0) {
                         detail_task_tv_center.setOnClickListener(new View.OnClickListener() {
@@ -2471,7 +2471,7 @@ public class CommonUtil {
                                     public void call(Integer integer) {
                                         if (integer > 0) {
                                             gameEntity.setAccepted_task_id(integer);
-                                            detail_task_tv_center.setText("已预约");
+                                            detail_task_tv_center.setText(DownloadTextUtl.getHasReservationText(showSimpleText));
                                             detail_task_tv_center.setEnabled(false);
 
                                         }
@@ -2656,6 +2656,7 @@ public class CommonUtil {
             TaskHelper.setNumText((TextView) itemView.findViewById(R.id.item_num_tv1), taskReleaseEty);
         }
     }
+
     //使webView支持下载文件
     public void setDownloadListener(final Activity activity, WebView webView) {
         webView.setDownloadListener(new DownloadListener() {
@@ -2666,6 +2667,7 @@ public class CommonUtil {
             }
         });
     }
+
     //使webView支持下载文件
     public void setDownloadListener(final Activity activity, com.tencent.smtt.sdk.WebView webView) {
         webView.setDownloadListener(new com.tencent.smtt.sdk.DownloadListener() {
@@ -2677,17 +2679,18 @@ public class CommonUtil {
             }
         });
     }
+
     //显示下载提示框
-    public void showDownloadDialog(final Activity activity, final String url){
+    public void showDownloadDialog(final Activity activity, final String url) {
         final String fileName = com.sheep.gamegroup.util.FileUtil.getFileName(url);
         final File saveFile = new File(DIR, fileName);
         final boolean exists = saveFile.exists();
         ViewUtil.showMsgDialog(activity, new DialogConfig().setTitle("下载提示")
-                .setMsg((exists ? "是否重新下载文件:" : "是否下载文件:" )+ saveFile.getAbsolutePath()).setBtnLeftText("取消下载").setBtnRightText("确认下载")
+                .setMsg((exists ? "是否重新下载文件:" : "是否下载文件:") + saveFile.getAbsolutePath()).setBtnLeftText("取消下载").setBtnRightText("确认下载")
                 .setBtnRightOnClickListener(new View.OnClickListener() {
                     @Override
                     public void onClick(View view) {
-                        if(exists && saveFile.delete()){
+                        if (exists && saveFile.delete()) {
                             LogUtil.println("setDownloadListener", "setDownloadListener", "onDownloadStart", url, saveFile.getAbsolutePath(), "成功删除原来的文件");
                         }
                         DownloadService.sysDownload(activity, url, fileName, "来自小绵羊的下载:" + fileName, fileName, "系统开始下载apk");

+ 56 - 0
app/src/main/java/com/sheep/gamegroup/util/DownloadTextUtl.java

@@ -0,0 +1,56 @@
+package com.sheep.gamegroup.util;
+
+import com.sheep.gamegroup.greendao.download.DownLoadInfo;
+import com.sheep.jiuyan.samllsheep.R;
+import com.sheep.jiuyan.samllsheep.SheepApp;
+
+import java.util.Locale;
+
+/**
+ * Created by realicing on 2018/11/1.
+ * realicing@sina.com
+ * 下载按钮显示的文本
+ */
+public class DownloadTextUtl {
+
+    public static String getHasReservationText(boolean showSimpleText) {
+        return showSimpleText ? "已预约" : "已经预约";
+    }
+    public static String getReservationText(boolean showSimpleText) {
+        return showSimpleText ? "预约" : "预约下载";
+    }
+
+    public static String getStartDownloadText(boolean showSimpleText) {
+        return showSimpleText ? "下载" : CommonUtil.START_DOWNLOAD;
+    }
+    public static String getStartInstallText(boolean showSimpleText) {
+        return showSimpleText ? "安装" : CommonUtil.START_INSTALL;
+    }
+    public static String getStartOpenText(boolean showSimpleText) {
+        return showSimpleText ? "打开" : CommonUtil.GAME_OPEN;
+    }
+    public static String getOpenApplyText(boolean showSimpleText) {
+        return showSimpleText ? "打开" : CommonUtil.OPEN_APPLY;
+    }
+
+    public static String getContinueDownloadText(boolean showSimpleText) {
+        return showSimpleText ? "继续" : CommonUtil.CONTINUE_DOWNLOAD;
+    }
+    public static String getFailDownloadText(boolean showSimpleText) {
+        return showSimpleText ? "失败" : CommonUtil.FAIL_DOWNLOAD;
+    }
+    public static String getTaskCancelText(boolean showSimpleText) {
+        return showSimpleText ? "已取消" : "已经取消";
+    }
+
+    public static String getProgressText(boolean showSimpleText, DownLoadInfo task) {
+        if(showSimpleText)
+            return String.format(Locale.CHINA, "%d%%", Math.abs(task.getMPercent()));
+        else
+            return String.format(Locale.CHINA, "%d%%(%s)", Math.abs(task.getMPercent()), task.getAverageSpeed());//添加下载速度;
+    }
+
+    public static String getNoDownloadText(boolean showSimpleText) {
+        return showSimpleText ? "无下载" : SheepApp.getInstance().getResources().getString(R.string.error_download_link);
+    }
+}

+ 1 - 1
app/src/main/java/com/sheep/gamegroup/util/DownloadUtil.java

@@ -446,6 +446,6 @@ public class DownloadUtil {
             return false;
         }
         File file = new File(downLoadInfo.getMApkPath());
-        return file.exists() && downLoadInfo.getMDownloadedSize() == (double) file.getTotalSpace();
+        return file.exists() && downLoadInfo.getMDownloadedSize() != null && downLoadInfo.getMDownloadedSize() == (double) file.getTotalSpace();
     }
 }

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

@@ -23,7 +23,7 @@ import com.sheep.gamegroup.model.entity.Container;
 import com.sheep.gamegroup.model.entity.CreditCard;
 import com.sheep.gamegroup.model.entity.DialogConfig;
 import com.sheep.gamegroup.model.entity.DialogEntity;
-import com.sheep.gamegroup.model.entity.FindApp;
+import com.sheep.gamegroup.model.entity.GameApp;
 import com.sheep.gamegroup.model.entity.FindItem;
 import com.sheep.gamegroup.model.entity.GameListType;
 import com.sheep.gamegroup.model.entity.HomeListEntity;
@@ -66,7 +66,7 @@ import com.sheep.gamegroup.view.activity.ActNewAboutUs;
 import com.sheep.gamegroup.view.activity.ActNewbieTaskList;
 import com.sheep.gamegroup.view.activity.ActNotice;
 import com.sheep.gamegroup.view.activity.ActPay;
-import com.sheep.gamegroup.view.activity.ActPlayGameDetail;
+import com.sheep.gamegroup.view.activity.ActGcGameAppDetail;
 import com.sheep.gamegroup.view.activity.ActPlayGameList;
 import com.sheep.gamegroup.view.activity.ActPlayGameRecommendList;
 import com.sheep.gamegroup.view.activity.ActPlayGameUserLikeList;
@@ -1581,7 +1581,7 @@ public class Jump2View {
      * @param activity
      * @param findApp
      */
-    public void goFindGame(Activity activity, FindApp findApp) {
+    public void goFindGame(Activity activity, GameApp findApp) {
         Intent intent = new Intent(activity, ActFindGame.class);
         intent.putExtra("id", findApp.getId());
         activity.startActivity(intent);
@@ -1833,7 +1833,7 @@ public class Jump2View {
             G.showToast(R.string.coming_soon);
             return;
         }
-        Intent intent = new Intent(activity, ActPlayGameDetail.class);
+        Intent intent = new Intent(activity, ActGcGameAppDetail.class);
         intent.putExtra("id", id);
         activity.startActivity(intent);
         GAME_PLAY_GAME_DETAIL.onEvent();
@@ -2067,7 +2067,7 @@ public class Jump2View {
         if (activity instanceof BaseActYmPermissionCheck) {
             if (YmConfig.isToastTotalPrice()) {
                 //获取总积分
-                SheepApp.getInstance().getNetComponent().getApiService().getYmTotalPrice()
+                SheepApp.getInstance().getNetComponent().getApiService().getYmTotalPrice(DataUtil.getInstance().getUserId())
                         .subscribeOn(Schedulers.io())
                         .observeOn(AndroidSchedulers.mainThread())
                         .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {

+ 1 - 1
app/src/main/java/com/sheep/gamegroup/util/ListUtil.java

@@ -195,7 +195,7 @@ public class ListUtil {
         removeItem(list, new CallBack<T, Boolean>() {
             @Override
             public Boolean call(T t) {
-                return t == null;
+                return t == null || t.toString().isEmpty();
             }
         });
     }

+ 37 - 0
app/src/main/java/com/sheep/gamegroup/util/TagListUtil.java

@@ -0,0 +1,37 @@
+package com.sheep.gamegroup.util;
+
+import android.support.v7.widget.LinearLayoutManager;
+import android.support.v7.widget.RecyclerView;
+import android.widget.TextView;
+
+import com.kfzs.appstore.utils.adapter.recyclerview.RecyclerViewAdapter;
+import com.kfzs.appstore.utils.adapter.recyclerview.ViewHolder;
+import com.sheep.jiuyan.samllsheep.R;
+import com.sheep.jiuyan.samllsheep.SheepApp;
+
+import java.util.List;
+
+/**
+ * Created by realicing on 2018/10/31.
+ * realicing@sina.com
+ */
+public class TagListUtil {
+
+    //设置tag标签横向列表
+    public static void setTagList(RecyclerView recyclerView, List<String> tagList) {
+        LinearLayoutManager playGameActManager = new LinearLayoutManager(SheepApp.getInstance(), LinearLayoutManager.HORIZONTAL, false);
+        recyclerView.setHasFixedSize(true);
+        recyclerView.setNestedScrollingEnabled(false);
+        recyclerView.setLayoutManager(playGameActManager);
+        recyclerView.setAdapter(new RecyclerViewAdapter<String>(SheepApp.getInstance(), R.layout.item_tag, tagList) {
+            @Override
+            public void convert(ViewHolder viewHolder, String name, int position) {
+                if(viewHolder.itemView instanceof TextView){
+                    ViewUtil.setText((TextView) viewHolder.itemView, name);
+                }
+            }
+        });
+
+
+    }
+}

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

@@ -613,5 +613,6 @@ public class TestUtil {
     //开启后可跳转各种广告与升级
     public static boolean isDev() {
         return BuildConfig.DEBUG;
+//        return false;
     }
 }

+ 29 - 0
app/src/main/java/com/sheep/gamegroup/util/TextViewUtil.java

@@ -0,0 +1,29 @@
+package com.sheep.gamegroup.util;
+
+import android.text.Layout;
+import android.view.ViewTreeObserver;
+import android.widget.TextView;
+
+import rx.functions.Action1;
+
+/**
+ * Created by realicing on 2018/11/1.
+ * realicing@sina.com
+ * TextView 帮助类
+ */
+public class TextViewUtil {
+    //监听TextView是否有省略号,返回数据 > 0 代表有省略
+    public static void listenEllipsizeChange(final TextView textView, final Action1<Integer> action1) {
+        textView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
+            @Override
+            public void onGlobalLayout() {
+                Layout layout = textView.getLayout();
+                if (layout != null) {
+                    int lines = layout.getLineCount();
+                    action1.call(layout.getEllipsisCount(lines - 1));
+                }
+            }
+        });
+
+    }
+}

+ 17 - 0
app/src/main/java/com/sheep/gamegroup/util/ViewUtil.java

@@ -1431,6 +1431,23 @@ public class ViewUtil {
             GlideImageLoader.roundedCornersImage(imageView, pictures, radius);
         }
     }
+    public static void setGameImage(ImageView imageView, String pictures) {
+        if (imageView != null && !TextUtils.isEmpty(pictures)) {
+            if (pictures.contains(";")) {
+                pictures = pictures.split(";")[0];
+            }
+            GlideImageLoader.setGameImage(imageView, pictures);
+        }
+    }
+
+    public static void setGameImage(ImageView imageView, String pictures, int radius) {
+        if (imageView != null && !TextUtils.isEmpty(pictures)) {
+            if (pictures.contains(";")) {
+                pictures = pictures.split(";")[0];
+            }
+            GlideImageLoader.setGameImage(imageView, pictures, radius);
+        }
+    }
 
     public static void setTextTime(TextView textView, long time, String format) {
         if (textView != null) {

+ 10 - 11
app/src/main/java/com/sheep/gamegroup/view/activity/ActFindGame.java

@@ -22,7 +22,7 @@ import com.sheep.gamegroup.event.BigEvent;
 import com.sheep.gamegroup.greendao.download.DownLoadInfo;
 import com.sheep.gamegroup.helper.ImageListHelper;
 import com.sheep.gamegroup.model.entity.BaseMessage;
-import com.sheep.gamegroup.model.entity.FindApp;
+import com.sheep.gamegroup.model.entity.GameApp;
 import com.sheep.gamegroup.model.entity.FindAppScore;
 import com.sheep.gamegroup.model.entity.MyFindAppCore;
 import com.sheep.gamegroup.model.entity.UserEntity;
@@ -194,7 +194,7 @@ public class ActFindGame extends BaseActivity {
 
     @Override
     public void initData() {
-        FindApp findApp = DataUtil.getInstance().getCacheResult(ApiKey.applications(id), FindApp.class);
+        GameApp findApp = DataUtil.getInstance().getCacheResult(ApiKey.applications(id), GameApp.class);
         if (findApp != null) {
             loadApp(findApp);
         }
@@ -230,7 +230,7 @@ public class ActFindGame extends BaseActivity {
                     public void onNext(BaseMessage baseMessage) {
                         boolean isNewData = DataUtil.getInstance().isNewData(ApiKey.applications(id));
                         if (isNewData) {
-                            FindApp findApp = baseMessage.getData(FindApp.class);
+                            GameApp findApp = baseMessage.getData(GameApp.class);
                             loadApp(findApp);
                         }
                         hideProgress();
@@ -245,7 +245,7 @@ public class ActFindGame extends BaseActivity {
                 });
     }
 
-    private void loadApp(FindApp findApp) {
+    private void loadApp(GameApp findApp) {
         if (findApp != null) {
             loadData(findApp);
         } else {
@@ -323,10 +323,9 @@ public class ActFindGame extends BaseActivity {
     @BindView(R.id.find_game_list)
     RecyclerView find_game_list;
     private ArrayList<String> pictureList = ListUtil.emptyList();
-    private ImageListHelper imageListHelper = new ImageListHelper();
 
     private void bindBanner() {
-        imageListHelper.initList(this, find_game_list, pictureList);
+        ImageListHelper.initList(this, find_game_list, pictureList);
     }
 
     //游戏简介与下载
@@ -339,10 +338,10 @@ public class ActFindGame extends BaseActivity {
     @BindView(R.id.find_game_down_tv)
     TextView find_game_down_tv;
 
-    private FindApp findApp;
+    private GameApp findApp;
     private boolean isNeedReservation = false;
 
-    private void loadData(final FindApp findApp) {
+    private void loadData(final GameApp findApp) {
         this.findApp = findApp;
         //游戏简介与下载
         GlideImageLoader.setGameImage(find_game_iv, findApp.getIcon());
@@ -365,7 +364,7 @@ public class ActFindGame extends BaseActivity {
             pictureList.clear();
             ListUtil.addAll(pictureList, pictures.split(";"));
             find_game_list.setVisibility(View.VISIBLE);
-            imageListHelper.notifyDataSetChanged();
+            find_game_list.getAdapter().notifyDataSetChanged();
         } else {
             find_game_list.setVisibility(View.GONE);
         }
@@ -508,7 +507,7 @@ public class ActFindGame extends BaseActivity {
     @BindView(R.id.find_game_info_wv)
     WebView find_game_info_wv;
 
-    private void loadAppInfo(final FindApp findApp) {
+    private void loadAppInfo(final GameApp findApp) {
         ViewUtil.loadDataWithBaseURL(find_game_info_wv, findApp.getIntro());
     }
 
@@ -527,7 +526,7 @@ public class ActFindGame extends BaseActivity {
     }
 
     //更新按钮状态与添加点击事件
-    private void updateView(Activity activity, FindApp findApp, TextView textView) {
+    private void updateView(Activity activity, GameApp findApp, TextView textView) {
         if (findApp.getAvailable_receive() == 0 && findApp.getReceive_account() == 0) {//未领取账号
 
             CommonUtil.getInstance()

+ 5 - 11
app/src/main/java/com/sheep/gamegroup/view/activity/ActFindInformation.java

@@ -17,7 +17,6 @@ import android.view.MotionEvent;
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.WindowManager;
-import android.webkit.DownloadListener;
 import android.webkit.WebChromeClient;
 import android.webkit.WebSettings;
 import android.webkit.WebView;
@@ -31,14 +30,12 @@ import com.sheep.gamegroup.event.BigEvent;
 import com.sheep.gamegroup.greendao.download.DownLoadInfo;
 import com.sheep.gamegroup.helper.TaskHelper;
 import com.sheep.gamegroup.model.entity.BaseMessage;
-import com.sheep.gamegroup.model.entity.DialogConfig;
-import com.sheep.gamegroup.model.entity.FindApp;
+import com.sheep.gamegroup.model.entity.GameApp;
 import com.sheep.gamegroup.model.entity.FindItem;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
 import com.sheep.gamegroup.util.CommonUtil;
 import com.sheep.gamegroup.util.DataUtil;
 import com.sheep.gamegroup.util.DownloadUtil;
-import com.sheep.gamegroup.util.FileUtil;
 import com.sheep.gamegroup.util.GlideImageLoader;
 import com.sheep.gamegroup.util.Jump2View;
 import com.sheep.gamegroup.util.ListUtil;
@@ -50,7 +47,6 @@ import com.sheep.gamegroup.util.ViewUtil;
 import com.sheep.gamegroup.view.adapter.AdbCommonRecycler;
 import com.sheep.jiuyan.samllsheep.R;
 import com.sheep.jiuyan.samllsheep.SheepApp;
-import com.sheep.jiuyan.samllsheep.service.DownloadService;
 import com.sheep.jiuyan.samllsheep.utils.G;
 import com.sheep.jiuyan.samllsheep.utils.PackageUtil;
 import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
@@ -59,7 +55,6 @@ import org.afinal.simplecache.ApiKey;
 import org.greenrobot.eventbus.EventBus;
 import org.greenrobot.eventbus.Subscribe;
 
-import java.io.File;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Locale;
@@ -73,7 +68,6 @@ import rx.schedulers.Schedulers;
 import static android.content.Intent.ACTION_PACKAGE_ADDED;
 import static android.content.Intent.ACTION_PACKAGE_REMOVED;
 import static com.sheep.gamegroup.util.UMConfigUtils.Event.FIND_SHARE;
-import static com.sheep.jiuyan.samllsheep.utils.ClassFileHelper.DIR;
 
 /**
  * Created by realicing on 2018/5/10.
@@ -451,10 +445,10 @@ public class ActFindInformation extends BaseActivity implements Action1<Integer>
         }
     }
 
-    private FindApp findApp;
+    private GameApp findApp;
 
     private void initFindApp(int application_id) {
-        FindApp cacheResult = DataUtil.getInstance().getCacheResult(ApiKey.applications(id), FindApp.class);
+        GameApp cacheResult = DataUtil.getInstance().getCacheResult(ApiKey.applications(id), GameApp.class);
         if (cacheResult != null) {
             findApp = cacheResult;
             notifyDataSetChanged();
@@ -467,7 +461,7 @@ public class ActFindInformation extends BaseActivity implements Action1<Integer>
                     public void onNext(BaseMessage baseMessage) {
                         boolean isNewData = DataUtil.getInstance().isNewData(ApiKey.applications(id));
                         if (isNewData) {
-                            findApp = baseMessage.getData(FindApp.class);
+                            findApp = baseMessage.getData(GameApp.class);
                             notifyDataSetChanged();
                         } else {
                             refresh.setRefreshing(false);
@@ -508,7 +502,7 @@ public class ActFindInformation extends BaseActivity implements Action1<Integer>
     }
 
     //更新按钮状态与添加点击事件
-    private void updateView(Activity activity, FindApp findApp, TextView textView) {
+    private void updateView(Activity activity, GameApp findApp, TextView textView) {
         if (findApp.isCanDownload()) {//可下载
             downLoadTextViewMap.put(findApp.getDownload_link(), textView);
             downLoadTextViewMap.put(findApp.getPackage_name(), textView);

+ 266 - 0
app/src/main/java/com/sheep/gamegroup/view/activity/ActGcGameAppDetail.java

@@ -0,0 +1,266 @@
+package com.sheep.gamegroup.view.activity;
+
+import android.content.Intent;
+import android.support.annotation.NonNull;
+import android.support.design.widget.TabLayout;
+import android.support.v4.app.Fragment;
+import android.support.v4.view.ViewPager;
+import android.support.v7.widget.RecyclerView;
+import android.text.TextUtils;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.scwang.smartrefresh.layout.SmartRefreshLayout;
+import com.scwang.smartrefresh.layout.api.RefreshLayout;
+import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
+import com.sheep.gamegroup.absBase.AbsGetDownloadListener;
+import com.sheep.gamegroup.absBase.IRefresh;
+import com.sheep.gamegroup.event.BigEvent;
+import com.sheep.gamegroup.helper.DownloadHelper;
+import com.sheep.gamegroup.model.entity.BaseMessage;
+import com.sheep.gamegroup.model.entity.GameEntity;
+import com.sheep.gamegroup.model.util.SheepSubscriber;
+import com.sheep.gamegroup.util.CommonUtil;
+import com.sheep.gamegroup.util.DataUtil;
+import com.sheep.gamegroup.util.ListUtil;
+import com.sheep.gamegroup.util.RefreshUtil;
+import com.sheep.gamegroup.util.TagListUtil;
+import com.sheep.gamegroup.util.ViewUtil;
+import com.sheep.gamegroup.view.adapter.TitleFragmentListAdapter;
+import com.sheep.gamegroup.view.fragment.FgtGcGameAppDetail;
+import com.sheep.gamegroup.view.fragment.FgtNull;
+import com.sheep.jiuyan.samllsheep.R;
+import com.sheep.jiuyan.samllsheep.SheepApp;
+import com.sheep.jiuyan.samllsheep.ui.base.BaseActivity;
+import com.sheep.jiuyan.samllsheep.utils.G;
+
+import org.afinal.simplecache.ApiKey;
+import org.greenrobot.eventbus.EventBus;
+import org.greenrobot.eventbus.Subscribe;
+
+import java.util.List;
+
+import butterknife.BindView;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.schedulers.Schedulers;
+
+
+/**
+ * Created by realicing on 2018/10/31.
+ * realicing@sina.com
+ * 新的游戏详情界面
+ */
+public class ActGcGameAppDetail extends BaseActivity {
+    @BindView(R.id.refresh)
+    SmartRefreshLayout refresh;
+    @BindView(R.id.tabLayout)
+    TabLayout tabLayout;
+    @BindView(R.id.viewPager)
+    ViewPager viewPager;
+    @BindView(R.id.gc_game_app_detail_iv)
+    ImageView gc_game_app_detail_iv;
+    @BindView(R.id.gc_game_app_detail_icon)
+    ImageView gc_game_app_detail_icon;
+    @BindView(R.id.gc_game_app_detail_name)
+    TextView gc_game_app_detail_name;
+    @BindView(R.id.gc_game_app_detail_bt2)
+    TextView gc_game_app_detail_bt2;
+    @BindView(R.id.gc_game_app_detail_tag_list)
+    RecyclerView recyclerView;
+
+    @Override
+    protected int onLayout() {
+        return R.layout.act_gc_game_app_detail;
+    }
+
+    private int id;
+
+    @Override
+    protected void onObject() {
+        id = getIntent().getIntExtra("id", 0);
+    }
+
+    private TitleFragmentListAdapter mAdapter;
+    private FgtGcGameAppDetail fgtGcPlayGameDetail;
+
+    @Override
+    protected void onView() {
+        EventBus.getDefault().register(this);
+        //tagList
+        TagListUtil.setTagList(recyclerView, tagList);
+        //viewPager
+        mAdapter = new TitleFragmentListAdapter(getSupportFragmentManager());
+        fgtGcPlayGameDetail = FgtGcGameAppDetail.newInstance();
+        fgtGcPlayGameDetail.setAppId(id);
+        mAdapter.add(fgtGcPlayGameDetail, "详情");
+        mAdapter.add(new FgtNull(), "评价");
+        mAdapter.add(new FgtNull(), "福利");
+        viewPager.setOffscreenPageLimit(3);
+        viewPager.setAdapter(mAdapter);
+        tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(viewPager));
+        tabLayout.setupWithViewPager(viewPager);
+        CommonUtil.getInstance().reflex(tabLayout, this);
+        //refresh
+        refresh.setOnRefreshListener(new OnRefreshListener() {
+
+            @Override
+            public void onRefresh(@NonNull RefreshLayout refreshLayout) {
+                initData();
+            }
+        });
+        RefreshUtil.newInstance().publicParameter(refresh, this);
+    }
+
+    private List<String> tagList = ListUtil.emptyList();
+
+    @Override
+    protected void onData() {
+        GameEntity gameEntity = DataUtil.getInstance().getCacheResult(ApiKey.playGameDetail(id), GameEntity.class);
+        checkData(gameEntity);
+        initDetailFromNet();
+        if (refresh != null) {
+            refresh.autoRefresh();
+        }
+    }
+
+    //重置view
+    private void resetView() {
+        ViewUtil.setDefaultText(gc_game_app_detail_name);
+    }
+
+    //检查数据
+    private void checkData(GameEntity gameEntity) {
+        if (gameEntity != null && gameEntity.getApp() != null) {
+            loadData(gameEntity);
+        } else {
+            resetView();
+        }
+    }
+
+    private GameEntity gameEntity;
+
+    //加载游戏数据
+    private void loadData(GameEntity gameEntity) {
+        this.gameEntity = gameEntity;
+        //加载游戏背景
+        ViewUtil.setImage(gc_game_app_detail_iv, gameEntity.getApp().getPictures());
+        //加载游戏图标
+        ViewUtil.setGameImage(gc_game_app_detail_icon, gameEntity.getApp().getIcon());
+        //加载游戏名字
+        ViewUtil.setText(gc_game_app_detail_name, gameEntity.getApp().getName());
+        //加载游戏标签
+        tagList.addAll(gameEntity.getApp().getTagList());
+        ListUtil.removeNull(tagList);
+        recyclerView.getAdapter().notifyDataSetChanged();
+        //下载按钮
+        CommonUtil.getInstance().palyGameDetailBtnValue(this, gameEntity, gc_game_app_detail_bt2, 0);
+        //初始化详情界面
+        fgtGcPlayGameDetail.loadData(gameEntity);
+    }
+
+    //通过网络获取游戏数据并尝试加载
+    private void initDetailFromNet() {
+        SheepApp.getInstance().getNetComponent().getApiService().playGameDetail(id)
+                .subscribeOn(Schedulers.io())
+                .observeOn(AndroidSchedulers.mainThread())
+                .subscribe(new SheepSubscriber<BaseMessage>(this) {
+                    @Override
+                    public void onNext(BaseMessage baseMessage) {
+                        boolean isNewData = DataUtil.getInstance().isNewData(ApiKey.playGameDetail(id));
+                        if (isNewData) {
+                            GameEntity gameEntity = baseMessage.getData(GameEntity.class);
+                            checkData(gameEntity);
+                        }
+                    }
+
+                    @Override
+                    public void onError(BaseMessage baseMessage) {
+                        G.showToast(baseMessage);
+                        resetView();
+                    }
+                });
+    }
+
+    private int initDataCount = 0;
+
+    private void initData() {
+        if (initDataCount != 0) {
+            Fragment item = mAdapter.getItem(viewPager.getCurrentItem());
+            if (item instanceof IRefresh) {//可刷新,就调用当前fragment刷新数据
+                ((IRefresh) item).refreshData();
+            }
+        }
+        initDataCount++;
+        notifyDataSetChanged();
+    }
+
+    private void notifyDataSetChanged() {
+        if (refresh != null) {
+            refresh.finishRefresh();
+        }
+    }
+
+    //点击返回
+    public void onClickBackImg(View view) {
+        finish();
+    }
+
+    //点击分享
+    public void onClickShareImg(View view) {
+        G.showToast(R.string.coming_soon);
+    }
+
+    //点击加,发表评论
+    public void onClickPlusDrag(View view) {
+        G.showToast(R.string.coming_soon);
+    }
+
+    //点击关注
+    public void onClickFollowTv(View view) {
+        G.showToast(R.string.coming_soon);
+    }
+
+    private AbsGetDownloadListener absGetDownloadListener = new AbsGetDownloadListener(true) {
+        @Override
+        public String getDownloadUrl(String packageName) {
+            return gameEntity != null ? gameEntity.getDownloadUrl(packageName) : null;
+        }
+
+        @Override
+        public TextView getTextView2(String packageName) {
+            return getDownloadUrl(packageName) != null ? gc_game_app_detail_bt2 : null;
+        }
+
+        @Override
+        public TextView getTextView(String downloadUrl) {
+            return gameEntity != null && TextUtils.equals(downloadUrl, gameEntity.downLinks()) ? gc_game_app_detail_bt2 : null;
+        }
+
+        @Override
+        public DownloadHelper getDownloadHelper(String downloadUrl) {
+            return gameEntity != null ? gameEntity.getDownloadHelper(downloadUrl) : null;
+        }
+    };
+
+    @Subscribe
+    public void onEventMainThread(Intent intent) {
+        absGetDownloadListener.onEventMainThread(intent);
+    }
+
+    @Subscribe
+    public void onEventMainThread(BigEvent event) {
+        switch (event.getEventTypes()) {
+            case REFRESH_XIAOMI_GAME_LIST:
+                initData();
+                break;
+        }
+        absGetDownloadListener.onEventMainThread(event);
+    }
+
+    @Override
+    protected void onDestroy() {
+        super.onDestroy();
+        EventBus.getDefault().unregister(this);
+    }
+}

+ 25 - 26
app/src/main/java/com/sheep/gamegroup/view/activity/ActPlayGameDetail.java

@@ -4,6 +4,7 @@ import android.app.Activity;
 import android.content.Intent;
 import android.support.design.widget.AppBarLayout;
 import android.support.design.widget.TabLayout;
+import android.support.v4.view.ViewPager;
 import android.support.v7.widget.AppCompatRatingBar;
 import android.text.TextUtils;
 import android.view.View;
@@ -13,13 +14,12 @@ import android.widget.LinearLayout;
 import android.widget.RelativeLayout;
 import android.widget.TextView;
 
-import com.kfzs.duanduan.view.ViewPagerAutoHeigh;
 import com.sheep.gamegroup.absBase.BaseActivity;
 import com.sheep.gamegroup.event.BigEvent;
 import com.sheep.gamegroup.greendao.download.DownLoadInfo;
 import com.sheep.gamegroup.model.entity.BaseMessage;
+import com.sheep.gamegroup.model.entity.GameApp;
 import com.sheep.gamegroup.model.entity.GameEntity;
-import com.sheep.gamegroup.model.entity.PlayGameEntity;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
 import com.sheep.gamegroup.util.CommonUtil;
 import com.sheep.gamegroup.util.DataUtil;
@@ -51,6 +51,7 @@ import static android.content.Intent.ACTION_PACKAGE_REMOVED;
 
 /**
  * Created by ljy on 2018/9/4.
+ * TODO 3.4不再用这个类,用ActGcPlayGameDetail
  */
 
 public class ActPlayGameDetail extends BaseActivity implements Action1<Integer> {
@@ -79,7 +80,7 @@ public class ActPlayGameDetail extends BaseActivity implements Action1<Integer>
     @BindView(R.id.find_game_down_tv)
     TextView find_game_down_tv;
     @BindView(R.id.viewpager_act_game_details)
-    ViewPagerAutoHeigh mViewPager;
+    ViewPager mViewPager;
     @BindView(R.id.tabLayout)
     TabLayout tabLayout;
     @BindView(R.id.welfare_gift_layout)
@@ -96,7 +97,7 @@ public class ActPlayGameDetail extends BaseActivity implements Action1<Integer>
     private boolean mIsExpanded = false;//是否是折叠状态
 
     private GameEntity gameEntity;
-    private PlayGameEntity playGameEntity;
+    private GameApp gameApp;
     private boolean isNeedReservation = false;
 
     private TitleFragmentListAdapter mAdapter;
@@ -234,26 +235,25 @@ public class ActPlayGameDetail extends BaseActivity implements Action1<Integer>
 
     private void loadData(GameEntity gameEntity) {
         this.gameEntity = gameEntity;
-        playGameEntity = gameEntity.getApp();
-        if (gameEntity == null || playGameEntity == null) {
+        if (gameEntity == null || (gameApp = gameEntity.getApp()) == null) {
             return;
         }
         //游戏简介与下载
-        GlideImageLoader.setGameImage(find_game_iv, gameEntity.getApp().getIcon() + "");
-        ViewUtil.setText(find_game_name_tv, gameEntity.getApp().getName());
-        isNeedReservation = !gameEntity.getApp().isCanDownload();//这里认为只有两种状态:可下载与预约下载
+        GlideImageLoader.setGameImage(find_game_iv, gameApp.getIcon() + "");
+        ViewUtil.setText(find_game_name_tv, gameApp.getName());
+        isNeedReservation = !gameApp.isCanDownload();//这里认为只有两种状态:可下载与预约下载
 //        if (isNeedReservation)
-//            ViewUtil.setText(find_game_info_tv, String.format(Locale.CHINA, "开放时间:%s", TimeUtil.TimeStamp2Date(gameEntity.getApp().getDownload_at(), "yyyy-MM-dd\u0020HH:mm")));
+//            ViewUtil.setText(find_game_info_tv, String.format(Locale.CHINA, "开放时间:%s", TimeUtil.TimeStamp2Date(gameApp.getDownload_at(), "yyyy-MM-dd\u0020HH:mm")));
 //        else {
 //            String format = "包体大小 (%sM)";
-//            ViewUtil.setText(find_game_info_tv, String.format(Locale.CHINA, format, gameEntity.getApp().getPackage_size()));
+//            ViewUtil.setText(find_game_info_tv, String.format(Locale.CHINA, format, gameApp.getPackage_size()));
 //        }
         String format = "包体大小 (%sM)";
-        ViewUtil.setText(find_game_info_tv, String.format(Locale.CHINA, format, gameEntity.getApp().getPackage_size()));
+        ViewUtil.setText(find_game_info_tv, String.format(Locale.CHINA, format, gameApp.getPackage_size()));
 
-        find_game_xin.setRating(gameEntity.getApp().getScore() / 2);
+        find_game_xin.setRating(gameApp.getScore() / 2);
 
-        updateView(this, gameEntity.getApp(), find_game_down_tv);
+        updateView(this, gameEntity, find_game_down_tv);
 
         mAdapter.clearData();
         mAdapter.add(FgtPlayGameDetail.newInstance(gameEntity), "详情");
@@ -288,8 +288,7 @@ public class ActPlayGameDetail extends BaseActivity implements Action1<Integer>
     }
 
     //更新按钮状态与添加点击事件
-    private void updateView(final Activity activity, PlayGameEntity playGameEntity, TextView textView) {
-
+    private void updateView(final Activity activity, GameEntity gameEntity, TextView textView) {
         CommonUtil.getInstance().palyGameDetailBtnValue(activity, gameEntity, textView, 0);
     }
 
@@ -413,7 +412,7 @@ public class ActPlayGameDetail extends BaseActivity implements Action1<Integer>
     public void onEventMainThread(Intent intent) {
         if (intent != null && intent.getAction() != null && intent.getDataString() != null && intent.getDataString().contains("package:")) {
             String packageName = intent.getDataString().replace("package:", "");
-            if (playGameEntity == null || !TextUtils.equals(packageName, playGameEntity.getPackage_names())) {
+            if (gameApp == null || !TextUtils.equals(packageName, gameApp.getPackage_names())) {
                 return;
             }
 
@@ -423,7 +422,7 @@ public class ActPlayGameDetail extends BaseActivity implements Action1<Integer>
                         find_game_down_tv.setText(CommonUtil.GAME_OPEN);
                         break;
                     case ACTION_PACKAGE_REMOVED:
-                        String path = PackageUtil.isExistsFile(packageName, playGameEntity.getDownload_url());
+                        String path = PackageUtil.isExistsFile(packageName, gameApp.getDownload_url());
                         if (TextUtils.isEmpty(path)) {
                             find_game_down_tv.setText(CommonUtil.START_DOWNLOAD);
                         } else {
@@ -433,24 +432,24 @@ public class ActPlayGameDetail extends BaseActivity implements Action1<Integer>
                 }
             }
 
-            if (TextUtils.equals(packageName, playGameEntity.getPackage_names())) {
+            if (TextUtils.equals(packageName, gameApp.getPackage_names())) {
                 switch (intent.getAction()) {
                     case ACTION_PACKAGE_ADDED:
-                        if (playGameEntity != null)
-                            playGameEntity.updateState(DownloadUtil.STATUS_INSTALLED);
+                        if (gameApp != null)
+                            gameApp.updateState(DownloadUtil.STATUS_INSTALLED);
                         if (gameEntity.getRelease_task() != null)
                             gameEntity.getRelease_task().getDownloadHelper().updateState(DownloadUtil.STATUS_INSTALLED);
                         break;
                     case ACTION_PACKAGE_REMOVED:
-                        String path = PackageUtil.isExistsFile(packageName, playGameEntity.getDownload_url());
+                        String path = PackageUtil.isExistsFile(packageName, gameApp.getDownload_url());
                         if (TextUtils.isEmpty(path)) {
-                            if (playGameEntity != null)
-                                playGameEntity.updateState(DownloadUtil.STATUS_INIT);
+                            if (gameApp != null)
+                                gameApp.updateState(DownloadUtil.STATUS_INIT);
                             if (gameEntity.getRelease_task() != null)
                                 gameEntity.getRelease_task().getDownloadHelper().updateState(DownloadUtil.STATUS_INIT);
                         } else {
-                            if (playGameEntity != null)
-                                playGameEntity.updateState(DownloadUtil.STATUS_FINISH);
+                            if (gameApp != null)
+                                gameApp.updateState(DownloadUtil.STATUS_FINISH);
                             if (gameEntity.getRelease_task() != null)
                                 gameEntity.getRelease_task().getDownloadHelper().updateState(DownloadUtil.STATUS_FINISH);
                         }

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

@@ -2,6 +2,7 @@ package com.sheep.gamegroup.view.activity;
 
 import android.support.v7.widget.RecyclerView;
 
+import com.sheep.gamegroup.absBase.BaseListActivity2;
 import com.sheep.gamegroup.model.api.ApiService;
 import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.GameEntity;

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

@@ -2,6 +2,7 @@ package com.sheep.gamegroup.view.activity;
 
 import android.support.v7.widget.RecyclerView;
 
+import com.sheep.gamegroup.absBase.BaseListActivity2;
 import com.sheep.gamegroup.model.api.ApiService;
 import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.GameEntity;

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

@@ -2,17 +2,15 @@ package com.sheep.gamegroup.view.activity;
 
 import android.support.v7.widget.RecyclerView;
 
+import com.sheep.gamegroup.absBase.BaseListActivity2;
 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;
 
 /**

+ 6 - 6
app/src/main/java/com/sheep/gamegroup/view/activity/ActReservation.java

@@ -13,7 +13,7 @@ import com.sheep.gamegroup.absBase.BaseActivity;
 import com.sheep.gamegroup.event.BigEvent;
 import com.sheep.gamegroup.greendao.download.DownLoadInfo;
 import com.sheep.gamegroup.model.entity.BaseMessage;
-import com.sheep.gamegroup.model.entity.FindApp;
+import com.sheep.gamegroup.model.entity.GameApp;
 import com.sheep.gamegroup.model.entity.FindAppReservation;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
 import com.sheep.gamegroup.util.CommonUtil;
@@ -123,7 +123,7 @@ public class ActReservation extends BaseActivity {
         final TextView find_information_game_bt2 = (TextView) itemView.findViewById(R.id.find_information_game_bt2);
 
         if (item != null && item.getApplication() != null) {
-            final FindApp findApp = item.getApplication();
+            final GameApp findApp = item.getApplication();
 
             ViewUtil.setImage(find_information_game_icon, findApp.getIcon());
             ViewUtil.setText(find_information_game_name, findApp.getName());
@@ -266,10 +266,10 @@ public class ActReservation extends BaseActivity {
         view_list.getAdapter().notifyDataSetChanged();
     }
 
-    private Map<String, FindApp> findAppMap = new HashMap<>();
+    private Map<String, GameApp> findAppMap = new HashMap<>();
 
     //获取任务对应的findApp
-    private FindApp getFindAppByKey(String key) {
+    private GameApp getFindAppByKey(String key) {
         if (findAppMap.containsKey(key))
             return findAppMap.get(key);
         return null;
@@ -344,7 +344,7 @@ public class ActReservation extends BaseActivity {
         if (textView != null) {
             textView.setText(CommonUtil.START_INSTALL);
         }
-        FindApp findApp = getFindAppByKey(task.getMDownloadUrl());
+        GameApp findApp = getFindAppByKey(task.getMDownloadUrl());
         if (findApp != null) {
             findApp.updateState(DownloadUtil.STATUS_FINISH);
         }
@@ -379,7 +379,7 @@ public class ActReservation extends BaseActivity {
         if (intent != null && intent.getAction() != null && intent.getDataString() != null && intent.getDataString().contains("package:")) {
             String packageName = intent.getDataString().replace("package:", "");
 
-            FindApp findApp = getFindAppByKey(packageName);
+            GameApp findApp = getFindAppByKey(packageName);
             TextView textView = getTextViewByKey(packageName);
             if (findApp != null) {
                 switch (intent.getAction()) {

+ 14 - 9
app/src/main/java/com/sheep/gamegroup/view/activity/TaskDetailAct.java

@@ -47,6 +47,7 @@ import com.sheep.gamegroup.usage.AppUsageManager;
 import com.sheep.gamegroup.util.CommonUtil;
 import com.sheep.gamegroup.util.DataUtil;
 import com.sheep.gamegroup.util.DeviceUtil;
+import com.sheep.gamegroup.util.DownloadTextUtl;
 import com.sheep.gamegroup.util.DownloadUtil;
 import com.sheep.gamegroup.util.GlideImageLoader;
 import com.sheep.gamegroup.util.Jump2View;
@@ -764,6 +765,10 @@ public class TaskDetailAct extends AbsChooseImageActivity implements TaskDetailC
     }
 
     public static void setBtnStr(IDownload taskEty, DownloadUtil mDownloadTaskService, Action1<Object> action1) {
+        setBtnStr(taskEty, mDownloadTaskService, action1, false);
+    }
+
+    public static void setBtnStr(IDownload taskEty, DownloadUtil mDownloadTaskService, Action1<Object> action1, boolean showSimpleText) {
         boolean isInstalled = PackageUtil.isAppInstalled(SheepApp.getInstance(), taskEty.getPackage_names());
         boolean isExistApk = !TextUtils.isEmpty(PackageUtil.isExistsFile(taskEty.getPackage_names(), taskEty.getDownload_link()));
         String buttonStr;
@@ -772,15 +777,15 @@ public class TaskDetailAct extends AbsChooseImageActivity implements TaskDetailC
             action1.call(DownloadUtil.STATUS_INSTALLED);
             switch (taskEty.getTask_type()) {// 1时间试玩任务 3应用下载 1000连续任务, 1002 1003游戏任务 1002平台游戏,1003 腾讯游戏,1004 小米游戏
                 case TASK_TYPE_APP:
-                    buttonStr = CommonUtil.OPEN_APPLY;
+                    buttonStr = DownloadTextUtl.getOpenApplyText(showSimpleText);
                     break;
                 default:
-                    buttonStr = CommonUtil.GAME_OPEN;
+                    buttonStr = DownloadTextUtl.getStartOpenText(showSimpleText);
                     break;
             }
         } else {
             if (taskEty.getDownload_link() == null || !taskEty.getDownload_link().startsWith("http")) {
-                buttonStr = SheepApp.getInstance().getResources().getString(R.string.error_download_link);
+                buttonStr = DownloadTextUtl.getNoDownloadText(showSimpleText);
                 action1.call(false);
                 action1.call(DownloadUtil.STATUS_INIT);
             } else {
@@ -790,28 +795,28 @@ public class TaskDetailAct extends AbsChooseImageActivity implements TaskDetailC
                 switch (taskState) {
                     case DownloadUtil.STATUS_ING:
                         action1.call(DownloadUtil.STATUS_INIT);
-                        buttonStr = Math.abs(downLoadInfo.getMPercent()) + "%";
+                        buttonStr = DownloadTextUtl.getProgressText(showSimpleText, downLoadInfo);
                         break;
                     case DownloadUtil.STATUS_PAUSE:
                         action1.call(DownloadUtil.STATUS_INIT);
-                        buttonStr = CommonUtil.CONTINUE_DOWNLOAD;
+                        buttonStr = DownloadTextUtl.getContinueDownloadText(showSimpleText);
                         break;
                     case DownloadUtil.STATUS_FINISH:
                         if (isExistApk) {
                             action1.call(DownloadUtil.STATUS_FINISH);
-                            buttonStr = CommonUtil.START_INSTALL;
+                            buttonStr = DownloadTextUtl.getStartInstallText(showSimpleText);
                         } else {
                             action1.call(DownloadUtil.STATUS_INIT);
-                            buttonStr = CommonUtil.START_DOWNLOAD;
+                            buttonStr = DownloadTextUtl.getStartDownloadText(showSimpleText);
                         }
                         break;
                     case DownloadUtil.STATUS_FAIL:
                         action1.call(DownloadUtil.STATUS_INIT);
-                        buttonStr = CommonUtil.FAIL_DOWNLOAD;
+                        buttonStr = DownloadTextUtl.getFailDownloadText(showSimpleText);
                         break;
                     default:
                         action1.call(DownloadUtil.STATUS_INIT);
-                        buttonStr = CommonUtil.START_DOWNLOAD;
+                        buttonStr = DownloadTextUtl.getStartDownloadText(showSimpleText);
                         break;
                 }
             }

+ 7 - 8
app/src/main/java/com/sheep/gamegroup/view/adapter/AdpGameCenter1_2List.java

@@ -10,9 +10,8 @@ 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.GameListType;
+import com.sheep.gamegroup.model.entity.ListTypeList;
 import com.sheep.gamegroup.model.entity.GameRecommend;
 import com.sheep.gamegroup.util.Jump2View;
 import com.sheep.gamegroup.util.ViewUtil;
@@ -27,21 +26,21 @@ import java.util.List;
  * realicing@sina.com
  * 游戏主页上每一屏显示有1.2个元素
  */
-public class AdpGameCenter1_2List extends RecyclerViewAdapter<GameListTypeList<GameRecommend>> {
-    public AdpGameCenter1_2List(Context context, List<GameListTypeList<GameRecommend>> gameListTypeLists) {
+public class AdpGameCenter1_2List extends RecyclerViewAdapter<ListTypeList<GameRecommend, GameListType>> {
+    public AdpGameCenter1_2List(Context context, List<ListTypeList<GameRecommend, GameListType>> gameListTypeLists) {
         super(context, R.layout.item_play_game_list, gameListTypeLists);
     }
 
     @Override
-    public void convert(ViewHolder viewHolder, final GameListTypeList<GameRecommend> gameListTypeList, int position) {
+    public void convert(ViewHolder viewHolder, final ListTypeList<GameRecommend, GameListType> 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());
+        ViewUtil.setText(item_play_game_list_tv, gameListTypeList.getType().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());
+                    Jump2View.getInstance().goActPlayGameList((Activity) mContext, gameListTypeList.getType());
             }
         });
         RecyclerView recyclerView = viewHolder.itemView.findViewById(R.id.item_play_game_list_rv);

+ 14 - 13
app/src/main/java/com/sheep/gamegroup/view/adapter/AdpGameCenter3_3List.java

@@ -11,7 +11,8 @@ 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.GameListType;
+import com.sheep.gamegroup.model.entity.ListTypeList;
 import com.sheep.gamegroup.util.GlideImageLoader;
 import com.sheep.gamegroup.util.Jump2View;
 import com.sheep.gamegroup.util.ViewUtil;
@@ -28,9 +29,9 @@ import static com.sheep.gamegroup.view.adapter.PlayGameListAdapter.setOnClickGam
  * 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 class AdpGameCenter3_3List extends RecyclerViewAdapter<ListTypeList<GameEntity, GameListType>> {
+    public AdpGameCenter3_3List(Context context, List<ListTypeList<GameEntity, GameListType>> itemList) {
+        super(context, R.layout.item_play_game_list, itemList);
     }
 
     public AdpGameCenter3_3List setShowFirstTop(boolean showFirstTop) {
@@ -41,18 +42,18 @@ public class AdpGameCenter3_3List extends RecyclerViewAdapter<GameEntityList> {
     private boolean isShowFirstTop = true;
 
     @Override
-    public void convert(ViewHolder viewHolder, final GameEntityList gameEntityList, int position) {
+    public void convert(ViewHolder viewHolder, final ListTypeList<GameEntity, GameListType> itemList, 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)//不显示第一项的线
+        if (!isShowFirstTop)//不显示第一项的线
             ViewUtil.setVisibility(item_play_game_list_top, position != 0);
-        ViewUtil.setText(item_play_game_list_tv, gameEntityList.getGameListType().getTitle());
+        ViewUtil.setText(item_play_game_list_tv, itemList.getType().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());
+                if (mContext instanceof Activity)
+                    Jump2View.getInstance().goActPlayGameList((Activity) mContext, itemList.getType());
             }
         });
         RecyclerView recyclerView = viewHolder.itemView.findViewById(R.id.item_play_game_list_rv);
@@ -60,7 +61,7 @@ public class AdpGameCenter3_3List extends RecyclerViewAdapter<GameEntityList> {
         recyclerView.setHasFixedSize(true);
         recyclerView.setNestedScrollingEnabled(false);
         recyclerView.setLayoutManager(playHotManager);
-        recyclerView.setAdapter(new AdbCommonRecycler<GameEntity>(SheepApp.getInstance(), gameEntityList.getList()) {
+        recyclerView.setAdapter(new AdbCommonRecycler<GameEntity>(SheepApp.getInstance(), itemList.getList()) {
             @Override
             public int getViewIdByType(int type) {
                 return R.layout.item_hot_welfare;
@@ -68,15 +69,15 @@ public class AdpGameCenter3_3List extends RecyclerViewAdapter<GameEntityList> {
 
             @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);
+                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){
+                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)
+                    if (mContext instanceof Activity)
                         setOnClickGameEntity((Activity) mContext, holder.itemView, item);
                 }
             }

+ 42 - 0
app/src/main/java/com/sheep/gamegroup/view/adapter/AdpGcGameAppInfoList.java

@@ -0,0 +1,42 @@
+package com.sheep.gamegroup.view.adapter;
+
+import android.content.Context;
+import android.support.v7.widget.RecyclerView;
+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.GameInfoList;
+import com.sheep.gamegroup.util.ViewUtil;
+import com.sheep.jiuyan.samllsheep.R;
+
+import java.util.List;
+
+
+
+/**
+ * Created by realicing on 2018/11/1.
+ * realicing@sina.com
+ * 游戏详情中详情列表:游戏介绍、详情信息、用户评价、相关游戏、热门试玩
+ */
+public class AdpGcGameAppInfoList extends RecyclerViewAdapter<GameInfoList> {
+    public AdpGcGameAppInfoList(Context context, List<GameInfoList> datas) {
+        super(context, R.layout.item_gc_game_app_detail_list, datas);
+    }
+
+    @Override
+    public void convert(ViewHolder viewHolder, final GameInfoList itemList, int position) {
+//        View item_gc_game_app_list_top = viewHolder.itemView.findViewById(R.id.item_gc_game_app_list_top);
+        TextView item_gc_game_app_list_tv = viewHolder.itemView.findViewById(R.id.item_gc_game_app_list_tv);
+        TextView item_gc_game_app_list_more_tv = viewHolder.itemView.findViewById(R.id.item_gc_game_app_list_more_tv);
+        RecyclerView recyclerView = viewHolder.itemView.findViewById(R.id.item_gc_game_app_list_rv);
+
+        ViewUtil.setText(item_gc_game_app_list_tv, itemList.getName());
+        itemList.setMoreViewOnClickListener(item_gc_game_app_list_more_tv);
+
+        recyclerView.setHasFixedSize(true);
+        recyclerView.setNestedScrollingEnabled(false);
+        recyclerView.setLayoutManager(itemList.getLayoutManager());
+        recyclerView.setAdapter(itemList.getAdapter());
+    }
+}

+ 2 - 2
app/src/main/java/com/sheep/gamegroup/view/adapter/GiftCenterAdapter.java

@@ -10,7 +10,7 @@ import android.widget.TextView;
 
 import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.DialogConfig;
-import com.sheep.gamegroup.model.entity.FindApp;
+import com.sheep.gamegroup.model.entity.GameApp;
 import com.sheep.gamegroup.model.entity.GiftBag;
 import com.sheep.gamegroup.model.entity.GiftBagApp;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
@@ -82,7 +82,7 @@ public class GiftCenterAdapter extends AdbCommonRecycler<GiftBagApp> {
             item_download_welfare_iv2.setVisibility(View.GONE);
             item_download_welfare_tip_iv.setVisibility(View.GONE);
         } else if(context instanceof Activity){
-            final FindApp itemApp = item.getApp();
+            final GameApp itemApp = item.getApp();
             final GiftBag itemGiftBag = item.getGift_bag();
             if(itemApp == null || itemGiftBag == null){
                 return;

+ 5 - 4
app/src/main/java/com/sheep/gamegroup/view/adapter/PlayGameListAdapter.java

@@ -10,7 +10,8 @@ import android.widget.LinearLayout;
 import android.widget.TextView;
 
 import com.sheep.gamegroup.model.entity.GameEntity;
-import com.sheep.gamegroup.model.entity.GameEntityList;
+import com.sheep.gamegroup.model.entity.GameListType;
+import com.sheep.gamegroup.model.entity.ListTypeList;
 import com.sheep.gamegroup.util.CommonUtil;
 import com.sheep.gamegroup.util.GlideImageLoader;
 import com.sheep.gamegroup.util.Jump2View;
@@ -25,8 +26,8 @@ import java.util.List;
  * Created by ljy on 2018/9/3.
  */
 
-public class PlayGameListAdapter extends AdbCommonRecycler<GameEntityList>{
-    public PlayGameListAdapter(Context context, List<GameEntityList> list) {
+public class PlayGameListAdapter extends AdbCommonRecycler<ListTypeList<GameEntity, GameListType>>{
+    public PlayGameListAdapter(Context context, List<ListTypeList<GameEntity, GameListType>> list) {
         super(context, list);
     }
 
@@ -36,7 +37,7 @@ public class PlayGameListAdapter extends AdbCommonRecycler<GameEntityList>{
     }
 
     @Override
-    public void convert(ViewHolder holderParent, final GameEntityList item) {
+    public void convert(ViewHolder holderParent, final ListTypeList<GameEntity, GameListType> item) {
         RecyclerView recyclerView = holderParent.getView(R.id.release_task_listview, RecyclerView.class);
         recyclerView.setHasFixedSize(true);
         recyclerView.setLayoutManager(new LinearLayoutManager(context));

+ 4 - 7
app/src/main/java/com/sheep/gamegroup/view/fragment/BaseListFragment.java

@@ -6,9 +6,9 @@ import android.support.v7.widget.RecyclerView;
 import android.view.View;
 
 import com.jcodecraeer.xrecyclerview.XRecyclerView;
-import com.sheep.gamegroup.model.api.ApiService;
+import com.sheep.gamegroup.absBase.ILoadMore;
+import com.sheep.gamegroup.absBase.IRefresh;
 import com.sheep.gamegroup.model.entity.BaseMessage;
-import com.sheep.gamegroup.model.util.SheepSubscriber;
 import com.sheep.gamegroup.util.CommonUtil;
 import com.sheep.gamegroup.util.DataUtil;
 import com.sheep.gamegroup.util.ListUtil;
@@ -21,17 +21,14 @@ import com.sheep.jiuyan.samllsheep.base.BaseFragment;
 import java.util.List;
 
 import butterknife.BindView;
-import rx.Observable;
-import rx.android.schedulers.AndroidSchedulers;
 import rx.functions.Action1;
-import rx.schedulers.Schedulers;
 
 /**
  * Created by realicing on 2018/9/3.
  * realicing@sina.com
  * 自己可以进行刷新与加载更多,使用com.jcodecraeer.xrecyclerview.XRecyclerView来实现,子类自己实现数据
  */
-public abstract class BaseListFragment<T> extends BaseFragment {
+public abstract class BaseListFragment<T> extends BaseFragment implements IRefresh, ILoadMore {
     @Override
     public int getLayoutId() {
         return R.layout.net_empty_xrecycler;
@@ -97,7 +94,7 @@ public abstract class BaseListFragment<T> extends BaseFragment {
         view_list.setAdapter(getAdapter());
     }
 
-    protected void loadMoreData() {
+    public void loadMoreData() {
         if (!loadMore) {
             loadMore = true;
             if (ListUtil.size(list) >= per_page * page) {

+ 4 - 2
app/src/main/java/com/sheep/gamegroup/view/fragment/BaseListFragment2.java

@@ -7,6 +7,8 @@ import android.view.View;
 
 import com.jcodecraeer.xrecyclerview.XRecyclerView;
 import com.sheep.gamegroup.model.api.ApiService;
+import com.sheep.gamegroup.absBase.ILoadMore;
+import com.sheep.gamegroup.absBase.IRefresh;
 import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
 import com.sheep.gamegroup.util.CommonUtil;
@@ -31,7 +33,7 @@ import rx.schedulers.Schedulers;
  * realicing@sina.com
  * 自己可以进行刷新与加载更多,使用com.jcodecraeer.xrecyclerview.XRecyclerView来实现,子类提供网络接口相关
  */
-public abstract class BaseListFragment2<T> extends BaseFragment {
+public abstract class BaseListFragment2<T> extends BaseFragment implements IRefresh, ILoadMore {
     @Override
     public int getLayoutId() {
         return R.layout.net_empty_xrecycler;
@@ -98,7 +100,7 @@ public abstract class BaseListFragment2<T> extends BaseFragment {
         view_list.setAdapter(getAdapter());
     }
 
-    protected void loadMoreData() {
+    public void loadMoreData() {
         if (!loadMore) {
             loadMore = true;
             if (ListUtil.size(list) >= per_page * page) {

+ 4 - 2
app/src/main/java/com/sheep/gamegroup/view/fragment/BaseListFragment3.java

@@ -9,6 +9,8 @@ import android.view.ViewGroup;
 
 import com.scwang.smartrefresh.layout.SmartRefreshLayout;
 import com.sheep.gamegroup.model.api.ApiService;
+import com.sheep.gamegroup.absBase.ILoadMore;
+import com.sheep.gamegroup.absBase.IRefresh;
 import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
 import com.sheep.gamegroup.util.CommonUtil;
@@ -32,7 +34,7 @@ import rx.schedulers.Schedulers;
  * realicing@sina.com
  * 使用普通的RecyclerView来显示列表,可配合SmartRefreshLayout和ViewPager使用(setSmartRefreshLayout和setViewPager)
  */
-public abstract class BaseListFragment3<T> extends BaseFragment {
+public abstract class BaseListFragment3<T> extends BaseFragment implements IRefresh, ILoadMore {
     @Override
     public int getLayoutId() {
         return R.layout.net_empty_rv;
@@ -77,7 +79,7 @@ public abstract class BaseListFragment3<T> extends BaseFragment {
         view_list.setAdapter(getAdapter());
     }
     //加载更多数据
-    protected void loadMoreData() {
+    public void loadMoreData() {
         if(ListUtil.size(list) >= per_page*page){
             page += 1;
             initData();

+ 8 - 9
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtAskGetMoney.java

@@ -2,16 +2,15 @@ package com.sheep.gamegroup.view.fragment;
 
 import android.app.Activity;
 import android.support.design.widget.TabLayout;
+import android.support.v4.view.ViewPager;
 import android.support.v4.widget.NestedScrollView;
 import android.support.v4.widget.SwipeRefreshLayout;
-import android.text.TextUtils;
 import android.view.View;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
 import android.widget.RelativeLayout;
 import android.widget.TextView;
 
-import com.kfzs.duanduan.view.ViewPagerAutoHeigh;
 import com.sheep.gamegroup.event.BigEvent;
 import com.sheep.gamegroup.event.EventTypes;
 import com.sheep.gamegroup.model.entity.BaseMessage;
@@ -67,7 +66,7 @@ public class FgtAskGetMoney extends BaseFragment {
     @BindView(R.id.indicator)
     TabLayout indicator;
     @BindView(R.id.pager)
-    ViewPagerAutoHeigh pager;
+    ViewPager pager;
     @BindView(R.id.my_invitation_tv)
     TextView my_invitation_tv;
     @BindView(R.id.ask_act_code)
@@ -164,7 +163,7 @@ public class FgtAskGetMoney extends BaseFragment {
     private UserEntity userEntity;
 
     public void initData(final boolean isNotRefresh) {
-        if (!isNotRefresh){
+        if (!isNotRefresh) {
             EventBus.getDefault().post(BigEvent.get().setEventTypes(EventTypes.ASK_GETMONEY_FRIEND_REFRESH));
         }
         SheepApp.getInstance().getNetComponent().getApiService().FriendCountAndAward()
@@ -181,12 +180,12 @@ public class FgtAskGetMoney extends BaseFragment {
                     public void onNext(BaseMessage baseMessage) {
                         if (baseMessage != null) {
                             boolean isNewData = DataUtil.getInstance().isNewData(ApiKey.FRIEND_COUNT_AND_AWARD);
-                            if(mEntity == null || isNewData){
+                            if (mEntity == null || isNewData) {
                                 mEntity = baseMessage.getData(FriendAndAwardEntity.class);
                                 activity.runOnUiThread(new Runnable() {
                                     @Override
                                     public void run() {
-                                        if(mEntity != null) {
+                                        if (mEntity != null) {
                                             ViewUtil.setText(tvSize, String.valueOf(mEntity.getFriend_count()));
                                             ViewUtil.setText(tvMoney, String.valueOf(mEntity.getAward()));
                                         }
@@ -202,7 +201,7 @@ public class FgtAskGetMoney extends BaseFragment {
             public void call(UserEntity result) {
                 if (result != null) {
                     boolean isNewData = DataUtil.getInstance().isNewData(ApiKey.get_info);
-                    if(userEntity == null || isNewData) {
+                    if (userEntity == null || isNewData) {
                         userEntity = result;
                         String audit_total_audit = String.format(activity.getResources().getString(R.string.my_invitation_str), userEntity.getInvitation_code());
                         ask_act_code.setText(audit_total_audit);
@@ -233,7 +232,7 @@ public class FgtAskGetMoney extends BaseFragment {
         switch (view.getId()) {
             case R.id.copy_my_invitation_tv:
             case R.id.ask_act_code_copy:
-                if(userEntity == null) {
+                if (userEntity == null) {
                     G.showToast(R.string.loading_data);
                     return;
                 }
@@ -243,7 +242,7 @@ public class FgtAskGetMoney extends BaseFragment {
                 break;
             case R.id.ask_act_rule:
                 ViewUtil.showMsgDialog(activity, new DialogConfig().setTitle("活动规则").setBtnLeftText("我知道了").setTheme(DialogConfig.THEME_PURPLE)
-                    .setMsg("首邀好友,好友下载并登录小绵羊,既可获得2.5绵羊币\n首邀好友完成新手任务,邀请人可额外再获得2.5绵羊币"));
+                        .setMsg("首邀好友,好友下载并登录小绵羊,既可获得2.5绵羊币\n首邀好友完成新手任务,邀请人可额外再获得2.5绵羊币"));
                 break;
             case R.id.refresh://只是一个点击,用来遮盖底部不可见的view的点击
                 break;

+ 1 - 6
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtAskGetMoneyFriend.java

@@ -1,6 +1,5 @@
 package com.sheep.gamegroup.view.fragment;
 
-import android.app.Activity;
 import android.support.v4.view.ViewPager;
 import android.util.SparseArray;
 import android.view.View;
@@ -31,12 +30,10 @@ public class FgtAskGetMoneyFriend extends BaseFragment {
     TextView friend_extract_page_tv;
     @BindView(R.id.friend_extract_next_page_tv)
     TextView friend_extract_next_page_tv;
-    private Activity activity;
 
 
     public static FgtAskGetMoneyFriend newInstance(){
-        FgtAskGetMoneyFriend fgt = new FgtAskGetMoneyFriend();
-        return fgt;
+        return new FgtAskGetMoneyFriend();
     }
     @Override
     public int getLayoutId() {
@@ -45,8 +42,6 @@ public class FgtAskGetMoneyFriend extends BaseFragment {
 
     @Override
     public void onViewCreated() {
-        activity = getActivity();
-
         initView();
     }
 

+ 0 - 3
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtAskGetMoneyRank.java

@@ -212,9 +212,6 @@ public class FgtAskGetMoneyRank extends BaseFragment {
             return;
         }
         CommonUtil.getInstance().updateEmptyView(emptyView, list.size() == 1, true);
-        while (list.size() < 6) {
-            list.add(null);
-        }
         adapter.notifyDataSetChanged();
     }
 

+ 7 - 7
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtFindChild.java

@@ -18,7 +18,7 @@ import com.sheep.gamegroup.event.BigEvent;
 import com.sheep.gamegroup.greendao.download.DownLoadInfo;
 import com.sheep.gamegroup.model.api.ApiService;
 import com.sheep.gamegroup.model.entity.BaseMessage;
-import com.sheep.gamegroup.model.entity.FindApp;
+import com.sheep.gamegroup.model.entity.GameApp;
 import com.sheep.gamegroup.model.entity.FindItem;
 import com.sheep.gamegroup.model.entity.FindTag;
 import com.sheep.gamegroup.util.CommonUtil;
@@ -85,7 +85,7 @@ public class FgtFindChild extends BaseListFragment2<FindItem> {
 
                 if (item.isGame()) {
                     find_item_download.setVisibility(View.VISIBLE);
-                    FindApp findApp = item.getApplication();
+                    GameApp findApp = item.getApplication();
 //                    find_item_pf_label.setVisibility(View.VISIBLE);
 //                    find_item_pf_label.setText(Html.fromHtml(String.format(Locale.CHINA, "评分:<font color='%s'>%.1f</font>分", "#29d6fd", findApp.getScore())));
                     updateView(activity, findApp, find_item_download);
@@ -168,10 +168,10 @@ public class FgtFindChild extends BaseListFragment2<FindItem> {
     }
 
 
-    private Map<String, FindApp> findAppMap = new HashMap<>();
+    private Map<String, GameApp> findAppMap = new HashMap<>();
 
     //获取任务对应的findApp
-    private FindApp getFindAppByKey(String key) {
+    private GameApp getFindAppByKey(String key) {
         if (findAppMap.containsKey(key))
             return findAppMap.get(key);
         return null;
@@ -191,7 +191,7 @@ public class FgtFindChild extends BaseListFragment2<FindItem> {
     }
 
     //更新按钮状态与添加点击事件
-    private void updateView(Activity activity, FindApp findApp, TextView textView) {
+    private void updateView(Activity activity, GameApp findApp, TextView textView) {
         if (findApp.isCanDownload()) {//可下载
             downLoadTextViewMap.put(findApp.getDownload_link(), textView);
             downLoadTextViewMap.put(findApp.getPackage_name(), textView);
@@ -259,7 +259,7 @@ public class FgtFindChild extends BaseListFragment2<FindItem> {
         if (textView != null) {
             textView.setText(CommonUtil.START_INSTALL);
         }
-        FindApp findApp = getFindAppByKey(task.getMDownloadUrl());
+        GameApp findApp = getFindAppByKey(task.getMDownloadUrl());
         if (findApp != null) {
             findApp.updateState(DownloadUtil.STATUS_FINISH);
         }
@@ -315,7 +315,7 @@ public class FgtFindChild extends BaseListFragment2<FindItem> {
         if (intent != null && intent.getAction() != null && intent.getDataString() != null && intent.getDataString().contains("package:")) {
             String packageName = intent.getDataString().replace("package:", "");
 
-            FindApp findApp = getFindAppByKey(packageName);
+            GameApp findApp = getFindAppByKey(packageName);
             TextView textView = getTextViewByKey(packageName);
             if (findApp != null) {
                 switch (intent.getAction()) {

+ 3 - 3
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtFriendExtractPage.java

@@ -72,12 +72,12 @@ public class FgtFriendExtractPage extends BaseFragment {
                 TextView friend_item_name = (TextView) view.getChildAt(j++);
                 friend_item_name.setText(TimeUtil.TimeStamp2Date(friend.getCreate_time(), "yyyy/MM/dd HH:mm"));
                 TextView friend_item_extract = (TextView) view.getChildAt(j++);
-                friend_item_extract.setText(friend.getSource_page()+"");
+                ViewUtil.setText(friend_item_extract, friend.getSource_page());
                 TextView friend_item_time = (TextView) view.getChildAt(j);
                 ViewUtil.setText(friend_item_time, friend.getAward_amount());
             } else {
-                line.setVisibility(View.INVISIBLE);
-                view.setVisibility(View.INVISIBLE);
+                line.setVisibility(View.GONE);
+                view.setVisibility(View.GONE);
             }
             i += 2;
         }

+ 209 - 0
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtGcGameAppDetail.java

@@ -0,0 +1,209 @@
+package com.sheep.gamegroup.view.fragment;
+
+import android.app.Activity;
+import android.support.v7.widget.LinearLayoutManager;
+import android.support.v7.widget.RecyclerView;
+import android.text.TextUtils;
+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.helper.ImageListHelper;
+import com.sheep.gamegroup.model.entity.BaseMessage;
+import com.sheep.gamegroup.model.entity.Entry;
+import com.sheep.gamegroup.model.entity.GameApp;
+import com.sheep.gamegroup.model.entity.GameEntity;
+import com.sheep.gamegroup.model.entity.GameInfoList;
+import com.sheep.gamegroup.model.util.SheepSubscriber;
+import com.sheep.gamegroup.util.GlideImageLoader;
+import com.sheep.gamegroup.util.ListUtil;
+import com.sheep.gamegroup.util.TextViewUtil;
+import com.sheep.gamegroup.util.TimeUtil;
+import com.sheep.gamegroup.util.ViewUtil;
+import com.sheep.gamegroup.view.adapter.AdpGcGameAppInfoList;
+import com.sheep.jiuyan.samllsheep.R;
+import com.sheep.jiuyan.samllsheep.SheepApp;
+import com.sheep.jiuyan.samllsheep.base.BaseFragment;
+import com.sheep.jiuyan.samllsheep.utils.G;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import butterknife.BindView;
+import rx.Observable;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.functions.Action1;
+
+/**
+ * Created by realicing on 2018/11/1.
+ * realicing@sina.com
+ * 玩转游戏 详情
+ */
+public class FgtGcGameAppDetail extends BaseFragment {
+    @BindView(R.id.gc_game_app_detail_pic_list)
+    RecyclerView gc_game_app_detail_pic_list;
+    @BindView(R.id.gc_game_app_detail_info_list)
+    RecyclerView gc_game_app_detail_info_list;
+
+    private Activity activity;
+
+    public static FgtGcGameAppDetail newInstance() {
+        return new FgtGcGameAppDetail();
+    }
+
+    @Override
+    public int getLayoutId() {
+        return R.layout.fgt_gc_game_app_detail;
+    }
+
+
+    private ArrayList<String> pictureList = ListUtil.emptyList();
+    private ArrayList<GameInfoList> gameInfoListArrayList = ListUtil.emptyList();
+
+    @Override
+    public void onViewCreated() {
+        activity = getActivity();
+        ImageListHelper.initList(activity, gc_game_app_detail_pic_list, pictureList);
+        gc_game_app_detail_info_list.setHasFixedSize(true);
+        gc_game_app_detail_info_list.setNestedScrollingEnabled(false);
+        gc_game_app_detail_info_list.setLayoutManager(new LinearLayoutManager(SheepApp.getInstance()));
+        gc_game_app_detail_info_list.setAdapter(new AdpGcGameAppInfoList(activity, gameInfoListArrayList));
+    }
+
+    //ActGcGameAppDetail调用该方法传入对应的游戏数据
+    public void loadData(GameEntity gameEntity) {
+        GameApp gameApp;
+        if (gameEntity == null || (gameApp = gameEntity.getApp()) == null)
+            return;
+        //游戏图片banner
+        String pictures = gameApp.getPictures();
+        if (!TextUtils.isEmpty(pictures)) {
+            pictureList.clear();
+            ListUtil.addAll(pictureList, pictures.split(";"));
+            ListUtil.removeNull(pictureList);
+            gc_game_app_detail_pic_list.setVisibility(View.VISIBLE);
+            gc_game_app_detail_pic_list.getAdapter().notifyDataSetChanged();
+        } else {
+            gc_game_app_detail_pic_list.setVisibility(View.GONE);
+        }
+        String intro = gameApp.getIntro();
+        if (!TextUtils.isEmpty(intro)) {
+            gameInfoListArrayList.add(new GameInfoList("游戏介绍", new RecyclerViewAdapter<String>(SheepApp.getInstance(), R.layout.item_gc_game_app_intro, ListUtil.asList(intro)) {
+                @Override
+                public void convert(ViewHolder viewHolder, String text, int position) {
+                    final TextView item_gc_game_app_intro_tv = viewHolder.itemView.findViewById(R.id.item_gc_game_app_intro_tv);
+                    final TextView item_gc_game_app_intro_show_all = viewHolder.itemView.findViewById(R.id.item_gc_game_app_intro_show_all);
+                    final View item_gc_game_app_intro_show_all_no = viewHolder.itemView.findViewById(R.id.item_gc_game_app_intro_show_all_no);
+                    TextViewUtil.listenEllipsizeChange(item_gc_game_app_intro_tv, new Action1<Integer>() {
+                        @Override
+                        public void call(Integer integer) {
+                            if (integer > 0) {
+                                ViewUtil.setVisibility(item_gc_game_app_intro_show_all, true);
+                                ViewUtil.setVisibility(item_gc_game_app_intro_show_all_no, false);
+                            }
+                        }
+                    });
+                    item_gc_game_app_intro_show_all.setOnClickListener(new View.OnClickListener() {
+                        @Override
+                        public void onClick(View view) {
+                            boolean canShowAll = item_gc_game_app_intro_tv.getMaxLines() == 3;
+                            item_gc_game_app_intro_tv.setMaxLines(canShowAll ? Integer.MAX_VALUE : 3);
+                            item_gc_game_app_intro_tv.setEllipsize(canShowAll ? null : TextUtils.TruncateAt.END);
+                            item_gc_game_app_intro_show_all.setText(canShowAll ? "显示全部" : "收起");
+                        }
+                    });
+                    ViewUtil.setText(item_gc_game_app_intro_tv, text);
+                }
+            }));
+        }
+        final List<Entry<String, String>> entryList = ListUtil.emptyList();
+        entryList.add(new Entry<>("当前版本", gameApp.getVersions()));
+        entryList.add(new Entry<>("大小", gameApp.getPackage_size()));
+        entryList.add(new Entry<>("更新日期", TimeUtil.TimeStamp2Date(gameApp.getDownload_at(), "yyyy-MM-dd")));
+        entryList.add(new Entry<>("发行商", gameApp.getManufacturer()));
+        entryList.add(new Entry<>("开发商", gameApp.getManufacturer()));
+        gameInfoListArrayList.add(new GameInfoList("详细信息", new RecyclerViewAdapter<Entry<String, String>>(SheepApp.getInstance(), R.layout.item_gc_game_info, entryList) {
+            @Override
+            public void convert(ViewHolder viewHolder, Entry<String, String> item, int position) {
+                View item_gc_game_info_top = viewHolder.itemView.findViewById(R.id.item_gc_game_info_top);
+                TextView item_gc_game_info_key = viewHolder.itemView.findViewById(R.id.item_gc_game_info_key);
+                TextView item_gc_game_info_value = viewHolder.itemView.findViewById(R.id.item_gc_game_info_value);
+                View item_gc_game_info_bottom = viewHolder.itemView.findViewById(R.id.item_gc_game_info_bottom);
+                ViewUtil.setVisibility(item_gc_game_info_top, position == 0);
+                ViewUtil.setVisibility(item_gc_game_info_bottom, position + 1 == entryList.size());
+                ViewUtil.setText(item_gc_game_info_key, item.getK());
+                ViewUtil.setText(item_gc_game_info_value, item.getV());
+            }
+        }));
+        gameInfoListArrayList.add(new GameInfoList("用户评价", new RecyclerViewAdapter<Entry<String, String>>(SheepApp.getInstance(), R.layout.item_gc_game_info, entryList) {
+            @Override
+            public void convert(ViewHolder viewHolder, Entry<String, String> item, int position) {
+                View item_gc_game_info_top = viewHolder.itemView.findViewById(R.id.item_gc_game_info_top);
+                TextView item_gc_game_info_key = viewHolder.itemView.findViewById(R.id.item_gc_game_info_key);
+                TextView item_gc_game_info_value = viewHolder.itemView.findViewById(R.id.item_gc_game_info_value);
+                View item_gc_game_info_bottom = viewHolder.itemView.findViewById(R.id.item_gc_game_info_bottom);
+                ViewUtil.setVisibility(item_gc_game_info_top, position == 0);
+                ViewUtil.setVisibility(item_gc_game_info_bottom, position + 1 == entryList.size());
+                ViewUtil.setText(item_gc_game_info_key, item.getK());
+                ViewUtil.setText(item_gc_game_info_value, item.getV());
+            }
+        }));
+
+        gc_game_app_detail_info_list.getAdapter().notifyDataSetChanged();
+        if (appId > 0) {
+            initData("相关游戏", SheepApp.getInstance().getNetComponent().getApiService().getDetailRelevantGames(appId), new View.OnClickListener() {
+                @Override
+                public void onClick(View view) {
+                    G.showToast(R.string.coming_soon);
+                }
+            });
+            initData("热门试玩", SheepApp.getInstance().getNetComponent().getApiService().getDetailHotGames(appId), new View.OnClickListener() {
+                @Override
+                public void onClick(View view) {
+                    G.showToast(R.string.coming_soon);
+                }
+            });
+        }
+    }
+
+    //加载相关游戏与热门试玩数据列表
+    private void initData(final String name, Observable<BaseMessage> observable, final View.OnClickListener onClickListener) {
+        observable.observeOn(AndroidSchedulers.mainThread())
+                .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
+                    @Override
+                    public void onNext(BaseMessage baseMessage) {
+                        ArrayList<GameApp> newList = baseMessage.getDataList(GameApp.class);
+                        if (!ListUtil.isEmpty(newList)) {
+                            gameInfoListArrayList.add(new GameInfoList(name, new RecyclerViewAdapter<GameApp>(SheepApp.getInstance(), R.layout.item_gc_game_app_63, newList) {
+                                @Override
+                                public void convert(ViewHolder viewHolder, GameApp item, int position) {
+                                    ImageView item_gc_game_app_iv = viewHolder.itemView.findViewById(R.id.item_gc_game_app_iv);
+                                    TextView item_gc_game_app_tv = viewHolder.itemView.findViewById(R.id.item_gc_game_app_tv);
+                                    if (item == null) {
+                                        ViewUtil.setDefaultText(item_gc_game_app_tv);
+                                    } else {
+                                        // 加载数据
+                                        ViewUtil.setText(item_gc_game_app_tv, item.getName());
+                                        GlideImageLoader.setGameImage(item_gc_game_app_iv, item.getIcon());
+                                    }
+                                }
+                            }, onClickListener).setHorizontal());
+                        }
+                    }
+
+                    @Override
+                    public void onError(BaseMessage baseMessage) {
+                    }
+                });
+    }
+
+    private int appId;
+
+    public void setAppId(int appId) {
+        this.appId = appId;
+    }
+
+
+}

+ 14 - 13
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtPlayGame.java

@@ -3,7 +3,6 @@ package com.sheep.gamegroup.view.fragment;
 import android.app.Activity;
 import android.content.Context;
 import android.support.annotation.NonNull;
-import android.support.v4.widget.NestedScrollView;
 import android.support.v7.widget.LinearLayoutManager;
 import android.support.v7.widget.RecyclerView;
 import android.view.View;
@@ -19,11 +18,10 @@ import com.scwang.smartrefresh.layout.api.RefreshLayout;
 import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
 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.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.ListTypeList;
 import com.sheep.gamegroup.model.entity.SlideshowEty;
 import com.sheep.gamegroup.model.util.AbsSubscriber;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
@@ -73,8 +71,6 @@ public class FgtPlayGame extends BaseFragment {
     RecyclerView play_game_list_x_rv;
     @BindView(R.id.refresh)
     SmartRefreshLayout refresh;
-    @BindView(R.id.scrollView)
-    NestedScrollView scrollView;
     Unbinder unbinder;
 
     private Activity activity;
@@ -82,12 +78,12 @@ public class FgtPlayGame extends BaseFragment {
     private List<SlideshowEty> gameActList = new ArrayList<>();
     //每日必玩", "近期最热", "猜你喜欢
     private List<GameListType> gameListTypeList3 = new ArrayList<>();
-    private List<GameEntityList> gameEntityList3 = new ArrayList<>();
+    private List<ListTypeList<GameEntity, GameListType>> gameEntityList3 = new ArrayList<>();
     //天天更新与重点推荐
     private List<GameListType> gameListTypeList2 = new ArrayList<>();
-    private List<GameListTypeList<GameRecommend>> gameListTypeList2List = new ArrayList<>();
+    private List<ListTypeList<GameRecommend, GameListType>> gameListTypeList2List = new ArrayList<>();
     //预下载和tag列表的数据
-    private List<GameEntityList> gameEntityListx = new ArrayList<>();
+    private List<ListTypeList<GameEntity, GameListType>> gameEntityListx = new ArrayList<>();
     private List<SlideshowEty> slideshowEtyLists = new ArrayList<>();
     private List<String> slideshowTitleList = new ArrayList<>();
 
@@ -211,6 +207,8 @@ public class FgtPlayGame extends BaseFragment {
     }
 
     private void initBannerAct() {
+        gameActList.clear();
+        play_game_act.getAdapter().notifyDataSetChanged();
         SheepApp.getInstance().getNetComponent().getApiService().gameBannerAct()
                 .subscribeOn(Schedulers.io())
                 .observeOn(AndroidSchedulers.mainThread())
@@ -218,11 +216,11 @@ public class FgtPlayGame extends BaseFragment {
                     @Override
                     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();
+                        notifyDataSetChanged();
                     }
 
                     @Override
@@ -234,6 +232,8 @@ public class FgtPlayGame extends BaseFragment {
 
     //天天更新、重点推荐
     private void initRecommendList() {
+        gameListTypeList2List.clear();
+        play_game_list_2_rv.getAdapter().notifyDataSetChanged();
         Observable.from(gameListTypeList2)
                 .subscribe(new AbsSubscriber<GameListType>() {
                     @Override
@@ -246,7 +246,7 @@ public class FgtPlayGame extends BaseFragment {
                                     public void onNext(BaseMessage baseMessage) {
                                         List<GameRecommend> newList = baseMessage.getDatas(GameRecommend.class);
                                         if (!ListUtil.isEmpty(newList)) {
-                                            gameListTypeList2List.add(new GameListTypeList<>(gameListType, newList));
+                                            gameListTypeList2List.add(new ListTypeList<>(gameListType, newList));
                                             play_game_list_2_rv.getAdapter().notifyDataSetChanged();
                                             notifyDataSetChanged();
                                         }
@@ -264,6 +264,7 @@ public class FgtPlayGame extends BaseFragment {
     //预下载下面的tagList
     private void initGameTagList() {
         gameEntityListx.clear();
+        play_game_list_x_rv.getAdapter().notifyDataSetChanged();
         //预下载
         GameListType gameListType = new GameListType();
         gameListType.setTitle("预下载");
@@ -412,7 +413,7 @@ public class FgtPlayGame extends BaseFragment {
                 });
     }
 
-    private void initGameList(final RecyclerView playGameListRv, final List<GameEntityList> gameEntityListList, final GameListType gameListType) {
+    private void initGameList(final RecyclerView playGameListRv, final List<ListTypeList<GameEntity, GameListType>> gameEntityListList, final GameListType gameListType) {
         if (gameListType == null) {
             return;
         }
@@ -423,10 +424,10 @@ public class FgtPlayGame extends BaseFragment {
                     public void onNext(BaseMessage baseMessage) {
                         List<GameEntity> newList = baseMessage.getDatas(GameEntity.class);
                         if (!ListUtil.isEmpty(newList)) {
-                            gameEntityListList.add(new GameEntityList(gameListType, newList));
+                            gameEntityListList.add(new ListTypeList<>(gameListType, newList));
                             playGameListRv.getAdapter().notifyDataSetChanged();
-                            notifyDataSetChanged();
                         }
+                        notifyDataSetChanged();
                     }
 
                     @Override

+ 2 - 3
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtPlayGameDetail.java

@@ -52,7 +52,6 @@ public class FgtPlayGameDetail extends BaseFragment {
     Unbinder unbinder;
 
     private ArrayList<String> pictureList = ListUtil.emptyList();
-    private ImageListHelper imageListHelper = new ImageListHelper();
     private Activity activity;
     private GameEntity gameEntity;
 
@@ -72,7 +71,7 @@ public class FgtPlayGameDetail extends BaseFragment {
     @Override
     public void onViewCreated() {
         activity = getActivity();
-        imageListHelper.initList(activity, find_game_list, pictureList);
+        ImageListHelper.initList(activity, find_game_list, pictureList);
 
         if(gameEntity == null || gameEntity.getApp() == null )
             return;
@@ -83,7 +82,7 @@ public class FgtPlayGameDetail extends BaseFragment {
             pictureList.clear();
             ListUtil.addAll(pictureList, pictures.split(";"));
             find_game_list.setVisibility(View.VISIBLE);
-            imageListHelper.notifyDataSetChanged();
+            find_game_list.getAdapter().notifyDataSetChanged();
         } else {
             find_game_list.setVisibility(View.GONE);
         }

+ 4 - 4
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtTryMakeMoney.java

@@ -470,11 +470,11 @@ public class FgtTryMakeMoney extends BaseFragment implements TryMakeMoneyContrac
             switch (about_to_begin) {
                 case 0:
                     ListUtil.removeAll(releaseEtyLists, lastCacheReleaseEtyLists);
-                    ListUtil.addAllItem(releaseEtyLists, releaseEtyList);
+                    ListUtil.addAll(releaseEtyLists, releaseEtyList);
                     break;
                 case 1:
                     ListUtil.removeAll(releaseEtyListsBegin, lastCacheReleaseEtyListsBegin);
-                    ListUtil.addAllItem(releaseEtyListsBegin, releaseEtyList);
+                    ListUtil.addAll(releaseEtyListsBegin, releaseEtyList);
                     break;
             }
         }
@@ -512,11 +512,11 @@ public class FgtTryMakeMoney extends BaseFragment implements TryMakeMoneyContrac
             switch (about_to_begin) {
                 case 0:
                     lastCacheReleaseEtyLists = cacheTaskReleaseEtyList;
-                    ListUtil.addAllItem(releaseEtyLists, cacheTaskReleaseEtyList);
+                    ListUtil.addAll(releaseEtyLists, cacheTaskReleaseEtyList);
                     break;
                 case 1:
                     lastCacheReleaseEtyListsBegin = cacheTaskReleaseEtyList;
-                    ListUtil.addAllItem(releaseEtyListsBegin, cacheTaskReleaseEtyList);
+                    ListUtil.addAll(releaseEtyListsBegin, cacheTaskReleaseEtyList);
                     break;
             }
             notifyDataSetChanged();

+ 1 - 1
app/src/main/java/com/sheep/jiuyan/samllsheep/base/BaseFragment.java

@@ -93,7 +93,7 @@ public abstract class BaseFragment extends Fragment {
     }
     //绑定view
     public void butterKnifeBindView() {
-        if(userButterKnife())
+        if(userButterKnife() && mView != null)
             unbinder = ButterKnife.bind(this, mView);
     }
 

+ 2 - 2
app/src/main/java/com/sheep/jiuyan/samllsheep/net/Network.java

@@ -1,7 +1,7 @@
 package com.sheep.jiuyan.samllsheep.net;
 
 import com.sheep.gamegroup.model.cookie.CookieManager;
-import com.sheep.gamegroup.model.util.AddPuplicParameIntercept;
+import com.sheep.gamegroup.model.util.AddPublicParamsIntercept;
 import com.sheep.gamegroup.model.util.CacheInterceptor;
 import com.sheep.gamegroup.model.util.LogInterceptor;
 import com.sheep.gamegroup.util.TestUtil;
@@ -40,7 +40,7 @@ public class Network {
                 .readTimeout(TIME_OUT, TimeUnit.SECONDS)
                 .writeTimeout(TIME_OUT, TimeUnit.SECONDS)
                 .cookieJar(new CookieManager(SheepApp.getInstance()))
-                .addInterceptor(new AddPuplicParameIntercept())
+                .addInterceptor(new AddPublicParamsIntercept())
                 .addInterceptor(new CacheInterceptor())
                 .addInterceptor(loggingInterceptor);
         api = new Retrofit.Builder()

+ 12 - 18
app/src/main/java/com/sheep/jiuyan/samllsheep/service/DownloadService.java

@@ -27,8 +27,7 @@ import com.liulishuo.okdownload.core.listener.assist.Listener4SpeedAssistExtend;
 import com.sheep.gamegroup.event.BigEvent;
 import com.sheep.gamegroup.event.EventTypes;
 import com.sheep.gamegroup.greendao.download.DownLoadInfo;
-import com.sheep.gamegroup.model.entity.FindApp;
-import com.sheep.gamegroup.model.entity.PlayGameEntity;
+import com.sheep.gamegroup.model.entity.GameApp;
 import com.sheep.gamegroup.model.entity.TaskEty;
 import com.sheep.gamegroup.util.ActivityManager;
 import com.sheep.gamegroup.util.DownloadUtil;
@@ -59,18 +58,20 @@ public class DownloadService extends Service {
         super.onCreate();
         downloadUtil = new DownloadUtil(this);
     }
+
     @Override
     public int onStartCommand(Intent intent, int flags, int startId) {
-        if(intent != null){
+        if (intent != null) {
             String download_url = intent.getStringExtra("download_url");
             String file_path = intent.getStringExtra("file_path");
-            if(download_url != null && file_path != null) {
+            if (download_url != null && file_path != null) {
                 DownloadTask task = DownloadUtil.getTask(download_url, file_path);
                 task.enqueue(downloadListener);
             }
         }
         return super.onStartCommand(intent, flags, startId);
     }
+
     private DownloadListener downloadListener = new DownloadListener4WithSpeed() {
         @Override
         public void taskStart(@NonNull DownloadTask task) {
@@ -114,11 +115,11 @@ public class DownloadService extends Service {
 
         @Override
         public void taskEnd(@NonNull DownloadTask task, @NonNull EndCause cause, @Nullable Exception realCause, @NonNull SpeedCalculator taskSpeed) {
-            LogUtil.println("DownloadListener", "taskEnd",  "cause", cause.name(),  "realCause", realCause != null ? realCause.getMessage() : "null", "taskSpeed", taskSpeed.averageSpeed());
+            LogUtil.println("DownloadListener", "taskEnd", "cause", cause.name(), "realCause", realCause != null ? realCause.getMessage() : "null", "taskSpeed", taskSpeed.averageSpeed());
             DownLoadInfo downLoadInfo;
-            switch (cause){
+            switch (cause) {
                 case COMPLETED://下载完成
-                    if(task.getFile() != null) {
+                    if (task.getFile() != null) {
                         downLoadInfo = downloadUtil.setDownloadTaskFinish(task.getUrl(), task.getFile().getAbsolutePath());
                         ApkUtils.installApk(getApplicationContext(), task.getFile().getAbsolutePath());
                         EventBus.getDefault().post(new BigEvent().setEventTypes(EventTypes.DOWNLOAD_COMPLETE).setData(downLoadInfo));
@@ -156,20 +157,13 @@ public class DownloadService extends Service {
     }
 
 
-
-
-
-
     public static void setDownLoadLongClick(View view, final TaskEty task) {
-        if(task != null && task.needDownloadApp())
-            setDownLoadLongClick(view, task.getDownload_link(), task.getTask_name());
-    }
-    public static void setDownLoadLongClick(View view, final FindApp task) {
-        if(task != null && !TextUtils.isEmpty(task.getDownload_link()))
+        if (task != null && task.needDownloadApp())
             setDownLoadLongClick(view, task.getDownload_link(), task.getTask_name());
     }
-    public static void setDownLoadLongClick(View view, final PlayGameEntity task) {
-        if(task != null && task.isCanDownload())
+
+    public static void setDownLoadLongClick(View view, final GameApp task) {
+        if (task != null && !TextUtils.isEmpty(task.getDownload_link()))
             setDownLoadLongClick(view, task.getDownload_link(), task.getTask_name());
     }
 

+ 8 - 0
app/src/main/res/drawable/shape_oval_light_blue.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="oval">
+    <solid android:color="#ffffffff" />
+    <gradient
+        android:endColor="#ff34a5e7"
+        android:startColor="#ff29d6fd" />
+</shape>

+ 172 - 0
app/src/main/res/layout/act_gc_game_app_detail.xml

@@ -0,0 +1,172 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    tools:context="com.sheep.gamegroup.view.activity.ActGcGameAppDetail">
+
+    <com.scwang.smartrefresh.layout.SmartRefreshLayout
+        android:id="@+id/refresh"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:background="@color/white">
+
+        <android.support.v4.widget.NestedScrollView
+            android:layout_width="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">
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:focusable="true"
+                android:focusableInTouchMode="true"
+                android:orientation="vertical">
+
+                <RelativeLayout
+                    android:layout_width="match_parent"
+                    android:layout_height="216dp">
+
+                    <ImageView
+                        android:id="@+id/gc_game_app_detail_iv"
+                        android:layout_width="match_parent"
+                        android:layout_height="match_parent"
+                        android:scaleType="centerCrop"
+                        android:src="@drawable/icon" />
+
+                    <ImageView
+                        android:layout_width="?attr/actionBarSize"
+                        android:layout_height="?attr/actionBarSize"
+                        android:layout_marginTop="@dimen/status_bar_height"
+                        android:gravity="center_vertical"
+                        android:onClick="onClickBackImg"
+                        android:scaleType="centerInside"
+                        android:src="@drawable/narrow_back_black" />
+
+                    <ImageView
+                        android:layout_width="?attr/actionBarSize"
+                        android:layout_height="?attr/actionBarSize"
+                        android:layout_alignParentEnd="true"
+                        android:layout_marginTop="@dimen/status_bar_height"
+                        android:gravity="center_vertical"
+                        android:onClick="onClickShareImg"
+                        android:scaleType="centerInside"
+                        android:src="@mipmap/share" />
+
+                </RelativeLayout>
+
+                <android.support.constraint.ConstraintLayout
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content">
+
+                    <ImageView
+                        android:id="@+id/gc_game_app_detail_icon"
+                        android:layout_width="84dp"
+                        android:layout_height="84dp"
+                        android:layout_marginStart="16dp"
+                        android:layout_marginTop="20dp"
+                        android:layout_marginBottom="20dp"
+                        android:src="@drawable/icon_lj"
+                        app:layout_constraintBottom_toBottomOf="parent"
+                        app:layout_constraintStart_toStartOf="parent"
+                        app:layout_constraintTop_toTopOf="parent" />
+
+                    <TextView
+                        android:id="@+id/gc_game_app_detail_name"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_marginStart="13dp"
+                        android:text="永恒仙域"
+                        android:textColor="#ff333333"
+                        android:textSize="13sp"
+                        app:layout_constraintStart_toEndOf="@id/gc_game_app_detail_icon"
+                        app:layout_constraintTop_toTopOf="@+id/gc_game_app_detail_icon" />
+
+                    <android.support.v7.widget.RecyclerView
+                        android:id="@+id/gc_game_app_detail_tag_list"
+                        android:layout_width="0dp"
+                        android:layout_height="wrap_content"
+                        app:layout_constraintBottom_toBottomOf="parent"
+                        app:layout_constraintEnd_toEndOf="parent"
+                        app:layout_constraintStart_toStartOf="@id/gc_game_app_detail_name"
+                        app:layout_constraintTop_toTopOf="parent" />
+
+                    <TextView
+                        android:id="@+id/gc_game_app_detail_bt1"
+                        android:layout_width="60dp"
+                        android:layout_height="26dp"
+                        android:background="@drawable/selector_button_stroke_main"
+                        android:gravity="center"
+                        android:text="关注"
+                        android:textColor="#ff2ebef2"
+                        android:textSize="13sp"
+                        android:onClick="onClickFollowTv"
+                        app:layout_constraintBottom_toBottomOf="@id/gc_game_app_detail_icon"
+                        app:layout_constraintStart_toStartOf="@id/gc_game_app_detail_name" />
+
+                    <TextView
+                        android:id="@+id/gc_game_app_detail_bt2"
+                        android:layout_width="60dp"
+                        android:layout_height="26dp"
+                        android:layout_marginStart="25dp"
+                        android:background="@drawable/selector_button_full_main"
+                        android:gravity="center"
+                        android:text="下载"
+                        android:textColor="@color/white"
+                        android:textSize="13sp"
+                        app:layout_constraintBottom_toBottomOf="@id/gc_game_app_detail_icon"
+                        app:layout_constraintStart_toEndOf="@id/gc_game_app_detail_bt1" />
+                </android.support.constraint.ConstraintLayout>
+
+                <View
+                    android:layout_width="match_parent"
+                    android:layout_height="10dp"
+                    android:background="#fff5f5f5" />
+
+                <android.support.design.widget.TabLayout
+                    android:id="@+id/tabLayout"
+                    style="@style/style_tab"
+                    android:layout_height="48dp"
+                    app:tabIndicatorHeight="2dp" />
+
+                <include layout="@layout/line_1px_hor" />
+
+
+                <com.kfzs.android.view.widget.WrapContentHeightViewPager
+                    android:id="@+id/viewPager"
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent"
+                    android:layout_marginTop="@dimen/content_padding_15"
+                    android:minHeight="@dimen/view_size_100"
+                    app:layout_behavior="@string/appbar_scrolling_view_behavior" />
+
+            </LinearLayout>
+
+        </android.support.v4.widget.NestedScrollView>
+
+    </com.scwang.smartrefresh.layout.SmartRefreshLayout>
+
+    <com.kfzs.duanduan.view.DragRelativeLayout
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignParentTop="true"
+        android:layout_alignParentEnd="true"
+        android:layout_marginTop="229dp"
+        android:onClick="onClickPlusDrag"
+        android:paddingTop="@dimen/content_padding_10"
+        android:paddingBottom="@dimen/content_padding_10">
+
+        <TextView
+            android:layout_width="45dp"
+            android:layout_height="45dp"
+            android:background="@drawable/shape_oval_light_blue"
+            android:gravity="center"
+            android:text="+"
+            android:textColor="@color/white"
+            android:textSize="30sp" />
+    </com.kfzs.duanduan.view.DragRelativeLayout>
+</RelativeLayout>

+ 1 - 1
app/src/main/res/layout/act_play_game_detail_layout.xml

@@ -61,7 +61,7 @@
                 </LinearLayout>
 
 
-                <com.kfzs.duanduan.view.ViewPagerAutoHeigh
+                <com.kfzs.android.view.widget.WrapContentHeightViewPager
                     android:id="@+id/viewpager_act_game_details"
                     android:layout_width="match_parent"
                     android:layout_height="match_parent"

+ 2 - 4
app/src/main/res/layout/fgt_askgetmoney_friend.xml

@@ -5,7 +5,6 @@
     android:layout_marginEnd="@dimen/content_padding_10"
     android:layout_marginStart="@dimen/content_padding_10"
     android:layout_marginTop="@dimen/content_padding_10"
-    android:minHeight="@dimen/view_size_420"
     android:background="@drawable/x_shap_shadow_bg_rectgangle_purple_red"
     android:orientation="vertical"
     android:paddingBottom="@dimen/content_padding_10"
@@ -22,11 +21,10 @@
 
     <include layout="@layout/x_ask_getmoney_act_layout_include" />
 
-    <android.support.v4.view.ViewPager
+    <com.kfzs.android.view.widget.WrapContentHeightViewPager
         android:id="@+id/friend_extract_vp"
         android:layout_width="match_parent"
-        android:layout_height="@dimen/view_size_350"
-        android:minHeight="@dimen/ask_friend_list_h"
+        android:layout_height="wrap_content"
         android:layout_marginTop="3dp" />
 
     <LinearLayout

+ 19 - 0
app/src/main/res/layout/fgt_gc_game_app_detail.xml

@@ -0,0 +1,19 @@
+<?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="match_parent"
+    android:orientation="vertical">
+
+    <android.support.v7.widget.RecyclerView
+        android:id="@+id/gc_game_app_detail_pic_list"
+        android:layout_width="match_parent"
+        android:layout_height="200dp"
+        android:layout_marginTop="@dimen/dp_10"
+        android:layout_marginBottom="@dimen/dp_10" />
+
+    <android.support.v7.widget.RecyclerView
+        android:id="@+id/gc_game_app_detail_info_list"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent" />
+
+</LinearLayout>

+ 1 - 1
app/src/main/res/layout/friend_list.xml

@@ -2,7 +2,7 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/friend_list_ll"
     android:layout_width="match_parent"
-    android:layout_height="@dimen/ask_friend_list_h"
+    android:layout_height="wrap_content"
     android:layout_centerInParent="true"
     android:orientation="vertical">
 

+ 2 - 1
app/src/main/res/layout/friend_list_empty.xml

@@ -1,7 +1,7 @@
 <?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="@dimen/ask_friend_list_h"
+    android:layout_height="wrap_content"
     android:layout_centerInParent="true"
     android:orientation="vertical">
 
@@ -9,6 +9,7 @@
         android:id="@+id/empty_view"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
+        android:minHeight="200dp"
         android:visibility="gone">
 
         <ImageView

+ 0 - 1
app/src/main/res/layout/homepage_act_layout.xml

@@ -130,7 +130,6 @@
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_alignParentEnd="true"
-        android:layout_alignParentRight="true"
         android:layout_alignParentBottom="true"
         android:layout_marginBottom="@dimen/content_padding_20"
         android:gravity="right"

+ 33 - 0
app/src/main/res/layout/item_gc_game_app_63.xml

@@ -0,0 +1,33 @@
+<?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_gravity="center"
+    android:orientation="vertical"
+    android:paddingStart="6dp"
+    android:paddingTop="20dp"
+    android:paddingBottom="20dp">
+
+    <ImageView
+        android:id="@+id/item_gc_game_app_iv"
+        android:layout_width="63dp"
+        android:layout_height="63dp"
+        android:layout_marginStart="10dp"
+        android:layout_marginEnd="10dp"
+        android:layout_gravity="center"
+        android:src="@drawable/icon_lj" />
+
+    <TextView
+        android:id="@+id/item_gc_game_app_tv"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center_horizontal"
+        android:layout_marginTop="12dp"
+        android:ellipsize="end"
+        android:gravity="center"
+        android:maxEms="5"
+        android:maxLines="1"
+        android:text=""
+        android:textColor="#333333"
+        android:textSize="12sp" />
+</LinearLayout>

+ 33 - 0
app/src/main/res/layout/item_gc_game_app_detail_list.xml

@@ -0,0 +1,33 @@
+<?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_gc_game_app_list_top"
+        android:layout_width="match_parent"
+        android:layout_marginStart="25dp"
+        android:layout_marginEnd="25dp"
+        android:layout_height="1dp"
+        android:background="#F2F2F2" />
+
+    <RelativeLayout style="@style/style_wc_rl">
+
+        <TextView
+            android:id="@+id/item_gc_game_app_list_tv"
+            style="@style/style_wc_line_title"
+            android:text="游戏介绍" />
+
+        <TextView
+            android:id="@+id/item_gc_game_app_list_more_tv"
+            style="@style/style_wc_more"
+            android:visibility="invisible"
+            android:text="更多" />
+    </RelativeLayout>
+
+    <android.support.v7.widget.RecyclerView
+        android:id="@+id/item_gc_game_app_list_rv"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"/>
+</LinearLayout>

+ 37 - 0
app/src/main/res/layout/item_gc_game_app_intro.xml

@@ -0,0 +1,37 @@
+<?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"
+    android:paddingTop="20dp"
+    android:paddingBottom="7dp">
+
+    <TextView
+        android:id="@+id/item_gc_game_app_intro_tv"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:ellipsize="end"
+        android:maxLines="3"
+        android:paddingStart="30dp"
+        android:paddingEnd="30dp"
+        android:text="《永恒仙域》经典仙侠梦想,高清3DMMORPG手游,继承同类型游戏的经典游戏模式,更加酷炫的游戏画面与动作特效,精心构建出这个瑰丽的东方式仙侠世界。《永恒仙域》经典仙侠梦想,高清3DMMORPG手游,继承同类型游戏的经典游戏模式,更加酷炫的游戏画面与动作特效,精心构建出这个瑰丽的东方式仙侠世界。"
+        android:textColor="#ff666666"
+        android:lineSpacingMultiplier="1.3"
+        android:textSize="12sp" />
+
+    <TextView
+        android:id="@+id/item_gc_game_app_intro_show_all"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:padding="13dp"
+        android:layout_gravity="center_horizontal"
+        android:text="显示全部"
+        android:visibility="gone"
+        android:textColor="#ff4bc1ff"
+        android:textSize="12sp" />
+    <!--item_gc_game_app_intro_no_show_all 与 item_gc_game_app_intro_show_all两者必须显示一个,隐藏另一个-->
+    <View
+        android:id="@+id/item_gc_game_app_intro_show_all_no"
+        android:layout_width="wrap_content"
+        android:layout_height="13dp"/>
+</LinearLayout>

+ 44 - 0
app/src/main/res/layout/item_gc_game_info.xml

@@ -0,0 +1,44 @@
+<?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_gc_game_info_top"
+        android:layout_width="match_parent"
+        android:layout_height="15dp" />
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="horizontal"
+        android:paddingStart="25dp"
+        android:paddingEnd="25dp">
+
+        <TextView
+            android:id="@+id/item_gc_game_info_key"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:padding="5dp"
+            android:text="当前版本"
+            android:textColor="#ff666666"
+            android:textSize="12sp" />
+
+        <TextView
+            android:id="@+id/item_gc_game_info_value"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:gravity="end"
+            android:maxLines="1"
+            android:padding="5dp"
+            android:text="1.0.0"
+            android:textColor="#ff666666"
+            android:textSize="12sp" />
+    </LinearLayout>
+
+    <View
+        android:id="@+id/item_gc_game_info_bottom"
+        android:layout_width="match_parent"
+        android:layout_height="15dp" />
+</LinearLayout>

+ 13 - 0
app/src/main/res/layout/item_tag.xml

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
+    android:background="@drawable/shape_blue_stroke_rectangle_no_lb"
+    android:paddingStart="8dp"
+    android:paddingTop="2dp"
+    android:paddingEnd="8dp"
+    android:paddingBottom="2dp"
+    android:layout_marginEnd="10dp"
+    android:text="热门推荐"
+    android:textColor="#ff4889ff"
+    android:textSize="9sp" />

+ 1 - 2
app/src/main/res/layout/x_ask_getmoney_act_layout.xml

@@ -135,14 +135,13 @@
                     android:layout_height="1dp"
                     android:background="@color/yellow_FFAD3C" />
 
-                <com.kfzs.duanduan.view.ViewPagerAutoHeigh
+                <com.kfzs.android.view.widget.WrapContentHeightViewPager
                     android:id="@+id/pager"
                     android:layout_width="match_parent"
                     android:layout_height="match_parent"
                     android:layout_marginEnd="@dimen/content_padding_10"
                     android:layout_marginStart="@dimen/content_padding_10"
                     android:layout_marginTop="@dimen/content_padding_10"
-                    android:minHeight="@dimen/ask_friend_list_h"
                     app:layout_behavior="@string/appbar_scrolling_view_behavior" />
 
                 <!--邀请小技巧-->

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

@@ -11,5 +11,4 @@
 
     <dimen name="textSize1">12sp</dimen>
 
-    <dimen name="ask_friend_list_h">320dp</dimen>
 </resources>

+ 30 - 8
view/src/main/java/com/kfzs/android/view/widget/WrapContentHeightViewPager.java

@@ -4,6 +4,7 @@ import android.content.Context;
 import android.support.v4.view.ViewPager;
 import android.util.AttributeSet;
 import android.view.View;
+import android.widget.LinearLayout;
 
 /**
  * <pre>
@@ -25,23 +26,44 @@ import android.view.View;
 public class WrapContentHeightViewPager extends ViewPager {
     public WrapContentHeightViewPager(Context context) {
         super(context);
+        init();
     }
 
     public WrapContentHeightViewPager(Context context, AttributeSet attrs) {
         super(context, attrs);
+        init();
+    }
+
+    private void init() {
+        addOnPageChangeListener(new OnPageChangeListener() {
+            @Override
+            public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
+
+            }
+
+            @Override
+            public void onPageSelected(int position) {
+                View view = getChildAt(position);
+                int height = view.getMeasuredHeight();
+                LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) getLayoutParams();
+                layoutParams.height = height;
+                setLayoutParams(layoutParams);
+            }
+
+            @Override
+            public void onPageScrollStateChanged(int state) {
+            }
+        });
     }
 
     @Override
     protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
-        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
-        int height = 0;
-        for (int i = 0; i < getChildCount(); i++) {
-            View child = getChildAt(i);
-            child.measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
-            int h = child.getMeasuredHeight();
-            if (h > height) height = h;
+        View childView = getChildAt(getCurrentItem());
+        if (childView != null) {
+            childView.measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
+            int viewHeight = childView.getMeasuredHeight();
+            heightMeasureSpec = MeasureSpec.makeMeasureSpec(viewHeight, MeasureSpec.EXACTLY);
         }
-        heightMeasureSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY);
         super.onMeasure(widthMeasureSpec, heightMeasureSpec);
     }
 }