Browse Source

修复点击评论会挂掉的bug;
优化重复点击点赞按钮效果

zengjiebin 7 years ago
parent
commit
64d82414bd

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

@@ -2338,11 +2338,11 @@ public class Jump2View {
     /**
      * 跳转游戏评论详情界面
      *
-     * @param context
      * @param user_comment_id
      */
-    public void goActAppCommentDetail(Context context, int user_comment_id) {
-        context.startActivity(DataUtil.putObject(new Intent(context, ActUserCommentDetail.class), user_comment_id));
+    public void goActAppCommentDetail(int user_comment_id) {
+        Activity activity = SheepApp.getInstance().getCurrentActivity();
+        activity.startActivity(DataUtil.putObject(new Intent(activity, ActUserCommentDetail.class), user_comment_id));
     }
 
     /**

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

@@ -1306,6 +1306,7 @@ public class ViewUtil {
                 }
             });
         }
+        dialog.setCancelable(false);
         try {
             dialog.show();
         } catch (Exception e) {

+ 14 - 6
app/src/main/java/com/sheep/gamegroup/util/viewHelper/UserCommentHelper.java

@@ -25,6 +25,7 @@ import com.sheep.jiuyan.samllsheep.utils.G;
  */
 public class UserCommentHelper {
     protected View rootView;
+    protected boolean goComment = true;//是否 点击评论图标后可以跳转到评论详情界面
 
     public UserCommentHelper(int rootViewId) {
         this.rootView = LayoutInflater.from(SheepApp.getInstance()).inflate(rootViewId, null);
@@ -36,6 +37,11 @@ public class UserCommentHelper {
         initView();
     }
 
+    public UserCommentHelper setGoComment(boolean goComment) {
+        this.goComment = goComment;
+        return this;
+    }
+
     public View getRootView() {
         return rootView;
     }
@@ -81,12 +87,14 @@ public class UserCommentHelper {
                 Jump2View.getInstance().goActUserAppHome(rootView.getContext(), item.getUser_id());
             }
         });
-        user_comment_detail_num1.setOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View view) {
-                Jump2View.getInstance().goActAppCommentDetail(view.getContext(), item.getId());
-            }
-        });
+        if(goComment){
+            user_comment_detail_num1.setOnClickListener(new View.OnClickListener() {
+                @Override
+                public void onClick(View view) {
+                    Jump2View.getInstance().goActAppCommentDetail(item.getId());
+                }
+            });
+        }
         user_comment_detail_num2.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View view) {

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

@@ -71,7 +71,7 @@ public class AdpArticleComment extends BaseQuickAdapter<UserComment, BaseViewHol
                 @Override
                 public void onClick(View view) {
                     //跳转评论详情界面
-                    Jump2View.getInstance().goActAppCommentDetail(view.getContext(), item.getId());
+                    Jump2View.getInstance().goActAppCommentDetail(item.getId());
                 }
             });
         }

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

@@ -62,7 +62,7 @@ public class AdpGcGameAppComment extends BaseQuickAdapter<UserComment, BaseViewH
             @Override
             public void onClick(View view) {
                 //跳转游戏评论详情界面
-                Jump2View.getInstance().goActAppCommentDetail(view.getContext(), item.getId());
+                Jump2View.getInstance().goActAppCommentDetail(item.getId());
             }
         });
         game_app_comment_user_avatar.setOnClickListener(new View.OnClickListener() {

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

@@ -3,8 +3,6 @@ package com.sheep.gamegroup.view.fragment;
 import android.content.DialogInterface;
 import android.support.annotation.NonNull;
 import android.support.v7.widget.RecyclerView;
-import android.text.TextUtils;
-import android.view.KeyEvent;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.widget.EditText;
@@ -25,7 +23,6 @@ import com.sheep.gamegroup.model.entity.UserCommentReply;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
 import com.sheep.gamegroup.util.ApiJSONUtil;
 import com.sheep.gamegroup.util.Jump2View;
-import com.sheep.gamegroup.util.KeyEventUtil;
 import com.sheep.gamegroup.util.ListUtil;
 import com.sheep.gamegroup.util.RefreshUtil;
 import com.sheep.gamegroup.util.TestUtil;
@@ -169,7 +166,7 @@ public class FgtUserCommentDetail extends BaseListFragment3<UserCommentReply> im
 
     //初始化headerView
     private void initHeaderView() {
-        headerViewHelper = new UserCommentHelper(R.layout.header_user_comment_detail);
+        headerViewHelper = new UserCommentHelper(R.layout.header_user_comment_detail).setGoComment(false);
         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);