zengjiebin пре 7 година
родитељ
комит
5a850983c5
22 измењених фајлова са 529 додато и 83 уклоњено
  1. 4 1
      app/src/main/AndroidManifest.xml
  2. 1 1
      app/src/main/java/com/sheep/gamegroup/absBase/BaseListActivity2.java
  3. 7 0
      app/src/main/java/com/sheep/gamegroup/model/entity/UserComment.java
  4. 8 4
      app/src/main/java/com/sheep/gamegroup/util/ApiJSONUtil.java
  5. 2 2
      app/src/main/java/com/sheep/gamegroup/util/DataUtil.java
  6. 15 3
      app/src/main/java/com/sheep/gamegroup/util/Jump2View.java
  7. 4 0
      app/src/main/java/com/sheep/gamegroup/util/viewHelper/UserCommentHelper.java
  8. 46 23
      app/src/main/java/com/sheep/gamegroup/view/activity/ActFindInformation.java
  9. 22 0
      app/src/main/java/com/sheep/gamegroup/view/activity/ActArticleComment.java
  10. 1 2
      app/src/main/java/com/sheep/gamegroup/view/activity/ActCommentGameApp.java
  11. 64 0
      app/src/main/java/com/sheep/gamegroup/view/adapter/AdpArticleComment.java
  12. 1 1
      app/src/main/java/com/sheep/gamegroup/view/adapter/AdpGameCenter1_2List.java
  13. 1 1
      app/src/main/java/com/sheep/gamegroup/view/fragment/BaseListFragment3.java
  14. 148 0
      app/src/main/java/com/sheep/gamegroup/view/fragment/FgtArticleComment.java
  15. 49 35
      app/src/main/java/com/sheep/gamegroup/view/fragment/FgtUserCommentDetail.java
  16. 3 2
      app/src/main/res/layout/act_gc_game_app_detail.xml
  17. 2 0
      app/src/main/res/layout/header_user_comment_detail.xml
  18. 5 4
      app/src/main/res/layout/bottom_user_comment_detail.xml
  19. 15 0
      app/src/main/res/layout/include_line_title_more.xml
  20. 120 0
      app/src/main/res/layout/item_article_comment.xml
  21. 6 0
      app/src/main/res/layout/net_empty_fresh_list.xml
  22. 5 4
      app/src/main/res/values/dd_styles.xml

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

@@ -629,9 +629,12 @@
             <!--android:name="com.sheep.gamegroup.view.activity.ActFindGame"-->
             <!--android:screenOrientation="portrait" />-->
         <activity
-            android:name="com.sheep.gamegroup.view.activity.ActFindInformation"
+            android:name="com.sheep.gamegroup.view.activity.ActArticle"
             android:configChanges="orientation|screenSize|keyboardHidden" />
         <activity
+            android:name="com.sheep.gamegroup.view.activity.ActArticleComment"
+            android:screenOrientation="portrait" />
+        <activity
             android:name="com.sheep.gamegroup.view.activity.ActReservation"
             android:screenOrientation="portrait" />
         <activity

+ 1 - 1
app/src/main/java/com/sheep/gamegroup/absBase/BaseListActivity2.java

@@ -127,7 +127,7 @@ public abstract class BaseListActivity2<T> extends BaseActivity implements IRefr
         final String urlKey = getKey(page, per_page);
         if (isFirstGetACache()) {
             //先尝试获取缓存数据
-            lastCacheList = DataUtil.getInstance().getCacheList(urlKey, getTClass(), conversion);
+            lastCacheList = DataUtil.getInstance().getCacheList(urlKey, getTClass(), conversion, page);
             loadList(lastCacheList);
         }
         SysAppUtil.checkNet(new Action1<Integer>() {

+ 7 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/UserComment.java

@@ -1,6 +1,8 @@
 package com.sheep.gamegroup.model.entity;
 
 
+import com.sheep.gamegroup.util.ApiJSONUtil;
+
 /**
  * Created by realicing on 2018/11/1.
  * realicing@sina.com
@@ -227,4 +229,9 @@ public class UserComment {
     public void plusLike() {
         like++;
     }
+
+    //是否是游戏资讯的用户评论
+    public boolean isArticleUserComment() {
+        return ApiJSONUtil.COMMENT_TYPE_ARTICLE == app_type;
+    }
 }

+ 8 - 4
app/src/main/java/com/sheep/gamegroup/util/ApiJSONUtil.java

@@ -2,7 +2,6 @@ package com.sheep.gamegroup.util;
 
 
 import android.support.annotation.IntDef;
-import android.support.annotation.StringDef;
 
 import com.alibaba.fastjson.JSONObject;
 import com.sheep.gamegroup.model.entity.BaseMessage;
@@ -12,6 +11,8 @@ import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 
 import rx.Observable;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.schedulers.Schedulers;
 
 /**
  * Created by realicing on 2018/11/2.
@@ -19,12 +20,13 @@ import rx.Observable;
  */
 public class ApiJSONUtil {
     public static final int COMMENT_TYPE_GAME = 1;
-    public static final int COMMENT_TYPE_INFORMATION = 2;
-    @IntDef({COMMENT_TYPE_GAME, COMMENT_TYPE_INFORMATION})
+    public static final int COMMENT_TYPE_ARTICLE = 2;
+    @IntDef({COMMENT_TYPE_GAME, COMMENT_TYPE_ARTICLE})
     @Retention(RetentionPolicy.SOURCE)
     public @interface COMMENT_TYPE {
     }
     /**
+     * 用户游戏评论
      * CommentType       int8    `description:"评论类型 1:游戏 2:资讯" json:"comment_type"`
      * app_id:	integer ($int64) 应用id
      * content:	string 评论内容
@@ -36,7 +38,9 @@ public class ApiJSONUtil {
         jsonObject.put("app_id", app_id);
         jsonObject.put("content", content);
         jsonObject.put("score", score);
-        return SheepApp.getInstance().getNetComponent().getApiService().postGameUserUserGameComment(jsonObject);
+        return SheepApp.getInstance().getNetComponent().getApiService().postGameUserUserGameComment(jsonObject)
+                .subscribeOn(Schedulers.io())
+                .observeOn(AndroidSchedulers.mainThread());
     }
 
     /**

+ 2 - 2
app/src/main/java/com/sheep/gamegroup/util/DataUtil.java

@@ -251,7 +251,7 @@ public class DataUtil {
      * @param <T>
      * @return
      */
-    public <T> List<T> getCacheList(String key, Class<T> classT, Conversion<BaseMessage, List<T>> conversion) {
+    public <T> List<T> getCacheList(String key, Class<T> classT, Conversion<BaseMessage, List<T>> conversion, int page) {
         String cacheData = aCache.getAsString(SheepApp.getInstance().getConnectAddress().getAppUrl() + "v1/" + key);
         if (cacheData == null) {
             return null;
@@ -265,7 +265,7 @@ public class DataUtil {
             BaseMessage baseMessage = JSON.parseObject(cacheData, BaseMessage.class);
             if(baseMessage != null) {
                 if (conversion != null) {
-                    return conversion.convert(baseMessage, 0);
+                    return conversion.convert(baseMessage, page);
                 } else {
                     return baseMessage.getDataList(classT);
                 }

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

@@ -46,7 +46,8 @@ import com.sheep.gamegroup.view.activity.ActCreditCardTaskList;
 import com.sheep.gamegroup.view.activity.ActCreditCardWeb;
 import com.sheep.gamegroup.view.activity.ActDownloadWelfareList;
 import com.sheep.gamegroup.view.activity.ActExchangeCMCC;
-import com.sheep.gamegroup.view.activity.ActFindInformation;
+import com.sheep.gamegroup.view.activity.ActArticle;
+import com.sheep.gamegroup.view.activity.ActArticleComment;
 import com.sheep.gamegroup.view.activity.ActGameAccount;
 import com.sheep.gamegroup.view.activity.ActGameAgencyRecharge;
 import com.sheep.gamegroup.view.activity.ActGameCenter;
@@ -1608,7 +1609,7 @@ public class Jump2View {
      * @param item
      */
     public void goFindInformation(Activity activity, Article item) {
-        Intent intent = new Intent(activity, ActFindInformation.class);
+        Intent intent = new Intent(activity, ActArticle.class);
         intent.putExtra("id", item.getId());
         intent.putExtra("title", item.getTitle());
         activity.startActivity(intent);
@@ -1623,7 +1624,7 @@ public class Jump2View {
      * @param id
      */
     public void goFindInformation(Activity activity, String title, int id) {
-        Intent intent = new Intent(activity, ActFindInformation.class);
+        Intent intent = new Intent(activity, ActArticle.class);
         intent.putExtra("id", id);
         intent.putExtra("title", title);
         activity.startActivity(intent);
@@ -2119,4 +2120,15 @@ public class Jump2View {
     public void goActUserAppHome(Activity activity, int user_id) {
         activity.startActivity(DataUtil.putObject(new Intent(activity, ActUserAppHome.class), user_id));
     }
+
+
+    /**
+     * 跳转游戏资讯评论界面
+     *
+     * @param activity
+     * @param article_id
+     */
+    public void goActFindInformationComment(Activity activity, int article_id) {
+        activity.startActivity(DataUtil.putObject(new Intent(activity, ActArticleComment.class), article_id));
+    }
 }

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

@@ -141,4 +141,8 @@ public class UserCommentHelper {
     public ImageView getUser_comment_detail_game_icon() {
         return user_comment_detail_game_icon;
     }
+
+    public AppCompatRatingBar getUser_comment_detail_user_publish_score() {
+        return user_comment_detail_user_publish_score;
+    }
 }

+ 46 - 23
app/src/main/java/com/sheep/gamegroup/view/activity/ActFindInformation.java

@@ -13,6 +13,7 @@ import android.support.v7.widget.RecyclerView;
 import android.text.TextUtils;
 import android.util.Log;
 import android.view.KeyEvent;
+import android.view.LayoutInflater;
 import android.view.MotionEvent;
 import android.view.View;
 import android.view.ViewGroup;
@@ -21,8 +22,10 @@ import android.webkit.WebChromeClient;
 import android.webkit.WebSettings;
 import android.webkit.WebView;
 import android.webkit.WebViewClient;
+import android.widget.EditText;
 import android.widget.FrameLayout;
 import android.widget.ImageView;
+import android.widget.RelativeLayout;
 import android.widget.TextView;
 
 import com.sheep.gamegroup.absBase.BaseActivity;
@@ -73,7 +76,7 @@ import static com.sheep.gamegroup.util.UMConfigUtils.Event.FIND_SHARE;
  * Created by realicing on 2018/5/10.
  * realicing@sina.com
  */
-public class ActFindInformation extends BaseActivity implements Action1<Integer> {
+public class ActArticle extends BaseActivity implements Action1<Integer> {
     @Override
     protected int getLayoutId() {
         return R.layout.net_empty_fresh_list;
@@ -100,6 +103,10 @@ public class ActFindInformation extends BaseActivity implements Action1<Integer>
     View check_net_ll;
     @BindView(R.id.view_list)
     RecyclerView view_list;
+    @BindView(R.id.bottom)
+    RelativeLayout bottom;
+    //输入框
+    private EditText input_comment_input;
     WebView webView;
 
     @Override
@@ -113,7 +120,7 @@ public class ActFindInformation extends BaseActivity implements Action1<Integer>
                     @Override
                     public void onClick(View view) {
                         FIND_SHARE.onEvent("find_id", id);
-                        Jump2View.getInstance().tryShare(ActFindInformation.this, "find_share_url", "find_id", id);
+                        Jump2View.getInstance().tryShare(ActArticle.this, "find_share_url", "find_id", id);
                     }
                 });
 
@@ -159,6 +166,25 @@ public class ActFindInformation extends BaseActivity implements Action1<Integer>
             }
         });
     }
+    //底部可跳转到评论
+    private void initBottomCommentView(){
+        if(input_comment_input != null || article == null){//保证只初始化一次
+            return;
+        }
+        LayoutInflater.from(SheepApp.getInstance()).inflate(R.layout.include_input_comment, bottom);
+        input_comment_input = bottom.findViewById(R.id.input_comment_input);
+        input_comment_input.setCursorVisible(false);
+        input_comment_input.setFocusable(false);
+        input_comment_input.setFocusableInTouchMode(false);
+        View.OnClickListener onClickListener;
+        bottom.setOnClickListener(onClickListener = new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                Jump2View.getInstance().goActFindInformationComment(ActArticle.this, article.getId());
+            }
+        });
+        input_comment_input.setOnClickListener(onClickListener);
+    }
 
 
     public void initWebView() {
@@ -194,7 +220,7 @@ public class ActFindInformation extends BaseActivity implements Action1<Integer>
 
             @Override
             public View getVideoLoadingProgressView() {
-                FrameLayout frameLayout = new FrameLayout(ActFindInformation.this);
+                FrameLayout frameLayout = new FrameLayout(ActArticle.this);
                 frameLayout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
                 return frameLayout;
             }
@@ -238,10 +264,10 @@ public class ActFindInformation extends BaseActivity implements Action1<Integer>
             return;
         }
 
-        ActFindInformation.this.getWindow().getDecorView();
+        ActArticle.this.getWindow().getDecorView();
 
         FrameLayout decor = (FrameLayout) getWindow().getDecorView();
-        fullscreenContainer = new FullscreenHolder(ActFindInformation.this);
+        fullscreenContainer = new FullscreenHolder(ActArticle.this);
         fullscreenContainer.addView(view, COVER_SCREEN_PARAMS);
         decor.addView(fullscreenContainer, COVER_SCREEN_PARAMS);
         customView = view;
@@ -321,14 +347,14 @@ public class ActFindInformation extends BaseActivity implements Action1<Integer>
         TextView find_information_name = (TextView) itemView.findViewById(R.id.find_information_name);
         TextView find_information_time = (TextView) itemView.findViewById(R.id.find_information_time);
         TextView find_information_look = (TextView) itemView.findViewById(R.id.find_information_look);
-        ViewUtil.setText(find_information_name, findItem.getTitle());
-        ViewUtil.setText(find_information_time, String.format(Locale.CHINA, "发布时间:%s", TimeUtil.TimeStamp2Date(findItem.getCreated_at(), "yyyy-MM-dd HH:mm")));
-        ViewUtil.setText(find_information_look, findItem.getClicks());
+        ViewUtil.setText(find_information_name, article.getTitle());
+        ViewUtil.setText(find_information_time, String.format(Locale.CHINA, "发布时间:%s", TimeUtil.TimeStamp2Date(article.getCreated_at(), "yyyy-MM-dd HH:mm")));
+        ViewUtil.setText(find_information_look, article.getClicks());
 
         webView = itemView.findViewById(R.id.find_information_content_wb);
         initWebView();
-        CommonUtil.getInstance().setDownloadListener(ActFindInformation.this, webView);
-        ViewUtil.loadDataWithBaseURL(webView, findItem.getContent());
+        CommonUtil.getInstance().setDownloadListener(ActArticle.this, webView);
+        ViewUtil.loadDataWithBaseURL(webView, article.getContent());
 
 
     }
@@ -374,16 +400,11 @@ public class ActFindInformation extends BaseActivity implements Action1<Integer>
         itemView.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View view) {
-                Jump2View.getInstance().goFindGame(ActFindInformation.this, findItem);
+                Jump2View.getInstance().goFindGame(ActArticle.this, article);
             }
         });
     }
 
-    @Override
-    public void initListener() {
-
-    }
-
     private List<String> list = ListUtil.emptyList();
 
     @Override
@@ -429,16 +450,18 @@ public class ActFindInformation extends BaseActivity implements Action1<Integer>
     private void loadFindItem(Article data) {
         if (data != null) {
             taskHelper.clear();
-            findItem = data;
+            article = data;
             list.clear();
             list.add("top");
             list.add("bottom");
             notifyDataSetChanged();
-            if (findItem.getRelease_task_id() != 0) {//包含任务
-                taskHelper.initAcceptedTask(ActFindInformation.this, findItem.getRelease_task_id());
+
+            initBottomCommentView();
+            if (article.getRelease_task_id() != 0) {//包含任务
+                taskHelper.initAcceptedTask(ActArticle.this, article.getRelease_task_id());
             }
-            if (findItem.getApplication_id() != 0) {//包含游戏
-                initFindApp(findItem.getApplication_id());
+            if (article.getApplication_id() != 0) {//包含游戏
+                initFindApp(article.getApplication_id());
             }
         } else {
             refresh.setRefreshing(false);
@@ -476,7 +499,7 @@ public class ActFindInformation extends BaseActivity implements Action1<Integer>
                 });
     }
 
-    private Article findItem;
+    private Article article;
 
     private void notifyDataSetChanged() {
         if (empty_view == null) {
@@ -671,7 +694,7 @@ public class ActFindInformation extends BaseActivity implements Action1<Integer>
 //            webView = null;
         }
         super.onDestroy();
-        ActFindInformation.this.finish();
+        ActArticle.this.finish();
     }
 
     @Override

+ 22 - 0
app/src/main/java/com/sheep/gamegroup/view/activity/ActArticleComment.java

@@ -0,0 +1,22 @@
+package com.sheep.gamegroup.view.activity;
+
+import android.support.v4.app.Fragment;
+
+import com.sheep.gamegroup.absBase.BaseContainerActivity;
+import com.sheep.gamegroup.util.DataUtil;
+import com.sheep.gamegroup.view.fragment.FgtArticleComment;
+
+/**
+ * Created by realicing on 2018/11/7.
+ * realicing@sina.com
+ * 游戏资讯的评论列表界面
+ */
+public class ActArticleComment extends BaseContainerActivity {
+    @Override
+    protected Fragment initFragment() {
+        int article_id = DataUtil.getObject(getIntent(), Integer.class);
+        FgtArticleComment fragment = new FgtArticleComment();
+        fragment.setArticle_id(article_id);
+        return fragment;
+    }
+}

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

@@ -57,11 +57,10 @@ public class ActCommentGameApp extends BaseActivity {
             return;
         }
         ApiJSONUtil.postGameUserUserGameComment(ApiJSONUtil.COMMENT_TYPE_GAME, game_id, content, score)
-                .subscribeOn(Schedulers.io())
-                .observeOn(AndroidSchedulers.mainThread())
                 .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
                     @Override
                     public void onNext(BaseMessage baseMessage) {
+                        act_comment_game_app_input_comment.setText("");
                         G.showToast(baseMessage);
                         finish();
                     }

+ 64 - 0
app/src/main/java/com/sheep/gamegroup/view/adapter/AdpArticleComment.java

@@ -0,0 +1,64 @@
+package com.sheep.gamegroup.view.adapter;
+
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.chad.library.adapter.base.BaseQuickAdapter;
+import com.chad.library.adapter.base.BaseViewHolder;
+import com.sheep.gamegroup.model.entity.UserComment;
+import com.sheep.gamegroup.util.ActivityManager;
+import com.sheep.gamegroup.util.Jump2View;
+import com.sheep.gamegroup.util.TextViewUtil;
+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
+ * 游戏资讯评论 adapter
+ */
+public class AdpArticleComment extends BaseQuickAdapter<UserComment, BaseViewHolder> {
+    public AdpArticleComment(List<UserComment> list) {
+        super(R.layout.item_article_comment, list);
+    }
+
+    @Override
+    protected void convert(BaseViewHolder helper, final UserComment item) {
+        int position = helper.getAdapterPosition() - getHeaderLayoutCount();
+        ImageView article_comment_user_avatar = helper.itemView.findViewById(R.id.article_comment_user_avatar);
+        TextView article_comment_user_name = helper.itemView.findViewById(R.id.article_comment_user_name);
+        TextView article_comment_num1 = helper.itemView.findViewById(R.id.article_comment_num1);
+        TextView article_comment_num2 = helper.itemView.findViewById(R.id.article_comment_num2);
+        TextView article_comment_num3 = helper.itemView.findViewById(R.id.article_comment_num3);
+        View article_comment_line_top = helper.itemView.findViewById(R.id.article_comment_line_top);
+        ViewUtil.setVisibility(article_comment_line_top, position != 0);
+        if(item == null){
+            return;
+        }
+        ViewUtil.setAvatar(article_comment_user_avatar, item.getAvatar());
+        ViewUtil.setText(article_comment_num1, item.getComment());
+        ViewUtil.setText(article_comment_num2, item.getLike());
+        ViewUtil.setText(article_comment_num3, item.getExpression());
+        ViewUtil.setText(article_comment_user_name, item.getNickname());
+        //String.format(Locale.CHINA, "%d %d %d %d", position, helper.getAdapterPosition(), helper.getLayoutPosition(), helper.getOldPosition()));
+        TextViewUtil.initIntroView(helper.itemView, item.getShowAll());
+
+        article_comment_num1.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                //跳转评论详情界面
+                Jump2View.getInstance().goActAppCommentDetail(ActivityManager.getInstance().currentActivity(), item.getId());
+            }
+        });
+        article_comment_user_avatar.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                //跳转个人游戏主页界面
+                Jump2View.getInstance().goActUserAppHome(ActivityManager.getInstance().currentActivity(), item.getUser_id());
+            }
+        });
+    }
+}

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

@@ -71,7 +71,7 @@ public class AdpGameCenter1_2List extends RecyclerViewAdapter<ListTypeList<GameR
                     holder.itemView.setOnClickListener(new View.OnClickListener() {
                         @Override
                         public void onClick(View view) {
-                            Jump2View.getInstance().goPlayGameDetail((Activity) context, item.getAppId());
+                            Jump2View.getInstance().goPlayGameDetail((Activity) mContext, item.getAppId());
                         }
                     });
                 }

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

@@ -116,7 +116,7 @@ public abstract class BaseListFragment3<T> extends BaseRefreshLoadMoreFragment{
         final String urlKey = getKey(page, per_page);
         if (isFirstGetACache()) {
             //先尝试获取缓存数据
-            lastCacheList = DataUtil.getInstance().getCacheList(urlKey, getTClass(), conversion);
+            lastCacheList = DataUtil.getInstance().getCacheList(urlKey, getTClass(), conversion, page);
             loadList(lastCacheList);
         }
         SysAppUtil.checkNet(new Action1<Integer>() {

+ 148 - 0
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtArticleComment.java

@@ -0,0 +1,148 @@
+package com.sheep.gamegroup.view.fragment;
+
+import android.support.annotation.NonNull;
+import android.support.v7.widget.RecyclerView;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.EditText;
+import android.widget.RelativeLayout;
+
+import com.scwang.smartrefresh.layout.SmartRefreshLayout;
+import com.scwang.smartrefresh.layout.api.RefreshLayout;
+import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
+import com.sheep.gamegroup.model.api.ApiService;
+import com.sheep.gamegroup.model.entity.BaseMessage;
+import com.sheep.gamegroup.model.entity.UserComment;
+import com.sheep.gamegroup.model.util.SheepSubscriber;
+import com.sheep.gamegroup.util.ApiJSONUtil;
+import com.sheep.gamegroup.util.RefreshUtil;
+import com.sheep.gamegroup.util.TestUtil;
+import com.sheep.gamegroup.view.adapter.AdpArticleComment;
+import com.sheep.jiuyan.samllsheep.R;
+import com.sheep.jiuyan.samllsheep.SheepApp;
+import com.sheep.jiuyan.samllsheep.utils.G;
+import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
+
+import java.util.Locale;
+
+import butterknife.BindView;
+import rx.Observable;
+
+/**
+ * Created by realicing on 2018/11/2.
+ * realicing@sina.com
+ * 用户评论详情界面
+ */
+public class FgtArticleComment extends BaseListFragment3<UserComment> {
+
+    @Override
+    public int getLayoutId() {
+        return R.layout.net_empty_smart_refresh_rv;
+    }
+
+    @BindView(R.id.refresh)
+    SmartRefreshLayout refresh;
+    @BindView(R.id.bottom)
+    RelativeLayout bottom;
+    //输入框
+    private EditText input_comment_input;
+
+    @Override
+    public void initView() {
+        TitleBarUtils.getInstance().setTitle(mView, "评论")
+                .setTitleFinish(mView, activity);
+        smartRefreshLayout = refresh;
+        refresh.setOnRefreshLoadMoreListener(new OnRefreshLoadMoreListener() {
+            @Override
+            public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
+                loadMoreData();
+            }
+
+            @Override
+            public void onRefresh(@NonNull RefreshLayout refreshLayout) {
+                refreshData();
+            }
+        });
+        RefreshUtil.newInstance().publicParameterLoadMore(refresh, activity);
+
+        //头部view
+        initHeaderView();
+        //底部可发表评论
+        LayoutInflater.from(SheepApp.getInstance()).inflate(R.layout.include_input_comment, bottom);
+        input_comment_input = bottom.findViewById(R.id.input_comment_input);
+        bottom.findViewById(R.id.input_comment_commit).setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                String content = input_comment_input.getText().toString();
+                commitContent(content);
+            }
+        });
+
+    }
+
+    //用户评论一个用户对游戏的评论
+    private void commitContent(String content) {
+        if (TestUtil.isDev()) G.showToast("评论内容:" + content);
+        if (content.isEmpty()) {
+            G.showToast("评论内容不能为空");
+            return;
+        }
+        // 发表评论
+        ApiJSONUtil.postGameUserUserGameComment(ApiJSONUtil.COMMENT_TYPE_ARTICLE, article_id, content, 0)
+                .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
+                    @Override
+                    public void onNext(BaseMessage baseMessage) {
+                        input_comment_input.setText("");
+                        refreshData();
+                        G.showToast(baseMessage);
+                    }
+
+                    @Override
+                    public void onError(BaseMessage baseMessage) {
+                        G.showToast(baseMessage);
+                    }
+                });
+    }
+
+    //    ------------------------------start header------------------------------------
+    private View headerView;
+
+    //初始化headerView
+    private void initHeaderView() {
+        headerView = LayoutInflater.from(SheepApp.getInstance()).inflate(R.layout.include_line_title_more, null);
+    }
+
+    //    ------------------------------end header------------------------------------
+
+    private int article_id;
+
+    public void setArticle_id(int article_id) {
+        this.article_id = article_id;
+    }
+
+    @Override
+    protected RecyclerView.Adapter getAdapter() {
+        //用户评论的回复列表
+        AdpArticleComment adapter = new AdpArticleComment(list);
+        adapter.addHeaderView(headerView);
+        return adapter;
+    }
+
+    @Override
+    protected String getKey(int page, int per_page) {
+        return String.format(Locale.CHINA, "app/game_user/app_comment_list?page_no=%d&page_size=%d&app_id=%d&comment_type=%d", page, per_page, article_id, ApiJSONUtil.COMMENT_TYPE_ARTICLE);
+    }
+
+    @Override
+    protected Observable<BaseMessage> getApi(ApiService apiService) {
+        return apiService.getGameUserAppCommentList(page, per_page, article_id, ApiJSONUtil.COMMENT_TYPE_ARTICLE);
+    }
+
+
+    @Override
+    protected Class<UserComment> getTClass() {
+        return UserComment.class;
+    }
+
+
+}

+ 49 - 35
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtUserCommentDetail.java

@@ -14,7 +14,6 @@ import com.scwang.smartrefresh.layout.api.RefreshLayout;
 import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
 import com.sheep.gamegroup.model.api.ApiService;
 import com.sheep.gamegroup.model.entity.BaseMessage;
-import com.sheep.gamegroup.model.entity.UserComment;
 import com.sheep.gamegroup.model.entity.UserCommentDetail;
 import com.sheep.gamegroup.model.entity.UserCommentReply;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
@@ -55,6 +54,8 @@ public class FgtUserCommentDetail extends BaseListFragment3<UserCommentReply> {
     SmartRefreshLayout refresh;
     @BindView(R.id.bottom)
     RelativeLayout bottom;
+    //输入框
+    private EditText input_comment_input;
 
     @Override
     public void initView() {
@@ -80,34 +81,17 @@ public class FgtUserCommentDetail extends BaseListFragment3<UserCommentReply> {
         //尾部,在无数据时显示
         footerView = LayoutInflater.from(SheepApp.getInstance()).inflate(R.layout.footer_user_comment_detail, null);
         //底部可发表评论
-        LayoutInflater.from(SheepApp.getInstance()).inflate(R.layout.bottom_user_comment_detail, bottom);
-        bottom_user_comment_detail_input = bottom.findViewById(R.id.bottom_user_comment_detail_input);
-        bottom.findViewById(R.id.bottom_user_comment_detail_commit).setOnClickListener(new View.OnClickListener() {
+        LayoutInflater.from(SheepApp.getInstance()).inflate(R.layout.include_input_comment, bottom);
+        input_comment_input = bottom.findViewById(R.id.input_comment_input);
+        bottom.findViewById(R.id.input_comment_commit).setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View view) {
-                String content = bottom_user_comment_detail_input.getText().toString();
+                String content = input_comment_input.getText().toString();
                 commitContent(content);
             }
         });
 
     }
-
-    //    ------------------------------start header------------------------------------
-    private UserCommentHelper headerViewHelper;
-
-    private LinearLayout user_comment_detail_game_ll;
-    private TextView total_count_tv;
-    //初始化headerView
-    private void initHeaderView() {
-        headerViewHelper = new UserCommentHelper(R.layout.header_user_comment_detail);
-        total_count_tv = headerViewHelper.getRootView().findViewById(R.id.total_count_tv);
-        user_comment_detail_game_ll = headerViewHelper.getRootView().findViewById(R.id.user_comment_detail_game_ll);
-        if(total_count_tv != null){
-            ViewUtil.setText(total_count_tv, getString(R.string.total_x_comment, ViewUtil.BLOCK));
-        }
-    }
-
-    //    ------------------------------end header------------------------------------
     //用户评论一个用户对游戏的评论
     private void commitContent(String content) {
         if (TestUtil.isDev()) G.showToast("评论内容:" + content);
@@ -122,6 +106,8 @@ public class FgtUserCommentDetail extends BaseListFragment3<UserCommentReply> {
                 .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
                     @Override
                     public void onNext(BaseMessage baseMessage) {
+                        input_comment_input.setText("");
+                        refreshData();
                         G.showToast(baseMessage);
                     }
 
@@ -132,8 +118,30 @@ public class FgtUserCommentDetail extends BaseListFragment3<UserCommentReply> {
                 });
     }
 
-    //输入框
-    private EditText bottom_user_comment_detail_input;
+    //    ------------------------------start header------------------------------------
+    private UserCommentHelper headerViewHelper;
+
+    private LinearLayout user_comment_detail_game_ll;
+    private View user_comment_detail_line1;
+    private View user_comment_detail_line2;
+    private TextView total_count_tv;
+    //初始化headerView
+    private void initHeaderView() {
+        headerViewHelper = new UserCommentHelper(R.layout.header_user_comment_detail);
+        total_count_tv = headerViewHelper.getRootView().findViewById(R.id.total_count_tv);
+        user_comment_detail_game_ll = headerViewHelper.getRootView().findViewById(R.id.user_comment_detail_game_ll);
+        user_comment_detail_line1 = headerViewHelper.getRootView().findViewById(R.id.user_comment_detail_line1);
+        user_comment_detail_line2 = headerViewHelper.getRootView().findViewById(R.id.user_comment_detail_line2);
+        headerViewHelper.getUser_comment_detail_user_publish_score().setVisibility(View.GONE);
+        user_comment_detail_game_ll.setVisibility(View.GONE);
+        user_comment_detail_line1.setVisibility(View.GONE);
+        user_comment_detail_line2.setVisibility(View.GONE);
+        if(total_count_tv != null){
+            ViewUtil.setText(total_count_tv, getString(R.string.total_x_comment, ViewUtil.BLOCK));
+        }
+    }
+
+    //    ------------------------------end header------------------------------------
 
     private View footerView;
 
@@ -171,19 +179,25 @@ public class FgtUserCommentDetail extends BaseListFragment3<UserCommentReply> {
     @Override
     protected List<UserCommentReply> resolveData(BaseMessage baseMessage, int page) {
         final UserCommentDetail userCommentDetail = baseMessage.getData(UserCommentDetail.class);
-        if (page == 0 && userCommentDetail != null) {
+        if (page == 1 && userCommentDetail != null) {//第一页才有下面的数据
             adapter.setUserComment(userCommentDetail.getUser_comment());
             headerViewHelper.loadHeaderViewData(userCommentDetail.getUser_comment());
-            user_comment_detail_game_ll.setOnClickListener(new View.OnClickListener() {
-                @Override
-                public void onClick(View view) {
-                    //点击游戏
-                    if(userCommentDetail.getUser_comment() != null)
-                        Jump2View.getInstance().goPlayGameDetail(activity, userCommentDetail.getUser_comment().getApp_id());
-                    else
-                        G.showToast(R.string.loading_data);
-                }
-            });
+            if(!userCommentDetail.getUser_comment().isArticleUserComment()){
+                headerViewHelper.getUser_comment_detail_user_publish_score().setVisibility(View.VISIBLE);
+                user_comment_detail_game_ll.setVisibility(View.VISIBLE);
+                user_comment_detail_line1.setVisibility(View.VISIBLE);
+                user_comment_detail_line2.setVisibility(View.VISIBLE);
+                user_comment_detail_game_ll.setOnClickListener(new View.OnClickListener() {
+                    @Override
+                    public void onClick(View view) {
+                        //点击游戏
+                        if (userCommentDetail.getUser_comment() != null)
+                            Jump2View.getInstance().goPlayGameDetail(activity, userCommentDetail.getUser_comment().getApp_id());
+                        else
+                            G.showToast(R.string.loading_data);
+                    }
+                });
+            }
             ViewUtil.setText(total_count_tv, getString(R.string.total_x_comment, String.valueOf(userCommentDetail.getUser_comment_reply().getTotal())));
         }
         if (userCommentDetail != null && userCommentDetail.getUser_comment_reply() != null && userCommentDetail.getUser_comment_reply().getReply_list() != null)

+ 3 - 2
app/src/main/res/layout/act_gc_game_app_detail.xml

@@ -10,8 +10,7 @@
     <com.scwang.smartrefresh.layout.SmartRefreshLayout
         android:id="@+id/refresh"
         android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:layout_marginBottom="61dp">
+        android:layout_height="match_parent">
 
         <android.support.v4.widget.NestedScrollView
             android:layout_width="match_parent"
@@ -157,6 +156,7 @@
         android:layout_height="1dp"
         android:layout_marginBottom="60dp"
         android:layout_alignParentBottom="true"
+        android:visibility="gone"
         android:background="#e5e5e5" />
 
     <TextView
@@ -165,6 +165,7 @@
         android:layout_width="match_parent"
         android:layout_alignParentBottom="true"
         android:onClick="onClickDownloadReceiveWelfare"
+        android:visibility="gone"
         android:text="下载领取福利" />
 
     <com.kfzs.duanduan.view.DragRelativeLayout

+ 2 - 0
app/src/main/res/layout/header_user_comment_detail.xml

@@ -6,6 +6,7 @@
     android:orientation="vertical">
 
     <View
+        android:id="@+id/user_comment_detail_line1"
         android:layout_width="match_parent"
         android:layout_height="10dp"
         android:background="#f5f5f5" />
@@ -45,6 +46,7 @@
     </LinearLayout>
 
     <View
+        android:id="@+id/user_comment_detail_line2"
         android:layout_width="match_parent"
         android:layout_height="10dp"
         android:background="#f5f5f5" />

+ 5 - 4
app/src/main/res/layout/bottom_user_comment_detail.xml

@@ -1,7 +1,8 @@
 <?xml version="1.0" encoding="utf-8"?>
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
-    android:layout_height="wrap_content">
+    android:layout_height="wrap_content"
+    android:background="@color/white">
 
     <View
         android:layout_width="match_parent"
@@ -9,7 +10,7 @@
         android:background="#fff2f2f2" />
 
     <TextView
-        android:id="@+id/bottom_user_comment_detail_commit"
+        android:id="@+id/input_comment_commit"
         android:layout_width="60dp"
         android:layout_height="26dp"
         android:layout_alignParentEnd="true"
@@ -23,7 +24,7 @@
         android:textSize="13sp" />
 
     <EditText
-        android:id="@+id/bottom_user_comment_detail_input"
+        android:id="@+id/input_comment_input"
         android:layout_width="match_parent"
         android:layout_height="30dp"
         android:layout_marginStart="15dp"
@@ -31,7 +32,7 @@
         android:layout_marginEnd="9dp"
         android:layout_marginBottom="8dp"
         android:maxLength="100"
-        android:layout_toStartOf="@id/bottom_user_comment_detail_commit"
+        android:layout_toStartOf="@id/input_comment_commit"
         android:background="@drawable/shape_f5_solid_rectangle_15"
         android:gravity="center|start"
         android:hint="输入优质评论哦~"

+ 15 - 0
app/src/main/res/layout/include_line_title_more.xml

@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    style="@style/style_wc_rl">
+
+    <TextView
+        android:id="@+id/line_title_tv"
+        style="@style/style_wc_line_title"
+        android:text="用户评价" />
+
+    <TextView
+        android:id="@+id/more_tv"
+        style="@style/style_wc_more"
+        android:text="更多"
+        android:visibility="invisible" />
+</RelativeLayout>

+ 120 - 0
app/src/main/res/layout/item_article_comment.xml

@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content">
+
+    <View
+        android:id="@+id/article_comment_line_top"
+        android:layout_width="match_parent"
+        android:layout_height="1dp"
+        android:layout_marginStart="25dp"
+        android:layout_marginEnd="25dp"
+        android:background="#fff2f2f2"
+        app:layout_constraintTop_toTopOf="parent" />
+
+    <ImageView
+        android:id="@+id/article_comment_user_avatar"
+        android:layout_width="33dp"
+        android:layout_height="33dp"
+        android:layout_marginStart="16dp"
+        android:layout_marginTop="20dp"
+        android:src="@drawable/icon"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="@id/article_comment_line_top" />
+
+    <TextView
+        android:id="@+id/article_comment_user_name"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="16dp"
+        android:layout_marginEnd="16dp"
+        android:text="栗子的菜"
+        android:textColor="#ff333333"
+        android:textSize="13sp"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toEndOf="@id/article_comment_user_avatar"
+        app:layout_constraintTop_toTopOf="@id/article_comment_user_avatar"
+        app:layout_constraintBottom_toBottomOf="@id/article_comment_user_avatar"/>
+
+    <TextView
+        android:id="@+id/intro_content"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:ellipsize="end"
+        android:lineSpacingMultiplier="1.3"
+        android:maxLines="3"
+        android:paddingStart="16dp"
+        android:paddingTop="13dp"
+        android:paddingEnd="16dp"
+        android:paddingBottom="10dp"
+        android:text="《永恒仙域》经典仙侠梦想,高清3DMMORPG手游,继承同类型游戏的经典游戏模式,更加酷炫的游戏画面与动作特效,精心构建出这个瑰丽的东方式仙侠世界。《永恒仙域》经典仙侠梦想,高清3DMMORPG手游,继承同类型游戏的经典游戏模式,更加酷炫的游戏画面与动作特效,精心构建出这个瑰丽的东方式仙侠世界。"
+        android:textColor="#ff666666"
+        android:textSize="12sp"
+        app:layout_constraintTop_toBottomOf="@id/article_comment_user_avatar" />
+
+    <TextView
+        android:id="@+id/intro_show_all"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:padding="6dp"
+        android:text="显示全部"
+        android:textColor="#ff4bc1ff"
+        android:textSize="12sp"
+        android:visibility="gone"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@id/intro_content" />
+
+    <TextView
+        android:id="@+id/article_comment_num1"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginEnd="10dp"
+        android:layout_marginBottom="6dp"
+        android:drawableStart="@drawable/ic_but_speak"
+        android:drawablePadding="6dp"
+        android:paddingStart="8dp"
+        android:paddingTop="14dp"
+        android:paddingEnd="8dp"
+        android:paddingBottom="14dp"
+        android:text="54"
+        android:textColor="#ff666666"
+        android:textSize="11sp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintTop_toBottomOf="@id/intro_show_all" />
+
+    <TextView
+        android:id="@+id/article_comment_num2"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:drawableStart="@drawable/ic_but_up"
+        android:drawablePadding="6dp"
+        android:paddingStart="8dp"
+        android:paddingTop="14dp"
+        android:paddingEnd="8dp"
+        android:paddingBottom="14dp"
+        android:text="54"
+        android:textColor="#ff666666"
+        android:textSize="11sp"
+        app:layout_constraintEnd_toStartOf="@id/article_comment_num1"
+        app:layout_constraintTop_toTopOf="@id/article_comment_num1" />
+
+    <TextView
+        android:id="@+id/article_comment_num3"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:drawableStart="@drawable/ic_image_xiao"
+        android:drawablePadding="6dp"
+        android:paddingStart="8dp"
+        android:paddingTop="14dp"
+        android:paddingEnd="8dp"
+        android:paddingBottom="14dp"
+        android:text="54"
+        android:textColor="#ff666666"
+        android:textSize="11sp"
+        app:layout_constraintEnd_toStartOf="@id/article_comment_num2"
+        app:layout_constraintTop_toTopOf="@id/article_comment_num1" />
+
+</android.support.constraint.ConstraintLayout>

+ 6 - 0
app/src/main/res/layout/net_empty_fresh_list.xml

@@ -21,10 +21,16 @@
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:layout_below="@+id/check_net_ll" />
+    <RelativeLayout
+        android:id="@+id/bottom"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_alignParentBottom="true" />
     <com.sheep.gamegroup.util.SheepSwipeRefreshLayout
         android:id="@+id/refresh"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
+        android:layout_above="@id/bottom"
         android:layout_below="@+id/check_net_ll" >
         <android.support.v7.widget.RecyclerView
             android:id="@+id/view_list"

+ 5 - 4
app/src/main/res/values/dd_styles.xml

@@ -403,15 +403,14 @@
     <style name="style_wc_rl">
         <item name="android:layout_width">match_parent</item>
         <item name="android:layout_height">wrap_content</item>
-        <item name="android:layout_marginEnd">15dp</item>
-        <item name="android:layout_marginStart">15dp</item>
-        <item name="android:layout_marginTop">18dp</item>
     </style>
     <!--福利中心中带线标题-->
     <style name="style_wc_line_title">
         <item name="android:layout_width">wrap_content</item>
         <item name="android:layout_height">wrap_content</item>
         <item name="android:drawablePadding">@dimen/content_padding_default</item>
+        <item name="android:paddingStart">15dp</item>
+        <item name="android:paddingTop">18dp</item>
         <item name="android:drawableStart">@drawable/sp_line_vertical</item>
         <item name="android:gravity">center_vertical</item>
         <item name="android:textColor">#2c2c2c</item>
@@ -422,8 +421,10 @@
         <item name="android:layout_width">wrap_content</item>
         <item name="android:layout_height">wrap_content</item>
         <item name="android:layout_alignParentEnd">true</item>
-        <item name="android:layout_centerVertical">true</item>
         <item name="android:drawableEnd">@mipmap/x_ic_next</item>
+        <item name="android:paddingStart">15dp</item>
+        <item name="android:paddingEnd">15dp</item>
+        <item name="android:paddingTop">21dp</item>
         <item name="android:drawablePadding">7dp</item>
         <item name="android:gravity">end</item>
         <item name="android:textColor">#666666</item>