Skip to content

Commit

Permalink
修复关闭通知入口导致空指针的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
getActivity committed Dec 21, 2022
1 parent cd037c4 commit cfc9415
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 15 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

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

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

![](picture/demo_code.png)

Expand Down Expand Up @@ -51,7 +51,7 @@ dependencyResolutionManagement {
```groovy
dependencies {
// 日志调试框架:https://github.com/getActivity/Logcat
debugImplementation 'com.github.getActivity:Logcat:11.0'
debugImplementation 'com.github.getActivity:Logcat:11.2'
}
```

Expand Down
8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "com.hjq.logcat.demo"
minSdkVersion 16
targetSdkVersion 31
versionCode 1100
versionName "11.0"
versionCode 1120
versionName "11.2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

Expand Down Expand Up @@ -65,8 +65,8 @@ dependencies {
implementation 'com.github.getActivity:TitleBar:9.6'

// 吐司框架:https://github.com/getActivity/ToastUtils
implementation 'com.github.getActivity:ToastUtils:10.5'
implementation 'com.github.getActivity:ToastUtils:11.2'

// 内存泄漏捕捉:https://github.com/square/leakcanary
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.9.1'
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.10'
}
5 changes: 0 additions & 5 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@
android:name="LogcatNotifyEntrance"
android:value="true" />

<!-- 通知栏入口 -->
<meta-data
android:name="LogcatNotifyEntrance"
android:value="true" />

<!-- &lt;!&ndash; 默认搜索关键字 &ndash;&gt;-->
<!-- <meta-data-->
<!-- android:name="LogcatDefaultSearchKey"-->
Expand Down
4 changes: 2 additions & 2 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {

defaultConfig {
minSdkVersion 16
versionCode 1100
versionName "11.0"
versionCode 1120
versionName "11.2"
}

lintOptions {
Expand Down
5 changes: 3 additions & 2 deletions library/src/main/java/com/hjq/logcat/LogcatProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ public final class LogcatProvider extends ContentProvider {
public boolean onCreate() {
Context context = getContext();
if (context != null) {
// 初始化 Logcat 配置项
LogcatConfig.init(context.getApplicationContext());

Boolean notifyEntrance = LogcatUtils.getMetaBooleanData(
context, LogcatContract.META_DATA_LOGCAT_NOTIFY_ENTRANCE);
Boolean windowEntrance = LogcatUtils.getMetaBooleanData(
Expand All @@ -34,8 +37,6 @@ public boolean onCreate() {
}

if (notifyEntrance != null && notifyEntrance) {
LogcatConfig.init(context.getApplicationContext());

if (context instanceof Application) {
ForegroundServiceStartTask.with((Application) context);
}
Expand Down

0 comments on commit cfc9415

Please sign in to comment.