Skip to content

Commit cfc9415

Browse files
committed
修复关闭通知入口导致空指针的问题
1 parent cd037c4 commit cfc9415

File tree

5 files changed

+11
-15
lines changed

5 files changed

+11
-15
lines changed

README.md

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

55
* 项目地址:[Github](https://github.com/getActivity/Logcat)
66

7-
* 可以扫码下载 Demo 进行演示或者测试,如果扫码下载不了的,[点击此处可直接下载](https://github.com/getActivity/Logcat/releases/download/11.0/Logcat.apk)
7+
* 可以扫码下载 Demo 进行演示或者测试,如果扫码下载不了的,[点击此处可直接下载](https://github.com/getActivity/Logcat/releases/download/11.2/Logcat.apk)
88

99
![](picture/demo_code.png)
1010

@@ -51,7 +51,7 @@ dependencyResolutionManagement {
5151
```groovy
5252
dependencies {
5353
// 日志调试框架:https://github.com/getActivity/Logcat
54-
debugImplementation 'com.github.getActivity:Logcat:11.0'
54+
debugImplementation 'com.github.getActivity:Logcat:11.2'
5555
}
5656
```
5757

app/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ android {
77
applicationId "com.hjq.logcat.demo"
88
minSdkVersion 16
99
targetSdkVersion 31
10-
versionCode 1100
11-
versionName "11.0"
10+
versionCode 1120
11+
versionName "11.2"
1212
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
1313
}
1414

@@ -65,8 +65,8 @@ dependencies {
6565
implementation 'com.github.getActivity:TitleBar:9.6'
6666

6767
// 吐司框架:https://github.com/getActivity/ToastUtils
68-
implementation 'com.github.getActivity:ToastUtils:10.5'
68+
implementation 'com.github.getActivity:ToastUtils:11.2'
6969

7070
// 内存泄漏捕捉:https://github.com/square/leakcanary
71-
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.9.1'
71+
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.10'
7272
}

app/src/main/AndroidManifest.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,6 @@
3535
android:name="LogcatNotifyEntrance"
3636
android:value="true" />
3737

38-
<!-- 通知栏入口 -->
39-
<meta-data
40-
android:name="LogcatNotifyEntrance"
41-
android:value="true" />
42-
4338
<!-- &lt;!&ndash; 默认搜索关键字 &ndash;&gt;-->
4439
<!-- <meta-data-->
4540
<!-- android:name="LogcatDefaultSearchKey"-->

library/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ android {
99

1010
defaultConfig {
1111
minSdkVersion 16
12-
versionCode 1100
13-
versionName "11.0"
12+
versionCode 1120
13+
versionName "11.2"
1414
}
1515

1616
lintOptions {

library/src/main/java/com/hjq/logcat/LogcatProvider.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ public final class LogcatProvider extends ContentProvider {
2121
public boolean onCreate() {
2222
Context context = getContext();
2323
if (context != null) {
24+
// 初始化 Logcat 配置项
25+
LogcatConfig.init(context.getApplicationContext());
26+
2427
Boolean notifyEntrance = LogcatUtils.getMetaBooleanData(
2528
context, LogcatContract.META_DATA_LOGCAT_NOTIFY_ENTRANCE);
2629
Boolean windowEntrance = LogcatUtils.getMetaBooleanData(
@@ -34,8 +37,6 @@ public boolean onCreate() {
3437
}
3538

3639
if (notifyEntrance != null && notifyEntrance) {
37-
LogcatConfig.init(context.getApplicationContext());
38-
3940
if (context instanceof Application) {
4041
ForegroundServiceStartTask.with((Application) context);
4142
}

0 commit comments

Comments
 (0)