Skip to content

Commit cf1cba0

Browse files
author
ChenRui
committed
修复闪存列表显示BUG;
闪存夜间模式兼容
1 parent 755d7ae commit cf1cba0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+571
-129
lines changed

app/src/main/AndroidManifest.xml

+17-12
Original file line numberDiff line numberDiff line change
@@ -29,34 +29,34 @@
2929
android:name=".activity.LauncherActivity"
3030
android:screenOrientation="portrait"
3131
android:theme="@style/AppTheme.NoActionBar.FullScreen">
32-
<!-- <intent-filter>
33-
<action android:name="android.intent.action.MAIN"/>
32+
<!-- <intent-filter>
33+
<action android:name="android.intent.action.MAIN"/>
3434
35-
<category android:name="android.intent.category.LAUNCHER"/>
36-
</intent-filter>-->
35+
<category android:name="android.intent.category.LAUNCHER"/>
36+
</intent-filter>-->
3737
</activity>
3838

3939
<!--主界面-->
4040
<activity
4141
android:name=".activity.MainActivity"
4242
android:screenOrientation="portrait"
4343
android:theme="@style/AppTheme.Dark">
44-
<intent-filter>
45-
<action android:name="android.intent.action.MAIN"/>
44+
<intent-filter>
45+
<action android:name="android.intent.action.MAIN"/>
4646

47-
<category android:name="android.intent.category.LAUNCHER"/>
48-
</intent-filter>
47+
<category android:name="android.intent.category.LAUNCHER"/>
48+
</intent-filter>
4949
</activity>
5050

5151
<activity
5252
android:name=".activity.TestActivity"
5353
android:label="博客园测试"
5454
android:screenOrientation="portrait"
5555
android:theme="@style/AppTheme.Dark">
56-
<!-- <intent-filter>
57-
<action android:name="android.intent.action.MAIN"/>
58-
<category android:name="android.intent.category.LAUNCHER"/>
59-
</intent-filter>-->
56+
<!-- <intent-filter>
57+
<action android:name="android.intent.action.MAIN"/>
58+
<category android:name="android.intent.category.LAUNCHER"/>
59+
</intent-filter>-->
6060
</activity>
6161

6262
<!--博文-->
@@ -154,6 +154,11 @@
154154
android:label="@string/label_moment_detail"
155155
android:screenOrientation="portrait"/>
156156

157+
<activity
158+
android:name=".activity.MomentAtMeActivity"
159+
android:label="@string/label_moment_at_me"
160+
android:screenOrientation="portrait"/>
161+
157162
<activity
158163
android:name=".activity.MomentMessageActivity"
159164
android:label="@string/label_moment_message"

app/src/main/assets/css/rae-common.css

+4
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ a{
4848
.btn_author{
4949
-webkit-tap-highlight-color:rgba(0,0,0,0);
5050
-webkit-tap-highlight-color: transparent;
51+
white-space:nowrap;
52+
letter-spacing:-1px;
53+
box-sizing:inherit;
54+
text-shadow:none;
5155
box-shadow: none;
5256
outline: none;
5357
display: block;

app/src/main/assets/js/rae.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,11 @@ function getImageWidth(url,callback){
100100
if(img.complete){
101101
callback(img.width, img.height);
102102
}else{
103-
// 完全加载完毕的事件
103+
// 完全加载完毕的事件
104104
img.onload = function(){
105-
callback(img.width, img.height);
106-
}
105+
callback(img.width, img.height);
107106
}
107+
}
108+
108109

109110
}

app/src/main/assets/view.html

+6-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
<!-- <link rel="stylesheet" type="text/css" href="css/bootstrap-theme.min.css"> -->
1212
<link type="text/css" rel="stylesheet" href="css/shCoreDefault.css" id="CodeStyle"/>
1313
<link rel="stylesheet" type="text/css" href="css/rae-common.css">
14-
<link rel="stylesheet" type="text/css" href="css/rae.css" id="RaeStyle">
14+
<!--主题-->
15+
<link rel="stylesheet" type="text/css" href="css/{{theme}}" id="RaeStyle">
1516
<link rel="stylesheet" type="text/css" href="http://www.raeblog.com/cnblogs/Content/app/rae-ext.css"/>
1617
<!-- <link type="text/css" rel="stylesheet" href="css/shThemeRDark.css" />
1718
<link rel="stylesheet" type="text/css" href="css/rae-night.css" /> -->
@@ -117,11 +118,14 @@
117118
var src = $(val).attr("src");
118119
var id = $(val).attr("id");
119120
if(id=="blog_avatar") return;
120-
getImageWidth(src,function(e,w,h){
121+
getImageWidth(src,function(w,h){
121122
var screenWidth = $(document).width();
122123
// 图片适配屏幕
123124
if(screenWidth>0 && w< screenWidth/2){
124125
$(val).css("width","auto");
126+
}else{
127+
// 填充全屏
128+
$(val).css("width","100%");
125129
}
126130
})
127131
// $(val).load(function(){

app/src/main/java/android/support/design/widget/DesignTabLayout.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import android.graphics.Canvas;
2626
import android.graphics.Paint;
2727
import android.graphics.Rect;
28+
import android.graphics.Typeface;
2829
import android.graphics.drawable.Drawable;
2930
import android.os.Build;
3031
import android.support.annotation.ColorInt;
@@ -1259,9 +1260,9 @@ public void setTextStyle(int flag) {
12591260
if (mView == null) return;
12601261
TextView textView = mView.mTextView;
12611262
if (flag == 1) {
1262-
textView.getPaint().setFlags(textView.getPaint().getFlags() | Paint.FAKE_BOLD_TEXT_FLAG);
1263+
textView.setTypeface(textView.getTypeface(), Typeface.BOLD);
12631264
} else {
1264-
textView.getPaint().setFlags(textView.getPaint().getFlags() ^ Paint.FAKE_BOLD_TEXT_FLAG);
1265+
textView.setTypeface(null, Typeface.NORMAL);
12651266
}
12661267
}
12671268

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

+10-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import com.rae.cnblogs.activity.ImageSelectionActivity;
1919
import com.rae.cnblogs.activity.LoginActivity;
2020
import com.rae.cnblogs.activity.MainActivity;
21+
import com.rae.cnblogs.activity.MomentAtMeActivity;
2122
import com.rae.cnblogs.activity.MomentDetailActivity;
2223
import com.rae.cnblogs.activity.MomentMessageActivity;
2324
import com.rae.cnblogs.activity.PostMomentActivity;
@@ -398,13 +399,21 @@ public static void jumpToMomentDetail(Context context, String userAlias, String
398399

399400

400401
/**
401-
* 闪存详情
402+
* 闪存消息
402403
*/
403404
public static void jumpToMomentMessage(Context context) {
404405
Intent intent = new Intent(context, MomentMessageActivity.class);
405406
startActivity(context, intent);
406407
}
407408

409+
/**
410+
* 提到我的闪存
411+
*/
412+
public static void jumpToMomentAtMe(Context context) {
413+
Intent intent = new Intent(context, MomentAtMeActivity.class);
414+
startActivity(context, intent);
415+
}
416+
408417
/**
409418
* 跳转到图片选择
410419
*/

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

+5-2
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,10 @@ protected void showHomeAsUp(Toolbar toolbar) {
9797
ActionBar bar = getSupportActionBar();
9898
if (bar != null) {
9999
bar.setDisplayHomeAsUpEnabled(true);
100-
bar.setHomeAsUpIndicator(getHomeAsUpIndicator());
100+
// 设置返回按钮
101+
if (getHomeAsUpIndicator() != 0) {
102+
bar.setHomeAsUpIndicator(getHomeAsUpIndicator());
103+
}
101104
bar.setDisplayShowHomeEnabled(false);
102105
bar.setDisplayShowTitleEnabled(false);
103106
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@@ -118,7 +121,7 @@ protected void showHomeAsUp() {
118121
* 返回按钮的图片
119122
*/
120123
protected int getHomeAsUpIndicator() {
121-
return R.drawable.ic_back;
124+
return 0;
122125
}
123126

124127
protected BaseActivity getContext() {

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

+6-3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public class FontSettingActivity extends SwipeBackBaseActivity {
2323
TextView mMessage;
2424
@BindView(R.id.seekBar)
2525
RaeSeekBar mSeekBar;
26+
private boolean mFontChanged;
2627

2728
@Override
2829
protected void onCreate(@Nullable Bundle savedInstanceState) {
@@ -41,6 +42,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
4142
public void onProgressChanged(SeekBar seekBar, int value, boolean b) {
4243
int size = mSeekBar.getRawTextSize(value);
4344
mMessage.setTextSize(size);
45+
mFontChanged = true;
4446
}
4547

4648
@Override
@@ -60,8 +62,9 @@ protected void onDestroy() {
6062
// 保存设置
6163
config().setPageTextSize(mSeekBar.getTextSize(mSeekBar.getProgress()));
6264
super.onDestroy();
63-
64-
// 通知
65-
EventBus.getDefault().post(new FontChangedEvent());
65+
if (mFontChanged) {
66+
// 通知
67+
EventBus.getDefault().post(new FontChangedEvent());
68+
}
6669
}
6770
}

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

+4-2
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,10 @@ protected void onCreate(Bundle savedInstanceState) {
6868
AppStatusBar.setStatusbarToDark(this);
6969
super.onCreate(savedInstanceState);
7070
setContentView(R.layout.activity_main);
71-
// 跳启动页
72-
startActivity(new Intent(this, LauncherActivity.class));
71+
if (!BuildConfig.DEBUG) {
72+
// 跳启动页
73+
startActivity(new Intent(this, LauncherActivity.class));
74+
}
7375

7476
EventBus.getDefault().register(this);
7577
mServiceConnection = new ServiceConnection() {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package com.rae.cnblogs.activity;
2+
3+
import android.os.Bundle;
4+
import android.support.annotation.Nullable;
5+
6+
import com.rae.cnblogs.R;
7+
import com.rae.cnblogs.fragment.MomentFragment;
8+
import com.rae.cnblogs.sdk.ApiDefaultObserver;
9+
import com.rae.cnblogs.sdk.CnblogsApiFactory;
10+
import com.rae.cnblogs.sdk.Empty;
11+
import com.rae.cnblogs.sdk.api.IMomentApi;
12+
13+
import io.reactivex.android.schedulers.AndroidSchedulers;
14+
import io.reactivex.schedulers.Schedulers;
15+
16+
/**
17+
* 提到我的闪存
18+
* Created by ChenRui on 2017/11/8 0008 10:19.
19+
*/
20+
public class MomentAtMeActivity extends SwipeBackBaseActivity {
21+
22+
@Override
23+
protected void onCreate(@Nullable Bundle savedInstanceState) {
24+
super.onCreate(savedInstanceState);
25+
setContentView(R.layout.activity_single_fragment);
26+
showHomeAsUp();
27+
MomentFragment fragment = MomentFragment.newInstance(IMomentApi.MOMENT_TYPE_AT_ME);
28+
getSupportFragmentManager().beginTransaction()
29+
.add(R.id.content, fragment).commitNow();
30+
31+
// 更新阅读状态
32+
IMomentApi momentApi = CnblogsApiFactory.getInstance(this).getMomentApi();
33+
momentApi.updateAtMeToRead(System.currentTimeMillis())
34+
.subscribeOn(Schedulers.io())
35+
.observeOn(AndroidSchedulers.mainThread())
36+
.subscribe(new ApiDefaultObserver<Empty>() {
37+
@Override
38+
protected void onError(String message) {
39+
40+
}
41+
42+
@Override
43+
protected void accept(Empty empty) {
44+
45+
}
46+
});
47+
}
48+
49+
50+
}

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

-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ protected void accept(MomentBean momentBean) {
9191

9292
}
9393

94-
9594
/**
9695
* 分享
9796
*/

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

+6-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import android.os.Bundle;
44
import android.support.annotation.Nullable;
55

6+
import com.rae.cnblogs.AppRoute;
67
import com.rae.cnblogs.R;
78
import com.rae.cnblogs.fragment.MomentMessageFragment;
89

@@ -20,7 +21,6 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
2021
super.onCreate(savedInstanceState);
2122
setContentView(R.layout.activity_moment_message);
2223
showHomeAsUp();
23-
// AppRoute.jumpToLogin(this);
2424
mFragment = new MomentMessageFragment();
2525
getSupportFragmentManager().beginTransaction()
2626
.add(R.id.content, mFragment)
@@ -31,4 +31,9 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
3131
public void onToolbarClick() {
3232
mFragment.scrollToTop();
3333
}
34+
35+
@OnClick(R.id.img_at_me)
36+
public void onAtMeClick() {
37+
AppRoute.jumpToMomentAtMe(this);
38+
}
3439
}

0 commit comments

Comments
 (0)