Skip to content

Commit f96ffd4

Browse files
committed
评论列表独立一个Activity
1 parent 8134a69 commit f96ffd4

File tree

5 files changed

+33
-39
lines changed

5 files changed

+33
-39
lines changed

app/src/main/java/com/rae/cnblogs/activity/BlogContentActivity.java

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,14 @@
1515
import com.rae.cnblogs.dialog.DialogProvider;
1616
import com.rae.cnblogs.dialog.IAppDialog;
1717
import com.rae.cnblogs.dialog.impl.BlogShareDialog;
18-
import com.rae.cnblogs.fragment.BlogCommentFragment;
1918
import com.rae.cnblogs.fragment.BlogContentFragment;
20-
import com.rae.cnblogs.message.EditCommentEvent;
2119
import com.rae.cnblogs.sdk.ApiDefaultObserver;
2220
import com.rae.cnblogs.sdk.bean.BlogBean;
2321
import com.rae.cnblogs.sdk.bean.BlogType;
2422
import com.rae.cnblogs.sdk.db.DbBlog;
2523
import com.rae.cnblogs.sdk.db.DbFactory;
2624
import com.rae.cnblogs.widget.PlaceholderView;
27-
import com.rae.cnblogs.widget.RaeDrawerLayout;
2825

29-
import org.greenrobot.eventbus.EventBus;
3026
import org.jsoup.Jsoup;
3127

3228
import java.util.List;
@@ -71,16 +67,16 @@ public class BlogContentActivity extends SwipeBackBaseActivity {
7167
@BindView(R.id.layout_content_comment)
7268
View mViewCommentView;
7369

74-
@BindView(R.id.fl_comment)
75-
RaeDrawerLayout mCommentLayout;
70+
// @BindView(R.id.fl_comment)
71+
// RaeDrawerLayout mCommentLayout;
7672

7773
@BindView(R.id.placeholder)
7874
PlaceholderView mPlaceholderView;
7975

8076
private BlogShareDialog mShareDialog;
8177
private BlogBean mBlog;
8278
private BlogType mBlogType;
83-
private BlogCommentFragment mBlogCommentFragment;
79+
// private BlogCommentFragment mBlogCommentFragment;
8480
private BlogContentFragment mBlogContentFragment;
8581

8682
@Override
@@ -220,14 +216,14 @@ private void onLoadData(BlogBean blog) {
220216

221217

222218
// 评论
223-
mBlogCommentFragment = BlogCommentFragment.newInstance(mBlog, mBlogType);
219+
// mBlogCommentFragment = BlogCommentFragment.newInstance(mBlog, mBlogType);
224220
// 内容
225221
mBlogContentFragment = BlogContentFragment.newInstance(mBlog, mBlogType);
226222

227223

228224
// 加载Fragment
229225
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
230-
transaction.add(R.id.fl_comment, mBlogCommentFragment);
226+
// transaction.add(R.id.fl_comment, mBlogCommentFragment);
231227
transaction.add(R.id.fl_content, mBlogContentFragment);
232228
// fix bugly #472
233229
transaction.commitAllowingStateLoss();
@@ -250,7 +246,7 @@ public void onCommentClick() {
250246
@OnClick(R.id.tv_edit_comment)
251247
public void onEditCommentClick() {
252248
// 通知里面的评论打开发表对话框
253-
EventBus.getDefault().post(new EditCommentEvent());
249+
// EventBus.getDefault().post(new EditCommentEvent());
254250
}
255251

256252
// // 作者头像
@@ -271,21 +267,21 @@ public void onActionBarClick() {
271267
return;
272268
}
273269

274-
if (mCommentLayout.getVisibility() == View.VISIBLE) {
275-
mBlogCommentFragment.scrollToTop();
276-
} else {
270+
// if (mCommentLayout.getVisibility() == View.VISIBLE) {
271+
// mBlogCommentFragment.scrollToTop();
272+
// } else {
277273
mBlogContentFragment.scrollToTop();
278-
}
274+
// }
279275
}
280276

281277

282-
// 返回键处理
283-
@Override
284-
public void onBackPressed() {
285-
if (mCommentLayout.getVisibility() == View.VISIBLE) {
286-
mCommentLayout.toggleSmoothScroll();
287-
return;
288-
}
289-
super.onBackPressed();
290-
}
278+
// // 返回键处理
279+
// @Override
280+
// public void onBackPressed() {
281+
// if (mCommentLayout.getVisibility() == View.VISIBLE) {
282+
// mCommentLayout.toggleSmoothScroll();
283+
// return;
284+
// }
285+
// super.onBackPressed();
286+
// }
291287
}

app/src/main/java/com/rae/cnblogs/fragment/BlogCommentFragment.java

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import android.os.Bundle;
55
import android.support.annotation.Nullable;
66
import android.support.v7.widget.LinearLayoutManager;
7-
import android.view.MotionEvent;
87
import android.view.View;
98
import android.widget.TextView;
109

@@ -25,9 +24,7 @@
2524
import com.rae.cnblogs.sdk.bean.BlogCommentBean;
2625
import com.rae.cnblogs.sdk.bean.BlogType;
2726
import com.rae.cnblogs.widget.PlaceholderView;
28-
import com.rae.cnblogs.widget.RaeDrawerLayout;
2927
import com.rae.cnblogs.widget.RaeRecyclerView;
30-
import com.rae.cnblogs.widget.compat.RaeDragDownCompat;
3128

3229
import org.greenrobot.eventbus.EventBus;
3330
import org.greenrobot.eventbus.Subscribe;
@@ -54,7 +51,7 @@ public static BlogCommentFragment newInstance(BlogBean blog, BlogType type) {
5451
@BindView(R.id.rec_blog_comment_list)
5552
RaeRecyclerView mRecyclerView;
5653

57-
private RaeDrawerLayout mParentView;
54+
// private RaeDrawerLayout mParentView;
5855

5956
@BindView(R.id.placeholder)
6057
PlaceholderView mPlaceholderView;
@@ -100,13 +97,13 @@ public void onActivityCreated(@Nullable Bundle savedInstanceState) {
10097
@Override
10198
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
10299
super.onViewCreated(view, savedInstanceState);
103-
mParentView = (RaeDrawerLayout) view.getParent();
104-
mParentView.setDragDownHandler(new RaeDragDownCompat.DragDownHandler() {
105-
@Override
106-
public boolean checkCanDrag(float dy, MotionEvent ev) {
107-
return !mPlaceholderView.isDismiss() || dy < 0 && mRecyclerView.isOnTop();
108-
}
109-
});
100+
// mParentView = (RaeDrawerLayout) view.getParent();
101+
// mParentView.setDragDownHandler(new RaeDragDownCompat.DragDownHandler() {
102+
// @Override
103+
// public boolean checkCanDrag(float dy, MotionEvent ev) {
104+
// return !mPlaceholderView.isDismiss() || dy < 0 && mRecyclerView.isOnTop();
105+
// }
106+
// });
110107
initView();
111108
}
112109

app/src/main/res/layout/activity_blog_content.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727
android:background="@color/white"/>
2828

2929
<!--评论区域-->
30-
<com.rae.cnblogs.widget.RaeDrawerLayout
30+
<!-- <com.rae.cnblogs.widget.RaeDrawerLayout
3131
android:id="@+id/fl_comment"
3232
android:layout_width="match_parent"
3333
android:layout_height="match_parent"
3434
android:visibility="gone"/>
35-
35+
-->
3636
</com.rae.cnblogs.widget.PlaceholderView>
3737

3838
<RelativeLayout

app/src/main/res/layout/activity_single_fragment.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
33
android:layout_width="match_parent"
44
android:layout_height="match_parent"
5-
android:orientation="vertical">
5+
android:background="@android:color/white"
6+
android:orientation="vertical"
7+
android:paddingTop="@dimen/default_padding_top">
68

79
<include layout="@layout/view_title"/>
810

app/src/main/res/layout/fm_blog_comment.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
<com.rae.cnblogs.widget.RaeRecyclerView
1919
android:id="@+id/rec_blog_comment_list"
2020
android:layout_width="match_parent"
21-
android:layout_height="match_parent"
22-
android:layout_marginTop="@dimen/action_bar_height"/>
21+
android:layout_height="match_parent"/>
2322

2423
</com.rae.cnblogs.widget.PlaceholderView>
2524

0 commit comments

Comments
 (0)