Skip to content

Commit 6719370

Browse files
committed
修复新闻、知识库详情
1 parent 37e4346 commit 6719370

File tree

33 files changed

+922
-605
lines changed

33 files changed

+922
-605
lines changed

.idea/modules.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/main/java/com/rae/cnblogs/MainActivity.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public void onNext(Long aLong) {
7373
// 启动服务
7474
startService(new Intent(this, CnblogsService.class));
7575
if (BuildConfig.DEBUG) {
76-
// debugLogin();
76+
debugLogin();
7777
}
7878
}
7979

@@ -83,8 +83,8 @@ public void onNext(Long aLong) {
8383
*/
8484
protected void debugLogin() {
8585
String url = "cnblogs.com";
86-
String cookie = "A688D6A0971A93007FF8221C60E8E0FDB2866B1DF923C14422B361049C34194A5B1B25A7B3F72A002E41D100226A7F046D16B88F97412A6182FC4BF94F220D4A9236941DE58BCEFDA575CF4E3EB25A9D97BB7601";
87-
String netCoreCookie = "CfDJ8KlpyPucjmhMuZTmH8oiYTNfOPU2k5nMET16IOYR6efcY_FO5y_VQp8XjUgDHWE5RRYwTjaP2ccyMxNewY4lzaOFKZVXbJ3iw1xroxqbUsPY3tOneapdybk-LE44YvlnpDtbq9OG3Ed4IAbj1mvlilS_JwslUTpLEjjAxWx9DvTqenfu1HV2fEgaca_B0X1gLUnt81lTwiukd5XwnRo_jRETZ4r4XH4p8nK6nOnMCb8tBMXkFyPQQ-_Q16LIgHzU_-xnLa_jxTUYedi4QCWoAmAUNz59-xiuOSj9m58xi61hiljfeTxl-E9qjAUokzBbkQ";
86+
String cookie = "4F523B96A57E7D0C1165E5D565C89055A98E0CBF3C432EC7006BC69E47AD5CCEFD976EC972F44EB25C5AD9398A8B9D42371694EDE1C819943A1F57137A18D43E59B0184B954F96B38D4C76577E00B3B5F55ED4A8";
87+
String netCoreCookie = "CfDJ8KlpyPucjmhMuZTmH8oiYTNKRTDax9L0rk-chKipr_j1ObB5W50Fzow96wDJSdsvW23yuwUWKk6ei0xEuESYMSfIBCEnt08OIwCzmXpjfKLSo4T82c9KyIHsyaSElcTQDs2eJKiZQTcfhYpxCXZ2nHV2IM1wxvojMAN_-kt5HPYxahwdeXsAxcBIcZJWCB6ng_bbnUIPQc9FIKdJZwx1GtzflDi4L4AhsDdWgS_H-dwkj97fzkdDfo-UYJmPUtKbW6tmW8dSHyF4p1_xdPaZxaI9OBYDT9ZTiDVTrmPQM_1-";
8888
CookieManager cookieManager = CookieManager.getInstance();
8989
cookieManager.removeAllCookie();
9090
cookieManager.setCookie(url, ".CNBlogsCookie=" + cookie + "; domain=.cnblogs.com; path=/; HttpOnly");

module-basic/src/main/AndroidManifest.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<activity
3333
android:name="com.tencent.tauth.AuthActivity"
3434
android:launchMode="singleTask"
35-
android:noHistory="true" >
35+
android:noHistory="true">
3636
<intent-filter>
3737
<action android:name="android.intent.action.VIEW" />
3838

@@ -44,8 +44,8 @@
4444
</activity>
4545
<activity
4646
android:name="com.tencent.connect.common.AssistActivity"
47-
android:theme="@android:style/Theme.Translucent.NoTitleBar"
48-
android:configChanges="orientation|keyboardHidden|screenSize"/>
47+
android:configChanges="orientation|keyboardHidden|screenSize"
48+
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
4949

5050
</application>
5151
</manifest>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.rae.cnblogs.basic;
2+
3+
import android.support.v4.content.FileProvider;
4+
5+
/**
6+
* Created by rae on 2018/12/21.
7+
* Copyright (c) https://github.com/raedev All rights reserved.
8+
*/
9+
public class AppFileProvider extends FileProvider {
10+
public AppFileProvider() {
11+
}
12+
}

module-blog/src/main/java/com/rae/cnblogs/blog/CnblogsService.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,14 @@ public void onDestroy() {
5656
@Subscribe
5757
public void onEvent(JobEvent event) {
5858
int action = event.getAction();
59-
if (action == JobEvent.ACTION_JOB_BLOG_CONTENT) {
60-
if (mBlogContentJob == null) {
61-
mBlogContentJob = new BlogContentJob(this);
62-
} else {
63-
mBlogContentJob.run();
64-
}
65-
}
59+
// TODO: 调试暂时关闭博文异步下载
60+
// if (action == JobEvent.ACTION_JOB_BLOG_CONTENT) {
61+
// if (mBlogContentJob == null) {
62+
// mBlogContentJob = new BlogContentJob(this);
63+
// } else {
64+
// mBlogContentJob.run();
65+
// }
66+
// }
6667
}
6768

6869
/**

module-blog/src/main/java/com/rae/cnblogs/blog/adapter/ContentItemAdapter.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ public class ContentItemAdapter extends BaseItemAdapter<ContentEntity, SimpleVie
3434

3535
private final int mViewType;
3636

37+
private boolean mEnableCountLayout = true; // 显示评论 喜欢 阅读数的布局
38+
3739
public ContentItemAdapter() {
3840
this(VIEW_TYPE_NORMAL);
3941
}
@@ -57,6 +59,9 @@ public int getItemViewType(int position) {
5759
return mViewType;
5860
}
5961

62+
public void setEnableCountLayout(boolean enableCountLayout) {
63+
mEnableCountLayout = enableCountLayout;
64+
}
6065

6166
@Override
6267
public SimpleViewHolder onCreateViewHolder(LayoutInflater inflater, ViewGroup parent, int viewType) {
@@ -90,6 +95,7 @@ private void onBindContentItemViewHolder(ContentItemViewHolder holder, ContentEn
9095
holder.readerView.setText(m.getViewCount());
9196
holder.likeView.setText(m.getLikeCount());
9297
holder.commentView.setText(m.getCommentCount());
98+
UICompat.setVisibility(holder.countLayout, mEnableCountLayout);
9399

94100
// 显示头像
95101
AppImageLoader.displayAvatar(m.getAvatar(), holder.avatarView);

module-blog/src/main/java/com/rae/cnblogs/blog/comment/CommentPresenterImpl.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import com.rae.cnblogs.sdk.ApiDefaultObserver;
99
import com.rae.cnblogs.sdk.CnblogsApiFactory;
1010
import com.rae.cnblogs.sdk.Empty;
11+
import com.rae.cnblogs.sdk.JsonBody;
1112
import com.rae.cnblogs.sdk.UserProvider;
1213
import com.rae.cnblogs.sdk.api.IBlogApi;
1314
import com.rae.cnblogs.sdk.api.INewsApi;
@@ -55,8 +56,16 @@ protected void onStart() {
5556

5657
@Override
5758
public void onDeleteComment(final BlogCommentBean comment) {
59+
ContentEntity entity = getView().getContentEntity();
60+
Observable<Empty> observable;
61+
if (BlogType.typeOf(entity.getType()) == BlogType.NEWS) {
62+
observable = mNewsApi.deleteNewsComment(comment.getId());
63+
} else {
64+
observable = mBlogApi.deleteBlogComment(comment.getId());
65+
}
66+
5867
AndroidObservable
59-
.create(mBlogApi.deleteBlogComment(comment.getId()))
68+
.create(observable)
6069
.with(this)
6170
.subscribe(new ApiDefaultObserver<Empty>() {
6271
@Override

module-blog/src/main/java/com/rae/cnblogs/blog/content/KbListPresenterImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class KbListPresenterImpl extends BasicBlogPresenterImpl {
2323
private IBlogApi mBlogApi;
2424

2525
public KbListPresenterImpl(ContentListContract.View view) {
26-
super(view, BlogType.NEWS);
26+
super(view, BlogType.KB);
2727
mBlogApi = CnblogsApiFactory.getInstance(getContext()).getBlogApi();
2828
}
2929

0 commit comments

Comments
 (0)