Skip to content

Commit 2e8fd52

Browse files
committed
see 06/01 log
1 parent 3a2726d commit 2e8fd52

File tree

8 files changed

+38
-12
lines changed

8 files changed

+38
-12
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.16.3-brightgreen.svg
44+
[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.16.4-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 project helps you a lot and you want to support the project's developmen
4141

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

44-
[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.16.3-brightgreen.svg
44+
[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.16.4-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
@@ -57,5 +57,5 @@ dependencies {
5757
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
5858
debugImplementation "com.squareup.leakcanary:leakcanary-android:$leakcanary_version"
5959
releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$leakcanary_version"
60-
// implementation 'com.blankj:utilcode:1.16.3'
60+
// implementation 'com.blankj:utilcode:1.16.4'
6161
}

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ ext {
4444
min_sdk_version = 14
4545
target_sdk_version = 27
4646

47-
version_code = 1_016_003
48-
version_name = '1.16.3'// E.g 1.9.72 => 1,009,072
47+
version_code = 1_016_004
48+
version_name = '1.16.4'// E.g 1.9.72 => 1,009,072
4949

5050
// App dependencies
5151
support_version = '27.1.0'

update_log.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
* 18/05/30 完善 DeviceUtils#getMacAddress,发布 1.16.4 版本
12
* 18/05/30 修复 ToastUtils 在 targetSdkVersion 为 27 在 api 25 机器快速 show 两次崩溃的异常,发布 1.16.3 版本
23
* 18/05/29 完善 TimeUtils 的 timeSpan 带符号位,ToastUtils 去除弱引用,发布 1.16.2 版本
34
* 18/05/25 新增 AppUtils#registerAppStatusChangedListener 和 AppUtils#unregisterAppStatusChangedListener,发布 1.16.1 版本

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-
implementation 'com.blankj:utilcode:1.16.3'
5+
implementation 'com.blankj:utilcode:1.16.4'
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-
implementation 'com.blankj:utilcode:1.16.3'
5+
implementation 'com.blankj:utilcode:1.16.4'
66
```
77

88

utilcode/src/main/java/com/blankj/utilcode/util/DeviceUtils.java

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,23 +93,48 @@ public static String getAndroidID() {
9393
*/
9494
@RequiresPermission(allOf = {ACCESS_WIFI_STATE, INTERNET})
9595
public static String getMacAddress() {
96+
return getMacAddress((String[]) null);
97+
}
98+
99+
/**
100+
* Return the MAC address.
101+
* <p>Must hold
102+
* {@code <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />},
103+
* {@code <uses-permission android:name="android.permission.INTERNET" />}</p>
104+
*
105+
* @return the MAC address
106+
*/
107+
@RequiresPermission(allOf = {ACCESS_WIFI_STATE, INTERNET})
108+
public static String getMacAddress(final String... excepts) {
96109
String macAddress = getMacAddressByWifiInfo();
97-
if (!"02:00:00:00:00:00".equals(macAddress)) {
110+
if (isAddressNotInExcepts(macAddress, excepts)) {
98111
return macAddress;
99112
}
100113
macAddress = getMacAddressByNetworkInterface();
101-
if (!"02:00:00:00:00:00".equals(macAddress)) {
114+
if (isAddressNotInExcepts(macAddress, excepts)) {
102115
return macAddress;
103116
}
104117
macAddress = getMacAddressByInetAddress();
105-
if (!"02:00:00:00:00:00".equals(macAddress)) {
118+
if (isAddressNotInExcepts(macAddress, excepts)) {
106119
return macAddress;
107120
}
108121
macAddress = getMacAddressByFile();
109-
if (!"02:00:00:00:00:00".equals(macAddress)) {
122+
if (isAddressNotInExcepts(macAddress, excepts)) {
110123
return macAddress;
111124
}
112-
return "please open wifi";
125+
return "";
126+
}
127+
128+
private static boolean isAddressNotInExcepts(final String address, final String... excepts) {
129+
if (excepts == null || excepts.length == 0) {
130+
return !"02:00:00:00:00:00".equals(address);
131+
}
132+
for (String filter : excepts) {
133+
if (address.equals(filter)) {
134+
return false;
135+
}
136+
}
137+
return true;
113138
}
114139

115140
@SuppressLint({"HardwareIds", "MissingPermission"})

0 commit comments

Comments
 (0)