Преглед изворни кода

修复加载皮肤后,底部评论输入框无法输入内容的兼容性问题

zengjiebin пре 7 година
родитељ
комит
36f1d83d71

+ 7 - 25
app/src/main/java/com/sheep/gamegroup/view/activity/ActCommentGameApp.java

@@ -47,27 +47,12 @@ public class ActCommentGameApp extends BaseActivity {
         TitleBarUtils.getInstance()
                 .setShowOrHide(this, true)
                 .setTitle(this, "写评价")
-                .setEndTv(this, "发表", 0xFF2EBEF2, new View.OnClickListener() {
-                    @Override
-                    public void onClick(View view) {
-                        int progress = act_comment_game_app_score.getProgress();
-                        String content = act_comment_game_app_input_comment.getText().toString();
-                        commitUserGameComment(progress, content);
-                    }
+                .setEndTv(this, "发表", 0xFF2EBEF2, view -> {
+                    int progress = act_comment_game_app_score.getProgress();
+                    String content = act_comment_game_app_input_comment.getText().toString();
+                    commitUserGameComment(progress, content);
                 })
                 .setTitleFinish(this);
-//
-//        Observable.just(1).delay(100L, TimeUnit.MILLISECONDS)
-//                .subscribeOn(Schedulers.io())
-//                .observeOn(AndroidSchedulers.mainThread())
-//                .subscribe(new Action1<Integer>() {
-//                    @Override
-//                    public void call(Integer integer) {
-//                        act_comment_game_app_input_comment.setFocusable(true);
-//                        act_comment_game_app_input_comment.setFocusableInTouchMode(true);
-//                        act_comment_game_app_input_comment.requestFocus();
-//                    }
-//                });
     }
 
     //评论游戏
@@ -86,12 +71,9 @@ public class ActCommentGameApp extends BaseActivity {
                     @Override
                     public void onNext(BaseMessage baseMessage) {
                         act_comment_game_app_input_comment.setText("");
-                        DialogSuccessUtil.showSuccess(ActCommentGameApp.this, "发表成功", new DialogInterface.OnDismissListener() {
-                            @Override
-                            public void onDismiss(DialogInterface dialogInterface) {
-                                setResult(RESULT_OK);
-                                finish();
-                            }
+                        DialogSuccessUtil.showSuccess(ActCommentGameApp.this, "发表成功", dialogInterface -> {
+                            setResult(RESULT_OK);
+                            finish();
                         });
                     }
 

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

@@ -67,36 +67,30 @@ public class AdpArticleComment extends BaseQuickAdapter<UserComment, BaseViewHol
         TextViewUtil.initIntroView(helper.itemView, item.getShowAll());
         ViewUtil.setVisibility(article_comment_num1, hasCommentDetail);
         if(hasCommentDetail) {
-            article_comment_num1.setOnClickListener(new View.OnClickListener() {
-                @Override
-                public void onClick(View view) {
-                    //跳转评论详情界面
-                    Jump2View.getInstance().goActAppCommentDetail(item.getId());
-                }
+            article_comment_num1.setOnClickListener(view -> {
+                //跳转评论详情界面
+                Jump2View.getInstance().goActAppCommentDetail(item.getId());
             });
         }
 
-        article_comment_num2.setOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View view) {
-                ViewUtil.showUpGifDialog(SheepApp.getInstance().getCurrentActivity());
-                article_comment_num2.setEnabled(false);
-                ApiUtil.postGameUserUserGameCommentLike(item.getId(), new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
+        article_comment_num2.setOnClickListener(view -> {
+            ViewUtil.showUpGifDialog(SheepApp.getInstance().getCurrentActivity());
+            article_comment_num2.setEnabled(false);
+            ApiUtil.postGameUserUserGameCommentLike(item.getId(), new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
 
-                    @Override
-                    public void onNext(BaseMessage baseMessage) {
-                        G.showToast("操作成功");
-                        item.plusLike();
-                        ViewUtil.setText(article_comment_num2, item.getLike());
-                        article_comment_num2.setEnabled(true);
-                    }
-                    @Override
-                    public void onError(BaseMessage baseMessage) {
-                        G.showToast("操作失败");
-                        article_comment_num2.setEnabled(true);
-                    }
-                });
-            }
+                @Override
+                public void onNext(BaseMessage baseMessage) {
+                    G.showToast("操作成功");
+                    item.plusLike();
+                    ViewUtil.setText(article_comment_num2, item.getLike());
+                    article_comment_num2.setEnabled(true);
+                }
+                @Override
+                public void onError(BaseMessage baseMessage) {
+                    G.showToast("操作失败");
+                    article_comment_num2.setEnabled(true);
+                }
+            });
         });
         if(article_comment_num3 != null) {
             article_comment_num3.setOnClickListener(new View.OnClickListener() {

+ 6 - 9
app/src/main/java/com/sheep/gamegroup/view/dialog/DialogSuccessUtil.java

@@ -28,14 +28,11 @@ public class DialogSuccessUtil {
                 .create();
         TextView dialog_title = dialog_parent.findViewById(R.id.dialog_title);
         final View close = dialog_parent.findViewById(R.id.dialog_close);
-        close.setOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View view) {
-                try {
-                    dialog.dismiss();
-                } catch (Exception e) {
-                    e.printStackTrace();
-                }
+        close.setOnClickListener(view -> {
+            try {
+                dialog.dismiss();
+            } catch (Exception e) {
+                e.printStackTrace();
             }
         });
         dialog_title.setText(msg);
@@ -47,7 +44,7 @@ public class DialogSuccessUtil {
         }
 
         //3秒后自动消失
-        Observable.just(1).delay(3, TimeUnit.SECONDS)
+        Observable.just(1).delay(1, TimeUnit.SECONDS)
                 .subscribeOn(Schedulers.io())
                 .observeOn(AndroidSchedulers.mainThread())
                 .subscribe(new AbsObserver<Integer>() {

+ 12 - 25
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtArticleComment.java

@@ -1,6 +1,5 @@
 package com.sheep.gamegroup.view.fragment;
 
-import android.app.Activity;
 import android.content.DialogInterface;
 import android.content.Intent;
 import android.support.annotation.NonNull;
@@ -8,7 +7,6 @@ import android.support.v7.widget.RecyclerView;
 import android.text.TextUtils;
 import android.view.LayoutInflater;
 import android.view.View;
-import android.view.ViewGroup;
 import android.webkit.WebView;
 import android.widget.EditText;
 import android.widget.ImageView;
@@ -75,7 +73,7 @@ public class FgtArticleComment extends BaseListFragment3<UserComment> implements
 
     @Override
     public int getLayoutId() {
-        return R.layout.net_empty_smart_refresh_rv;
+        return R.layout.net_empty_smart_refresh_rv_input;
     }
 
     @BindView(R.id.refresh)
@@ -95,15 +93,12 @@ public class FgtArticleComment extends BaseListFragment3<UserComment> implements
         TitleBarUtils.getInstance().setTitle(getActivity(), "详情")
                 .setTitleFinish(getActivity())
                 .setShowOrHide(getActivity(), true)
-                .setRightImgBotton(getActivity(), R.mipmap.share, new View.OnClickListener() {
-                    @Override
-                    public void onClick(View view) {
-                        FIND_SHARE.onEvent("find_id", article_id);
-                        if (article == null) {
-                            Jump2View.getInstance().tryShare(activity, "find_share_url", "find_id", article_id);
-                        } else {
-                            Jump2View.getInstance().tryShare(activity, "find_share_url", "find_id", article_id, article.getTitle());
-                        }
+                .setRightImgBotton(getActivity(), R.mipmap.share, view -> {
+                    FIND_SHARE.onEvent("find_id", article_id);
+                    if (article == null) {
+                        Jump2View.getInstance().tryShare(activity, "find_share_url", "find_id", article_id);
+                    } else {
+                        Jump2View.getInstance().tryShare(activity, "find_share_url", "find_id", article_id, article.getTitle());
                     }
                 });
         smartRefreshLayout = refresh;
@@ -123,14 +118,11 @@ public class FgtArticleComment extends BaseListFragment3<UserComment> implements
         //头部view
         initHeaderView();
         //底部可发表评论
-        LayoutInflater.from(SheepApp.getInstance()).inflate(R.layout.include_input_comment, bottom);
+//        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);
-            }
+        bottom.findViewById(R.id.input_comment_commit).setOnClickListener(view -> {
+            String content = input_comment_input.getText().toString();
+            commitContent(content);
         });
         EventBus.getDefault().register(this);
 
@@ -158,12 +150,7 @@ public class FgtArticleComment extends BaseListFragment3<UserComment> implements
                     @Override
                     public void onNext(BaseMessage baseMessage) {
                         input_comment_input.setText("");
-                        DialogSuccessUtil.showSuccess(getContext(), "发表成功", new DialogInterface.OnDismissListener() {
-                            @Override
-                            public void onDismiss(DialogInterface dialogInterface) {
-                                refreshData();
-                            }
-                        });
+                        DialogSuccessUtil.showSuccess(getContext(), "发表成功", dialogInterface -> refreshData());
                         JSONObject json = new JSONObject();
                         json.put("act", 7);
                         SheepApp.getInstance().getNetComponent().getApiService()

+ 8 - 23
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtUserCommentDetail.java

@@ -1,6 +1,5 @@
 package com.sheep.gamegroup.view.fragment;
 
-import android.content.DialogInterface;
 import android.support.annotation.NonNull;
 import android.support.v7.widget.RecyclerView;
 import android.view.LayoutInflater;
@@ -41,8 +40,8 @@ import java.util.Locale;
 import butterknife.BindView;
 import io.reactivex.Observable;
 import io.reactivex.android.schedulers.AndroidSchedulers;
-import rx.functions.Action1;
 import io.reactivex.schedulers.Schedulers;
+import rx.functions.Action1;
 
 /**
  * Created by realicing on 2018/11/2.
@@ -53,7 +52,7 @@ public class FgtUserCommentDetail extends BaseListFragment3<UserCommentReply> im
 
     @Override
     public int getLayoutId() {
-        return R.layout.net_empty_smart_refresh_rv_exp;
+        return R.layout.net_empty_smart_refresh_rv_exp_input;
     }
 
     @BindView(R.id.refresh)
@@ -99,23 +98,14 @@ public class FgtUserCommentDetail extends BaseListFragment3<UserCommentReply> im
         //尾部,在无数据时显示
         footerView = LayoutInflater.from(SheepApp.getInstance()).inflate(R.layout.footer_user_comment_detail, null);
         //底部可发表评论
-        LayoutInflater.from(SheepApp.getInstance()).inflate(R.layout.include_input_comment_exp, bottom);
+//        LayoutInflater.from(SheepApp.getInstance()).inflate(R.layout.include_input_comment_exp, bottom);
         input_comment_reply = bottom.findViewById(R.id.input_comment_reply);
         input_comment_input = bottom.findViewById(R.id.input_comment_input);
         input_comment_exp = bottom.findViewById(R.id.input_comment_exp);
-        input_comment_reply.setOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View view) {
-                call(getUserCommentReply());
-            }
-        });
-        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);
-            }
+        input_comment_reply.setOnClickListener(view -> call(getUserCommentReply()));
+        bottom.findViewById(R.id.input_comment_commit).setOnClickListener(view -> {
+            String content = input_comment_input.getText().toString();
+            commitContent(content);
         });
         //初始化 表情键盘协调工具
         initEmotionKeyboard();
@@ -141,12 +131,7 @@ public class FgtUserCommentDetail extends BaseListFragment3<UserCommentReply> im
                     @Override
                     public void onNext(BaseMessage baseMessage) {
                         input_comment_input.setText("");
-                        DialogSuccessUtil.showSuccess(getContext(),"发表成功", new DialogInterface.OnDismissListener() {
-                            @Override
-                            public void onDismiss(DialogInterface dialogInterface) {
-                                refreshData();
-                            }
-                        });
+                        DialogSuccessUtil.showSuccess(getContext(),"发表成功", dialogInterface -> refreshData());
                     }
 
                     @Override

+ 4 - 3
app/src/main/res/layout/net_empty_smart_refresh_rv_exp.xml

@@ -24,10 +24,11 @@
             layout="@layout/empty_view"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
-            android:layout_below="@+id/check_net_ll" />
+            android:layout_below="@id/check_net_ll" />
 
-        <RelativeLayout
+        <include
             android:id="@+id/bottom"
+            layout="@layout/include_input_comment_exp"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_alignParentBottom="true" />
@@ -37,7 +38,7 @@
             android:layout_width="match_parent"
             android:layout_height="match_parent"
             android:layout_above="@id/bottom"
-            android:layout_below="@+id/check_net_ll">
+            android:layout_below="@id/check_net_ll">
 
             <android.support.v7.widget.RecyclerView
                 android:id="@+id/view_list"

+ 3 - 3
app/src/main/res/layout/net_empty_smart_refresh_rv.xml

@@ -9,8 +9,7 @@
         android:id="@+id/check_net_ll"
         layout="@layout/check_net_view"
         android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_below="@+id/title" />
+        android:layout_height="wrap_content" />
 
     <include
         android:id="@+id/empty_view"
@@ -20,8 +19,9 @@
         android:visibility="gone"
         android:layout_below="@+id/check_net_ll" />
 
-    <RelativeLayout
+    <include
         android:id="@+id/bottom"
+        layout="@layout/include_input_comment"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_alignParentBottom="true" />