Skip to content

Commit af90f7a

Browse files
see 12/30 log
1 parent 376c708 commit af90f7a

File tree

20 files changed

+130
-79
lines changed

20 files changed

+130
-79
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ local.properties
1111
/apk
1212
*.phrof
1313
/maven
14-
/reports
14+
/reports
15+
*/reports

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
* `19/12/08` [add] Publish bus plugin v2.5.
12
* `19/12/06` [add] Publish api plugin v1.3.
23
* `19/11/30` [add] Publish bus plugin v2.4. Publish api plugin v1.2.
34
* `19/11/28` [add] Publish v1.26.0.

buildSrc/src/main/groovy/Config.groovy

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Config {
1515
static minSdkVersion = 14
1616
static targetSdkVersion = 28
1717
static versionCode = 1_026_001
18-
static versionName = '1.26.1'// E.g. 1.9.72 => 1,009,072
18+
static versionName = '1.26.1-alpha1'// E.g. 1.9.72 => 1,009,072
1919

2020
// lib version
2121
static gradlePluginVersion = '3.5.2'
@@ -26,8 +26,8 @@ class Config {
2626
static depConfig = [
2727
/*Never delete this line*/
2828
/*Generated by "config.json"*/
29-
plugin_api_gradle_plugin : new DepConfig(false, true, ":plugin:api-gradle-plugin"),
30-
plugin_bus_gradle_plugin : new DepConfig(false, true, ":plugin:bus-gradle-plugin"),
29+
plugin_api_gradle_plugin : new DepConfig(true, true, ":plugin:api-gradle-plugin"),
30+
plugin_bus_gradle_plugin : new DepConfig(true, true, ":plugin:bus-gradle-plugin"),
3131
feature_mock : new DepConfig(false, true, ":feature:mock"),
3232
feature_launcher_app : new DepConfig(true, true, ":feature:launcher:app"),
3333
feature_main_app : new DepConfig(false, true, ":feature:main:app"),
@@ -55,7 +55,7 @@ class Config {
5555
// 本地上传成功之后 isApply = true 即可应用插件来调试,后续版本更新无需设置 isApply = false
5656
// 发布版本的话把 isApply = false, useLocal = false,更新版本号,发布成功后 isApply = true 即可使用远程库版本
5757
plugin_api : new DepConfig(isApply: true, useLocal: false, pluginPath: "com.blankj:api-gradle-plugin:1.3", pluginId: "com.blankj.api"),
58-
plugin_bus : new DepConfig(isApply: true, useLocal: false, pluginPath: "com.blankj:bus-gradle-plugin:2.4", pluginId: "com.blankj.bus"),
58+
plugin_bus : new DepConfig(isApply: true, useLocal: false, pluginPath: "com.blankj:bus-gradle-plugin:2.5", pluginId: "com.blankj.bus"),
5959

6060
support_appcompat_v7 : new DepConfig("com.android.support:appcompat-v7:$supportVersion"),
6161
support_design : new DepConfig("com.android.support:design:$supportVersion"),

config.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"pkgConfig": [],
66
"proConfigDesc": "proConfig 配置的是使用本地还是仓库,优先级低于 appConfig 和 pkgConfig",
77
"proConfig": [
8-
{"isApply": false, "useLocal": true, "localPath": ":plugin:api-gradle-plugin"},
9-
{"isApply": false, "useLocal": true, "localPath": ":plugin:bus-gradle-plugin"},
8+
{"isApply": true, "useLocal": true, "localPath": ":plugin:api-gradle-plugin"},
9+
{"isApply": true, "useLocal": true, "localPath": ":plugin:bus-gradle-plugin"},
1010
{"isApply": true, "useLocal": true, "localPath": ":feature:mock"},
1111
{"isApply": true, "useLocal": true, "localPath": ":feature:launcher:app"},
1212
{"isApply": true, "useLocal": true, "localPath": ":feature:main:app"},

feature/main/pkg/src/main/java/com/blankj/main/pkg/MainActivity.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@ import com.blankj.common.item.CommonItem
99
import com.blankj.common.item.CommonItemClick
1010
import com.blankj.subutil.export.api.SubUtilApi
1111
import com.blankj.utilcode.export.api.UtilCodeApi
12-
import com.blankj.utilcode.util.ActivityUtils
13-
import com.blankj.utilcode.util.ApiUtils
14-
import com.blankj.utilcode.util.BarUtils
15-
import com.blankj.utilcode.util.CollectionUtils
12+
import com.blankj.utilcode.util.*
1613
import kotlinx.android.synthetic.main.activity_main.*
1714

1815

feature/utilcode/pkg/src/main/java/com/blankj/utilcode/pkg/feature/shadow/ShadowActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class ShadowActivity : CommonActivity() {
4141
super.initView(savedInstanceState, contentView)
4242
ShadowUtils.apply(shadowRectView, Config().setShadowRadius(0.01f).setShadowColor(Color.BLUE, Color.GREEN))
4343
ShadowUtils.apply(shadowRoundRectView, Config().setShadowRadius(
44-
SizeUtils.dp2px(16f).toFloat()).setShadowColor(Color.RED, Color.BLUE))
44+
SizeUtils.dp2px(16f).toFloat()))
4545
ShadowUtils.apply(shadowCircleView, Config().setCircle().setShadowColor(Color.GREEN, Color.BLUE))
4646
}
4747
}

lib/utilcode/README-CN.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -578,8 +578,11 @@ clickBlankArea2HideSoftInput : 点击屏幕空白区域隐藏软键盘
578578

579579
* ### 语言相关 -> [LanguageUtils.java][language.java] -> [Demo][language.demo]
580580
```
581-
applySystemLanguage: 应用系统语言
582-
applyLanguage : 应用语言
581+
applySystemLanguage : 应用系统语言
582+
applyLanguage : 应用语言
583+
isAppliedSystemLanguage: 判断是否使用系统语言
584+
isAppliedLanguage : 判断是否使用某语言
585+
getCurrentLocale : 获取当前语言
583586
```
584587

585588
* ### 日志相关 -> [LogUtils.java][log.java] -> [Demo][log.demo]
@@ -1010,6 +1013,8 @@ toSBC : 转化为全角字符
10101013
* ### 线程相关 -> [ThreadUtils.java][thread.java] -> [Test][thread.test]
10111014
```
10121015
isMainThread : 判断当前是否主线程
1016+
runOnUiThread : 运行在主线程
1017+
runOnUiThreadDelayed : 延时运行在主线程
10131018
getFixedPool : 获取固定线程池
10141019
getSinglePool : 获取单线程池
10151020
getCachedPool : 获取缓冲线程池

lib/utilcode/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,9 @@ clickBlankArea2HideSoftInput
580580
```
581581
applySystemLanguage
582582
applyLanguage
583+
isAppliedSystemLanguage
584+
isAppliedLanguage
585+
getCurrentLocale
583586
```
584587

585588
* ### About Log -> [LogUtils.java][log.java] -> [Demo][log.demo]
@@ -1010,6 +1013,8 @@ toSBC
10101013
* ### About Thread -> [ThreadUtils.java][thread.java] -> [Test][thread.test]
10111014
```
10121015
isMainThread
1016+
runOnUiThread
1017+
runOnUiThreadDelayed
10131018
getFixedPool
10141019
getSinglePool
10151020
getCachedPool

lib/utilcode/build.gradle

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,28 @@ readme {
1111
readmeCnFile file('./README-CN.md')
1212
}
1313

14+
android {
15+
compileSdkVersion Config.compileSdkVersion
16+
defaultConfig {
17+
minSdkVersion Config.minSdkVersion
18+
versionCode Config.versionCode
19+
versionName Config.versionName
20+
consumerProguardFiles 'proguard-rules.pro'
21+
}
22+
23+
buildTypes {
24+
release {
25+
minifyEnabled false
26+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
27+
consumerProguardFiles 'proguard-rules.pro'
28+
}
29+
}
30+
31+
lintOptions {
32+
abortOnError false
33+
}
34+
}
35+
1436
dependencies {
1537
implementation Config.depConfig.gson.dep
1638

lib/utilcode/src/main/java/com/blankj/utilcode/util/ActivityUtils.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
import android.util.Log;
2121
import android.view.View;
2222

23+
import java.lang.ref.WeakReference;
24+
import java.lang.reflect.Field;
2325
import java.util.ArrayList;
2426
import java.util.List;
2527

@@ -55,6 +57,16 @@ public static Activity getActivityByView(@NonNull View view) {
5557
*/
5658
public static Activity getActivityByContext(Context context) {
5759
if (context instanceof Activity) return (Activity) context;
60+
if (context != null && context.getClass().getName().equals("com.android.internal.policy.DecorContext")) {
61+
try {
62+
Field mActivityContextField = context.getClass().getDeclaredField("mActivityContext");
63+
mActivityContextField.setAccessible(true);
64+
//noinspection unchecked
65+
return ((WeakReference<Activity>) mActivityContextField.get(context)).get();
66+
} catch (Exception e) {
67+
e.printStackTrace();
68+
}
69+
}
5870
while (context instanceof ContextWrapper) {
5971
if (context instanceof Activity) {
6072
return (Activity) context;

0 commit comments

Comments
 (0)