Skip to content

Commit bc1fade

Browse files
committed
see 02/12 log
1 parent 31c5a6b commit bc1fade

File tree

15 files changed

+364
-343
lines changed

15 files changed

+364
-343
lines changed

README-CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
[logo]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/logo.png
4343

44-
[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.12.5-brightgreen.svg
44+
[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.12.6-brightgreen.svg
4545
[auc]: https://github.com/Blankj/AndroidUtilCode
4646

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

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ If this ptoject helps you a lot, and you would like to support this ptoject's fu
4141

4242
[logo]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/logo.png
4343

44-
[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.12.5-brightgreen.svg
44+
[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.12.6-brightgreen.svg
4545
[auc]: https://github.com/Blankj/AndroidUtilCode
4646

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

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ dependencies {
5656
// LeakCanary
5757
debugImplementation "com.squareup.leakcanary:leakcanary-android:$leakcanary_version"
5858
releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$leakcanary_version"
59-
// implementation 'com.blankj:utilcode:1.12.5'
59+
// implementation 'com.blankj:utilcode:1.12.6'
6060
}
6161

6262

app/src/main/java/com/blankj/androidutilcode/feature/core/network/NetworkActivity.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public void initView(Bundle savedInstanceState, View view) {
7373
tvAboutNetworkAsync = findViewById(R.id.tv_about_network_async);
7474
findViewById(R.id.btn_open_wireless_settings).setOnClickListener(this);
7575
findViewById(R.id.btn_set_wifi_enabled).setOnClickListener(this);
76-
setAboutNetwork();
76+
updateAboutNetwork();
7777
}
7878

7979
@Override
@@ -112,10 +112,10 @@ public void onWidgetClick(View view) {
112112
NetworkUtils.setWifiEnabled(!NetworkUtils.getWifiEnabled());
113113
break;
114114
}
115-
setAboutNetwork();
115+
updateAboutNetwork();
116116
}
117117

118-
private void setAboutNetwork() {
118+
private void updateAboutNetwork() {
119119
tvAboutNetwork.setText(new SpanUtils()
120120
.appendLine("isConnected: " + NetworkUtils.isConnected())
121121
.appendLine("getMobileDataEnabled: " + NetworkUtils.getMobileDataEnabled())

app/src/main/java/com/blankj/androidutilcode/feature/core/screen/ScreenActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public void initData(Bundle bundle) {
3737

3838
@Override
3939
public int bindLayout() {
40-
return R.layout.activity_brightness;
40+
return R.layout.activity_screen;
4141
}
4242

4343
@Override

subutil/src/main/java/com/blankj/subutil/util/BrightnessUtils.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,19 @@ public static int getBrightness() {
9191
*
9292
* @param brightness 亮度值
9393
*/
94-
public static void setBrightness(@IntRange(from = 0, to = 255) final int brightness) {
94+
public static boolean setBrightness(@IntRange(from = 0, to = 255) final int brightness) {
95+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
96+
&& !Settings.System.canWrite(Utils.getApp())) {
97+
Intent intent = new Intent(android.provider.Settings.ACTION_MANAGE_WRITE_SETTINGS);
98+
intent.setData(Uri.parse("package:" + Utils.getApp().getPackageName()));
99+
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
100+
Utils.getApp().startActivity(intent);
101+
return false;
102+
}
95103
ContentResolver resolver = Utils.getApp().getContentResolver();
96-
Settings.System.putInt(resolver, Settings.System.SCREEN_BRIGHTNESS, brightness);
104+
boolean b = Settings.System.putInt(resolver, Settings.System.SCREEN_BRIGHTNESS, brightness);
97105
resolver.notifyChange(Settings.System.getUriFor("screen_brightness"), null);
106+
return b;
98107
}
99108

100109
/**

utilcode/README-CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Gradle:
44
```groovy
5-
compile 'com.blankj:utilcode:1.12.5'
5+
compile 'com.blankj:utilcode:1.12.6'
66
```
77

88

utilcode/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Gradle:
44
```groovy
5-
compile 'com.blankj:utilcode:1.12.5'
5+
compile 'com.blankj:utilcode:1.12.6'
66
```
77

88

utilcode/src/main/java/com/blankj/utilcode/constant/MemoryConstants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* author: Blankj
1111
* blog : http://blankj.com
1212
* time : 2017/03/13
13-
* desc : The constants of memory
13+
* desc : The constants of memory.
1414
* </pre>
1515
*/
1616
public final class MemoryConstants {

utilcode/src/main/java/com/blankj/utilcode/constant/PermissionConstants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* author: Blankj
1515
* blog : http://blankj.com
1616
* time : 2017/12/29
17-
* desc : The constants of permission
17+
* desc : The constants of permission.
1818
* </pre>
1919
*/
2020
@SuppressLint("InlinedApi")

utilcode/src/main/java/com/blankj/utilcode/constant/RegexConstants.java

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55
* author: Blankj
66
* blog : http://blankj.com
77
* time : 2017/03/13
8-
* desc : The constants of regex
8+
* desc : The constants of regex.
99
* </pre>
1010
*/
1111
public final class RegexConstants {
1212

1313
/**
14-
* regex of simple mobile
14+
* Regex of simple mobile.
1515
*/
1616
public static final String REGEX_MOBILE_SIMPLE = "^[1]\\d{10}$";
1717
/**
18-
* regex of exact mobile
18+
* Regex of exact mobile.
1919
* <p>china mobile: 134(0-8), 135, 136, 137, 138, 139, 147, 150, 151, 152, 157, 158, 159, 178, 182, 183, 184, 187, 188, 198</p>
2020
* <p>china unicom: 130, 131, 132, 145, 155, 156, 166, 171, 175, 176, 185, 186</p>
2121
* <p>china telecom: 133, 153, 173, 177, 180, 181, 189, 199</p>
@@ -24,91 +24,91 @@ public final class RegexConstants {
2424
*/
2525
public static final String REGEX_MOBILE_EXACT = "^((13[0-9])|(14[5,7])|(15[0-3,5-9])|(16[6])|(17[0,1,3,5-8])|(18[0-9])|(19[8,9]))\\d{8}$";
2626
/**
27-
* regex of telephone number
27+
* Regex of telephone number.
2828
*/
2929
public static final String REGEX_TEL = "^0\\d{2,3}[- ]?\\d{7,8}";
3030
/**
31-
* regex of id card number which length is 15
31+
* Regex of id card number which length is 15.
3232
*/
3333
public static final String REGEX_ID_CARD15 = "^[1-9]\\d{7}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}$";
3434
/**
35-
* regex of id card number which length is 18
35+
* Regex of id card number which length is 18.
3636
*/
3737
public static final String REGEX_ID_CARD18 = "^[1-9]\\d{5}[1-9]\\d{3}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}([0-9Xx])$";
3838
/**
39-
* regex of email
39+
* Regex of email.
4040
*/
4141
public static final String REGEX_EMAIL = "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$";
4242
/**
43-
* regex of url
43+
* Regex of url.
4444
*/
4545
public static final String REGEX_URL = "[a-zA-z]+://[^\\s]*";
4646
/**
47-
* regex of Chinese character
47+
* Regex of Chinese character.
4848
*/
4949
public static final String REGEX_ZH = "^[\\u4e00-\\u9fa5]+$";
5050
/**
51-
* regex of username
51+
* Regex of username.
5252
* <p>scope for "a-z", "A-Z", "0-9", "_", "Chinese character"</p>
5353
* <p>can't end with "_"</p>
5454
* <p>length is between 6 to 20</p>
5555
*/
5656
public static final String REGEX_USERNAME = "^[\\w\\u4e00-\\u9fa5]{6,20}(?<!_)$";
5757
/**
58-
* regex of date which pattern is "yyyy-MM-dd"
58+
* Regex of date which pattern is "yyyy-MM-dd".
5959
*/
6060
public static final String REGEX_DATE = "^(?:(?!0000)[0-9]{4}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-8])|(?:0[13-9]|1[0-2])-(?:29|30)|(?:0[13578]|1[02])-31)|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)-02-29)$";
6161
/**
62-
* regex of ip address
62+
* Regex of ip address.
6363
*/
6464
public static final String REGEX_IP = "((2[0-4]\\d|25[0-5]|[01]?\\d\\d?)\\.){3}(2[0-4]\\d|25[0-5]|[01]?\\d\\d?)";
6565

6666
///////////////////////////////////////////////////////////////////////////
67-
// the following comes from http://tool.oschina.net/regex
67+
// The following come from http://tool.oschina.net/regex
6868
///////////////////////////////////////////////////////////////////////////
6969

7070
/**
71-
* regex of double-byte characters
71+
* Regex of double-byte characters.
7272
*/
7373
public static final String REGEX_DOUBLE_BYTE_CHAR = "[^\\x00-\\xff]";
7474
/**
75-
* regex of blank line
75+
* Regex of blank line.
7676
*/
7777
public static final String REGEX_BLANK_LINE = "\\n\\s*\\r";
7878
/**
79-
* regex of QQ number
79+
* Regex of QQ number.
8080
*/
8181
public static final String REGEX_QQ_NUM = "[1-9][0-9]{4,}";
8282
/**
83-
* regex of postal code in China
83+
* Regex of postal code in China.
8484
*/
8585
public static final String REGEX_CHINA_POSTAL_CODE = "[1-9]\\d{5}(?!\\d)";
8686
/**
87-
* regex of positive integer
87+
* Regex of positive integer.
8888
*/
8989
public static final String REGEX_POSITIVE_INTEGER = "^[1-9]\\d*$";
9090
/**
91-
* regex of negative integer
91+
* Regex of negative integer.
9292
*/
9393
public static final String REGEX_NEGATIVE_INTEGER = "^-[1-9]\\d*$";
9494
/**
95-
* regex of integer
95+
* Regex of integer.
9696
*/
9797
public static final String REGEX_INTEGER = "^-?[1-9]\\d*$";
9898
/**
99-
* regex of non-negative integer
99+
* Regex of non-negative integer.
100100
*/
101101
public static final String REGEX_NOT_NEGATIVE_INTEGER = "^[1-9]\\d*|0$";
102102
/**
103-
* regex of non-positive integer
103+
* Regex of non-positive integer.
104104
*/
105105
public static final String REGEX_NOT_POSITIVE_INTEGER = "^-[1-9]\\d*|0$";
106106
/**
107-
* regex of positive float
107+
* Regex of positive float.
108108
*/
109109
public static final String REGEX_POSITIVE_FLOAT = "^[1-9]\\d*\\.\\d*|0\\.\\d*[1-9]\\d*$";
110110
/**
111-
* regex of negative float
111+
* Regex of negative float.
112112
*/
113113
public static final String REGEX_NEGATIVE_FLOAT = "^-[1-9]\\d*\\.\\d*|-0\\.\\d*[1-9]\\d*$";
114114

utilcode/src/main/java/com/blankj/utilcode/constant/TimeConstants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* author: Blankj
1111
* blog : http://blankj.com
1212
* time : 2017/03/13
13-
* desc : The constants of time
13+
* desc : The constants of time.
1414
* </pre>
1515
*/
1616
public final class TimeConstants {

0 commit comments

Comments
 (0)