Skip to content

Commit f181949

Browse files
committed
see 08/25 log
2 parents e2b87c7 + 7bc1ec6 commit f181949

Some content is hidden

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

41 files changed

+1055
-109
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
* `19/08/25` [upd] ImageUtils#getImageType. [add] LogUtils# Publish v1.25.9.
2+
* `19/08/24` [fix] PhoneUtils#getIMEI crash on SDK 29.
3+
* `19/08/23` [add] ViewUtils#isLayoutRtl.
4+
* `19/08/22` [add] LogUtils#getLogFiles.
15
* `19/08/13` [add] MapUtils and MapUtilsTest. Publish v1.25.8.
26
* `19/08/12` [add] CollectionUtils and CollectionUtilsTest.
37
* `19/08/11` [add] ArrayUtils and ArrayUtilsTest.

README-CN.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343
## 打个小广告
4444

45-
欢迎加入我的知识星球「**[基你太美](https://t.zsxq.com/FmeqfYF)**学习 [AucFrame](https://blankj.com/2019/07/22/auc-frame/) 框架,目前一期内测已结束,二期已开,有兴趣进群的可以加我微信(备注:基你太美二期)。
45+
欢迎加入我的知识星球「**[基你太美](https://t.zsxq.com/FmeqfYF)**,我会在星球中分享 [AucFrame](https://blankj.com/2019/07/22/auc-frame/) 框架、大厂面经、[AndroidUtilCode](https://github.com/Blankj/AndroidUtilCode) 更详尽的说明...一切我所了解的知识,你可以通过支付进入我的星球「**[基你太美](https://t.zsxq.com/FmeqfYF)**」进行体验,加入后优先观看星球中精华的部分,如果觉得星球的内容对自身没有收益,你可以自行申请退款退出星球,也没必要加我好友;**如果你已确定要留在我的星球,可以通过扫描如下二维码(备注:基你太美)加我个人微信,发送给我你的星球 ID,方便我后续拉你进群(PS:进得越早价格越便宜)。**
4646

4747
![我的二维码](https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/wechat.png)
4848

@@ -51,7 +51,7 @@
5151

5252
[frame]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/auc_frame_cn.png
5353

54-
[aucSvg]: https://img.shields.io/badge/AndroidUtilCode-v1.25.8-brightgreen.svg
54+
[aucSvg]: https://img.shields.io/badge/AndroidUtilCode-v1.25.9-brightgreen.svg
5555
[auc]: https://github.com/Blankj/AndroidUtilCode
5656

5757
[apiSvg]: https://img.shields.io/badge/API-14+-brightgreen.svg

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ If this project helps you a lot and you want to support the project's developmen
4242

4343
## 打个小广告
4444

45-
欢迎加入我的知识星球「**[基你太美](https://t.zsxq.com/FmeqfYF)**学习 [AucFrame](https://blankj.com/2019/07/22/auc-frame/) 框架,目前一期内测已结束,二期已开,有兴趣进群的可以加我微信(备注:基你太美二期)。
45+
欢迎加入我的知识星球「**[基你太美](https://t.zsxq.com/FmeqfYF)**,我会在星球中分享 [AucFrame](https://blankj.com/2019/07/22/auc-frame/) 框架、大厂面经、[AndroidUtilCode](https://github.com/Blankj/AndroidUtilCode) 更详尽的说明...一切我所了解的知识,你可以通过支付进入我的星球「**[基你太美](https://t.zsxq.com/FmeqfYF)**」进行体验,加入后优先观看星球中精华的部分,如果觉得星球的内容对自身没有收益,你可以自行申请退款退出星球,也没必要加我好友;**如果你已确定要留在我的星球,可以通过扫描如下二维码(备注:基你太美)加我个人微信,发送给我你的星球 ID,方便我后续拉你进群(PS:进得越早价格越便宜)。**
4646

4747
![我的二维码](https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/wechat.png)
4848

@@ -51,7 +51,7 @@ If this project helps you a lot and you want to support the project's developmen
5151

5252
[frame]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/auc_frame.png
5353

54-
[aucSvg]: https://img.shields.io/badge/AndroidUtilCode-v1.25.8-brightgreen.svg
54+
[aucSvg]: https://img.shields.io/badge/AndroidUtilCode-v1.25.9-brightgreen.svg
5555
[auc]: https://github.com/Blankj/AndroidUtilCode
5656

5757
[apiSvg]: https://img.shields.io/badge/API-14+-brightgreen.svg

buildSrc/src/main/groovy/Config.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ class Config {
1515
static minSdkVersion = 14
1616

1717
static targetSdkVersion = 28
18-
static versionCode = 1_025_008
19-
static versionName = '1.25.8'// E.g. 1.9.72 => 1,009,072
18+
static versionCode = 1_025_009
19+
static versionName = '1.25.9'// E.g. 1.9.72 => 1,009,072
2020

2121
// lib version
2222
static kotlin_version = '1.3.10'

buildSrc/src/main/groovy/ConfigUtils.groovy

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import org.apache.commons.io.FileUtils
2-
import org.apache.groovy.json.internal.ArrayUtils
32
import org.gradle.BuildListener
43
import org.gradle.BuildResult
54
import org.gradle.api.Project
@@ -10,7 +9,6 @@ import org.gradle.api.execution.TaskExecutionListener
109
import org.gradle.api.initialization.Settings
1110
import org.gradle.api.invocation.Gradle
1211
import org.gradle.api.tasks.TaskState
13-
import org.gradle.internal.impldep.org.apache.commons.collections.MapUtils
1412

1513
import java.text.SimpleDateFormat
1614

@@ -63,6 +61,7 @@ class ConfigUtils {
6361

6462
static addBuildListener(Gradle gradle) {
6563
gradle.addBuildListener(new ConfigBuildListener())
64+
GitUtils.init(gradle)
6665
}
6766

6867
private static class ConfigBuildListener implements BuildListener {
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
import org.gradle.api.Action
2+
import org.gradle.api.Project
3+
import org.gradle.api.invocation.Gradle
4+
5+
import java.text.SimpleDateFormat
6+
7+
/**
8+
* <pre>
9+
* author: blankj
10+
* blog : http://blankj.com
11+
* time : 2019/08/16
12+
* desc :
13+
* </pre>
14+
*/
15+
class GitUtils {
16+
17+
private static String sCurBranchName;
18+
19+
static void init(Gradle gradle) {
20+
gradle.rootProject(new Action<Project>() {
21+
@Override
22+
void execute(Project project) {
23+
sCurBranchName = getGitBranch()
24+
addGitPushTask(project)
25+
addGitPushAndMerge2MasterTask(project)
26+
addGitNewBranchTask(project)
27+
}
28+
})
29+
}
30+
31+
static def getGitBranch() {
32+
return ShellUtils.execCmd('git symbolic-ref --short -q HEAD').successMsg
33+
}
34+
35+
static void addGitPushTask(Project project) {
36+
project.task("gitPush").doLast {
37+
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM/dd")
38+
String date = simpleDateFormat.format(new Date())
39+
GLog.d(ShellUtils.execCmd([
40+
"git add -A",
41+
"git commit -m \"see $date log\"",
42+
"git push origin $sCurBranchName"
43+
] as String[]))
44+
}
45+
}
46+
47+
static void addGitPushAndMerge2MasterTask(Project project) {
48+
project.task("gitPushAndMerge2Master").doLast {
49+
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM/dd")
50+
String date = simpleDateFormat.format(new Date())
51+
GLog.d(ShellUtils.execCmd([
52+
"git add -A",
53+
"git commit -m \"see $date log\"",
54+
"git push origin $sCurBranchName",
55+
"git checkout master",
56+
"git merge $sCurBranchName",
57+
"git push origin master",
58+
"git checkout $sCurBranchName",
59+
] as String[]))
60+
}
61+
}
62+
63+
static void addGitNewBranchTask(Project project) {
64+
project.task("gitNewBranch").doLast {
65+
GLog.d(ShellUtils.execCmd([
66+
"git checkout master",
67+
"git checkout -b ${Config.versionName}",
68+
"git push origin ${Config.versionName}:${Config.versionName}",
69+
] as String[]))
70+
}
71+
}
72+
}
73+
// ./gradlew gitPush
74+
// ./gradlew gitPushAndMerge2Master
75+
// ./gradlew gitNewBranch
Lines changed: 228 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,228 @@
1+
import java.io.BufferedReader;
2+
import java.io.DataOutputStream;
3+
import java.io.IOException;
4+
import java.io.InputStreamReader;
5+
import java.util.List;
6+
7+
/**
8+
* <pre>
9+
* author: Blankj
10+
* blog : http://blankj.com
11+
* time : 2016/08/07
12+
* desc : utils about shell
13+
* </pre>
14+
*/
15+
public final class ShellUtils {
16+
17+
private static final String LINE_SEP = System.getProperty("line.separator");
18+
19+
private ShellUtils() {
20+
throw new UnsupportedOperationException("u can't instantiate me...");
21+
}
22+
23+
/**
24+
* Execute the command.
25+
*
26+
* @param command The command.
27+
* @return the single {@link CommandResult} instance
28+
*/
29+
public static CommandResult execCmd(final String command) {
30+
return execCmd(new String[]{command}, false, true);
31+
}
32+
33+
/**
34+
* Execute the command.
35+
*
36+
* @param command The command.
37+
* @param isRooted True to use root, false otherwise.
38+
* @return the single {@link CommandResult} instance
39+
*/
40+
public static CommandResult execCmd(final String command, final boolean isRooted) {
41+
return execCmd(new String[]{command}, isRooted, true);
42+
}
43+
44+
/**
45+
* Execute the command.
46+
*
47+
* @param commands The commands.
48+
* @return the single {@link CommandResult} instance
49+
*/
50+
public static CommandResult execCmd(final List<String> commands) {
51+
return execCmd(commands == null ? null : commands.toArray(new String[]{}), false, true);
52+
}
53+
54+
/**
55+
* Execute the command.
56+
*
57+
* @param commands The commands.
58+
* @param isRooted True to use root, false otherwise.
59+
* @return the single {@link CommandResult} instance
60+
*/
61+
public static CommandResult execCmd(final List<String> commands, final boolean isRooted) {
62+
return execCmd(commands == null ? null : commands.toArray(new String[]{}), isRooted, true);
63+
}
64+
65+
/**
66+
* Execute the command.
67+
*
68+
* @param commands The commands.
69+
* @return the single {@link CommandResult} instance
70+
*/
71+
public static CommandResult execCmd(final String[] commands) {
72+
return execCmd(commands, false, true);
73+
}
74+
75+
/**
76+
* Execute the command.
77+
*
78+
* @param commands The commands.
79+
* @param isRooted True to use root, false otherwise.
80+
* @return the single {@link CommandResult} instance
81+
*/
82+
public static CommandResult execCmd(final String[] commands, final boolean isRooted) {
83+
return execCmd(commands, isRooted, true);
84+
}
85+
86+
/**
87+
* Execute the command.
88+
*
89+
* @param command The command.
90+
* @param isRooted True to use root, false otherwise.
91+
* @param isNeedResultMsg True to return the message of result, false otherwise.
92+
* @return the single {@link CommandResult} instance
93+
*/
94+
public static CommandResult execCmd(final String command,
95+
final boolean isRooted,
96+
final boolean isNeedResultMsg) {
97+
return execCmd(new String[]{command}, isRooted, isNeedResultMsg);
98+
}
99+
100+
/**
101+
* Execute the command.
102+
*
103+
* @param commands The commands.
104+
* @param isRooted True to use root, false otherwise.
105+
* @param isNeedResultMsg True to return the message of result, false otherwise.
106+
* @return the single {@link CommandResult} instance
107+
*/
108+
public static CommandResult execCmd(final List<String> commands,
109+
final boolean isRooted,
110+
final boolean isNeedResultMsg) {
111+
return execCmd(commands == null ? null : commands.toArray(new String[]{}),
112+
isRooted,
113+
isNeedResultMsg);
114+
}
115+
116+
/**
117+
* Execute the command.
118+
*
119+
* @param commands The commands.
120+
* @param isRooted True to use root, false otherwise.
121+
* @param isNeedResultMsg True to return the message of result, false otherwise.
122+
* @return the single {@link CommandResult} instance
123+
*/
124+
public static CommandResult execCmd(final String[] commands,
125+
final boolean isRooted,
126+
final boolean isNeedResultMsg) {
127+
int result = -1;
128+
if (commands == null || commands.length == 0) {
129+
return new CommandResult(result, "", "");
130+
}
131+
Process process = null;
132+
BufferedReader successResult = null;
133+
BufferedReader errorResult = null;
134+
StringBuilder successMsg = null;
135+
StringBuilder errorMsg = null;
136+
DataOutputStream os = null;
137+
try {
138+
process = Runtime.getRuntime().exec(isRooted ? "su" : "sh");
139+
os = new DataOutputStream(process.getOutputStream());
140+
for (String command : commands) {
141+
if (command == null) continue;
142+
os.write(command.getBytes());
143+
os.writeBytes(LINE_SEP);
144+
os.flush();
145+
}
146+
os.writeBytes("exit" + LINE_SEP);
147+
os.flush();
148+
result = process.waitFor();
149+
if (isNeedResultMsg) {
150+
successMsg = new StringBuilder();
151+
errorMsg = new StringBuilder();
152+
successResult = new BufferedReader(
153+
new InputStreamReader(process.getInputStream(), "UTF-8")
154+
);
155+
errorResult = new BufferedReader(
156+
new InputStreamReader(process.getErrorStream(), "UTF-8")
157+
);
158+
String line;
159+
if ((line = successResult.readLine()) != null) {
160+
successMsg.append(line);
161+
while ((line = successResult.readLine()) != null) {
162+
successMsg.append(LINE_SEP).append(line);
163+
}
164+
}
165+
if ((line = errorResult.readLine()) != null) {
166+
errorMsg.append(line);
167+
while ((line = errorResult.readLine()) != null) {
168+
errorMsg.append(LINE_SEP).append(line);
169+
}
170+
}
171+
}
172+
} catch (Exception e) {
173+
e.printStackTrace();
174+
} finally {
175+
try {
176+
if (os != null) {
177+
os.close();
178+
}
179+
} catch (IOException e) {
180+
e.printStackTrace();
181+
}
182+
try {
183+
if (successResult != null) {
184+
successResult.close();
185+
}
186+
} catch (IOException e) {
187+
e.printStackTrace();
188+
}
189+
try {
190+
if (errorResult != null) {
191+
errorResult.close();
192+
}
193+
} catch (IOException e) {
194+
e.printStackTrace();
195+
}
196+
if (process != null) {
197+
process.destroy();
198+
}
199+
}
200+
return new CommandResult(
201+
result,
202+
successMsg == null ? "" : successMsg.toString(),
203+
errorMsg == null ? "" : errorMsg.toString()
204+
);
205+
}
206+
207+
/**
208+
* The result of command.
209+
*/
210+
public static class CommandResult {
211+
public int result;
212+
public String successMsg;
213+
public String errorMsg;
214+
215+
public CommandResult(final int result, final String successMsg, final String errorMsg) {
216+
this.result = result;
217+
this.successMsg = successMsg;
218+
this.errorMsg = errorMsg;
219+
}
220+
221+
@Override
222+
public String toString() {
223+
return "result: " + result + "\n" +
224+
"successMsg: " + successMsg + "\n" +
225+
"errorMsg: " + errorMsg;
226+
}
227+
}
228+
}

buildSrc/src/main/java/com/blankj/plugin/ReadmeCorePlugin.groovy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ class ReadmeCorePlugin implements Plugin<Project> {
3434
sb.append("* ### About ").append(utilsName).append(line.substring(line.indexOf(" -> ")))
3535
} else if (line.contains(": ") && !line.contains("[")) {
3636
sb.append(line.substring(0, line.indexOf(':')).trim())
37+
} else if (line.contains("打个小广告") || line.contains("知识星球") || line.contains("我的二维码")) {
38+
return
3739
} else {
3840
sb.append(line)
3941
}

gradle.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ android.useAndroidX=true
2020
org.gradle.jvmargs=-Xmx8192m -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -XX:-UseGCOverheadLimit -Dfile.encoding=UTF-8
2121
org.gradle.daemon=true
2222
#org.gradle.configureondemand=true
23-
#org.gradle.parallel=true
23+
org.gradle.parallel=true
24+
org.gradle.caching=true
2425

2526
#-Dorg.gradle.debug=true --no-daemon

0 commit comments

Comments
 (0)