Skip to content

Commit 1cc61fa

Browse files
author
ChenRui
committed
修复BUG
1 parent ff1c26b commit 1cc61fa

File tree

9 files changed

+46
-13
lines changed

9 files changed

+46
-13
lines changed

.idea/dictionaries/Rae.xml

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

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ android {
7171
DEV {} // 测试
7272
baidu {} // 百度手机助手
7373
yinyongbao {} // 应用宝
74-
// m360 {} // 360手机助手
75-
// pp {} // PP助手
74+
m360 {} // 360手机助手
75+
pp {} // PP助手
7676
meizu {} // 魅族
7777
xiaomi {} // 小米商店
7878
huawei {} // 华为商店

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,8 @@ private void onLoadData(BlogBean blog) {
226226
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
227227
transaction.add(R.id.fl_comment, mBlogCommentFragment);
228228
transaction.add(R.id.fl_content, mBlogContentFragment);
229-
transaction.commit();
229+
// fix bugly #472
230+
transaction.commitAllowingStateLoss();
230231
}
231232

232233
// 分享

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,10 @@ protected void onResume() {
5252
long mainExitTimeMillis = config().getMainExitTimeMillis();
5353
long span = System.currentTimeMillis() - mainExitTimeMillis;
5454

55-
// 第一次或者是程序退出的时间超过3分钟(180000),就启动当前界面
56-
if (mainExitTimeMillis <= 0 || span > 180000) {
55+
// 第一次或者是程序退出的时间超过1分钟(60000),就启动当前界面
56+
if (mainExitTimeMillis <= 0 || span > 60000) {
5757
mLauncherPresenter.start();
5858
} else {
59-
6059
// 跳过启动界面
6160
AppRoute.jumpToMain(this);
6261
Observable.timer(500, TimeUnit.MILLISECONDS)
@@ -98,6 +97,10 @@ public void onLoadImage(String name, String url) {
9897

9998
@Override
10099
public void onJumpToWeb(String url) {
100+
// 网页路径为空不跳转
101+
if (TextUtils.isEmpty(url)) {
102+
return;
103+
}
101104
AppRoute.jumpToMain(this);
102105
AppRoute.jumpToWeb(this, url);
103106
finish();

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

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,17 @@ public BlogBean getBlog() {
134134

135135
@Override
136136
public void onLoadContentSuccess(String content) {
137-
mPlaceholderView.dismiss();
138-
mWebView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
139-
mWebView.loadUrl("file:///android_asset/view.html");
140-
// mWebView.loadUrl("http://192.168.168.10:8080/r/test.html");
137+
// 可能会处于非主线程中,这里提交到主线程中去。
138+
// fix bugly #354
139+
mContentLayout.post(new Runnable() {
140+
@Override
141+
public void run() {
142+
mPlaceholderView.dismiss();
143+
mWebView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
144+
mWebView.loadUrl("file:///android_asset/view.html");
145+
}
146+
});
147+
141148
}
142149

143150
@Override

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ public void onActivityCreated(@Nullable Bundle savedInstanceState) {
7979
mHomePresenter.start();
8080
}
8181

82+
8283
@OnClick(R.id.img_edit_category)
8384
public void onCategoryClick(View view) {
8485
if (mCategoryBeanList == null || mCategoryBeanList.size() <= 0) {
@@ -91,6 +92,11 @@ public void onCategoryClick(View view) {
9192
@Override
9293
public void onLoadCategory(List<CategoryBean> data) {
9394

95+
if (!isAdded()) {
96+
// 还没有加载
97+
return;
98+
}
99+
94100
mCategoryBeanList = data;
95101
int count = mAdapter == null ? 0 : mAdapter.getCount();
96102

@@ -131,7 +137,13 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) {
131137
// 分类编辑返回
132138
if (requestCode == AppRoute.REQ_CODE_CATEGORY && resultCode == Activity.RESULT_OK) {
133139
mPosition = data != null ? data.getIntExtra("position", 0) : mViewPager.getCurrentItem();
134-
mHomePresenter.start();
140+
// 可能没有附加上去,fix bugly #352
141+
mViewPager.post(new Runnable() {
142+
@Override
143+
public void run() {
144+
mHomePresenter.start();
145+
}
146+
});
135147
}
136148
}
137149

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<string name="register">注册</string>
3333
<string name="login_tips">登录即表示同意</string>
3434
<string name="login_contract">博客园APP隐私说明</string>
35-
<string name="login_contract_content">博客园APP已经开源,登录过程我们会收集您遇到的错误信息以及博客名称,但我们不会收集您的帐号密码信息,请放心登录。\n您在登录过程如有任何问题请联系博客园官方团\n对于博客园APP您有任何意见或者想法都可以随时联系作者raedev@qq.com</string>
35+
<string name="login_contract_content">博客园APP已经开源,登录过程我们会收集您遇到的错误信息以及博客名称,但我们不会收集您的帐号密码信息,请放心登录。\n您在登录过程如有任何问题请联系博客园官方团队。contact@cnblogs.com\n</string>
3636
<string name="login_user_name_hint">用户名</string>
3737
<string name="login_password_hint">密码</string>
3838
<string name="login">登录</string>

app/src/xiaomi/res/values/strings.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<resources>
2+
<string name="app_name">博客园APP</string>
3+
</resources>

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ org.gradle.jvmargs=-Xmx1536m
1212
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
1313
# org.gradle.parallel=true
1414
# Enable/Disable Tinker HotFix
15-
enableHotfix=true
15+
enableHotfix=false

0 commit comments

Comments
 (0)