Skip to content

Commit 8a4b812

Browse files
author
Blankj
committed
see 11/23 log
1 parent 0f90a50 commit 8a4b812

4 files changed

Lines changed: 59 additions & 18 deletions

File tree

app/src/main/java/com/blankj/androidutilcode/activities/DeviceActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,4 @@ public void onClick(View view) {
5656
break;
5757
}
5858
}
59-
}
59+
}

utilcode/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ dependencies {
2525
provided 'com.android.support:support-v4:24.0.0'
2626
provided 'com.android.support:design:24.0.0'
2727
}
28-
apply from: "https://raw.githubusercontent.com/xiaopansky/android-library-publish-to-jcenter/master/bintrayUpload.gradle"
28+
//apply from: "https://raw.githubusercontent.com/xiaopansky/android-library-publish-to-jcenter/master/bintrayUpload.gradle"
2929
//gradlew bintrayUpload

utilcode/src/main/java/com/blankj/utilcode/utils/CrashUtils.java

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -81,25 +81,30 @@ public boolean init(Context context) {
8181
}
8282

8383
@Override
84-
public void uncaughtException(Thread thread, Throwable throwable) {
84+
public void uncaughtException(Thread thread, final Throwable throwable) {
8585
String now = new SimpleDateFormat("yy-MM-dd HH:mm:ss", Locale.getDefault()).format(new Date());
86-
String fullPath = crashDir + now + ".txt";
86+
final String fullPath = crashDir + now + ".txt";
8787
if (!FileUtils.createOrExistsFile(fullPath)) return;
88-
PrintWriter pw = null;
89-
try {
90-
pw = new PrintWriter(new FileWriter(fullPath, false));
91-
pw.write(getCrashHead());
92-
throwable.printStackTrace(pw);
93-
Throwable cause = throwable.getCause();
94-
while (cause != null) {
95-
cause.printStackTrace(pw);
96-
cause = cause.getCause();
88+
new Thread(new Runnable() {
89+
@Override
90+
public void run() {
91+
PrintWriter pw = null;
92+
try {
93+
pw = new PrintWriter(new FileWriter(fullPath, false));
94+
pw.write(getCrashHead());
95+
throwable.printStackTrace(pw);
96+
Throwable cause = throwable.getCause();
97+
while (cause != null) {
98+
cause.printStackTrace(pw);
99+
cause = cause.getCause();
100+
}
101+
} catch (IOException e) {
102+
e.printStackTrace();
103+
} finally {
104+
CloseUtils.closeIO(pw);
105+
}
97106
}
98-
} catch (IOException e) {
99-
e.printStackTrace();
100-
} finally {
101-
CloseUtils.closeIO(pw);
102-
}
107+
}).start();
103108
if (mHandler != null) {
104109
mHandler.uncaughtException(thread, throwable);
105110
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package com.blankj.utilcode.utils;
2+
3+
import org.junit.Test;
4+
5+
import java.io.File;
6+
import java.util.List;
7+
8+
/**
9+
* <pre>
10+
* author: Blankj
11+
* blog : http://blankj.com
12+
* time : 2016/11/23
13+
* desc : 生成Dode的README
14+
* </pre>
15+
*/
16+
public class DogeTest {
17+
18+
@Test
19+
public void generateDogeMD() throws Exception {
20+
StringBuilder sb = new StringBuilder();
21+
sb.append("卡通doge的表情大集合,喜爱doge的朋友的福利到了,花了大半天的时间整理出来的狗东西,就被你们这么轻而易举地拿走了,现附上QQ表情包链接[doge-expression.eif](https://github.com/Blankj/doge-expression/blob/master/doge-expression.eif)(进去点击Download即可)\n\n");
22+
sb.append("下面展示doge各种姿势,请系好安全带,开车啦,滴滴滴~~\n\n");
23+
File file = new File("F:/MyGithub/doge-expression/expression");
24+
List<File> files = FileUtils.listFilesInDir(file);
25+
for (File f : files) {
26+
String name = f.getName();
27+
sb.append("![")
28+
.append(name)
29+
.append("]")
30+
.append("(https://github.com/Blankj/doge-expression/raw/master/expression/")
31+
.append(name)
32+
.append(") \n");
33+
}
34+
FileUtils.writeFileFromString("F:/MyGithub/doge-expression/README.md", sb.toString(), false);
35+
}
36+
}

0 commit comments

Comments
 (0)