diff --git a/README.md b/README.md
index 2e699a4..3af6cb8 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@
* 项目地址:[Github](https://github.com/getActivity/Logcat)、[码云](https://gitee.com/getActivity/Logcat)
-* 可以扫码下载 Demo 进行演示或者测试,如果扫码下载不了的,[点击此处可直接下载](https://github.com/getActivity/Logcat/releases/download/10.0/Logcat.apk)
+* 可以扫码下载 Demo 进行演示或者测试,如果扫码下载不了的,[点击此处可直接下载](https://github.com/getActivity/Logcat/releases/download/10.2/Logcat.apk)
![](picture/demo_code.png)
@@ -53,7 +53,7 @@ dependencyResolutionManagement {
```groovy
dependencies {
// 日志调试框架:https://github.com/getActivity/Logcat
- debugImplementation 'com.github.getActivity:Logcat:10.0'
+ debugImplementation 'com.github.getActivity:Logcat:10.2'
}
```
@@ -61,7 +61,7 @@ dependencies {
* 如果项目是基于 **AndroidX** 包,请在项目 `gradle.properties` 文件中加入
-```groovy
+```text
# 表示将第三方库迁移到 AndroidX
android.enableJetifier = true
```
@@ -106,9 +106,24 @@ android.enableJetifier = true
```
+#### 方向配置
+
+* `LogcatActivity` 默认是跟随手机屏幕方向的,如果你需要固定竖屏方向,那么需要在你的清单文件中加入此配置:
+
+```xml
+
+```
+
#### 日志颜色个性化
-* 在项目的 `values/color.xml` 中加入你喜欢的配色,例如
+* 在项目的 `values/color.xml` 中加入你喜欢的配色,例如:
```xml
#FFBBBBBB
@@ -121,7 +136,7 @@ android.enableJetifier = true
#### 过滤日志
-* 在项目的 `values/string.xml` 中加入你要过滤的日志 TAG,例如
+* 在项目的 `values/string.xml` 中加入你要过滤的日志 TAG,例如:
```xml
diff --git a/app/build.gradle b/app/build.gradle
index 7f362ce..71a9b04 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -7,8 +7,8 @@ android {
applicationId "com.hjq.logcat.demo"
minSdkVersion 16
targetSdkVersion 31
- versionCode 1000
- versionName "10.0"
+ versionCode 1020
+ versionName "10.2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
@@ -65,8 +65,8 @@ dependencies {
implementation 'com.github.getActivity:TitleBar:9.3'
// 吐司框架:https://github.com/getActivity/ToastUtils
- implementation 'com.github.getActivity:ToastUtils:10.0'
+ implementation 'com.github.getActivity:ToastUtils:10.2'
// 内存泄漏捕捉:https://github.com/square/leakcanary
- debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.7'
+ debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.8.1'
}
\ No newline at end of file
diff --git a/app/src/main/java/com/hjq/logcat/demo/MainActivity.java b/app/src/main/java/com/hjq/logcat/demo/MainActivity.java
index f8ef1d3..561043a 100644
--- a/app/src/main/java/com/hjq/logcat/demo/MainActivity.java
+++ b/app/src/main/java/com/hjq/logcat/demo/MainActivity.java
@@ -7,6 +7,7 @@
import android.support.v7.app.AppCompatActivity;
import android.view.ViewGroup;
import android.webkit.WebChromeClient;
+import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
@@ -30,6 +31,11 @@ protected void onCreate(Bundle savedInstanceState) {
mWebView = findViewById(R.id.wv_main_web);
mWebView.setWebViewClient(new WebViewClient());
mWebView.setWebChromeClient(new MyWebChromeClient());
+
+ if (!String.valueOf(System.currentTimeMillis()).endsWith("1")) {
+ mWebView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
+ }
+
mWebView.loadUrl("https://github.com/getActivity/Logcat");
if (NotificationManagerCompat.from(this).areNotificationsEnabled()) {
diff --git a/app/src/main/res/values-v21/styles.xml b/app/src/main/res/values-v23/styles.xml
similarity index 75%
rename from app/src/main/res/values-v21/styles.xml
rename to app/src/main/res/values-v23/styles.xml
index 5b93a18..119e759 100644
--- a/app/src/main/res/values-v21/styles.xml
+++ b/app/src/main/res/values-v23/styles.xml
@@ -1,14 +1,16 @@
-
-
-
-
-
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index d400876..cd5effc 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1,85 +1,86 @@
-
- Logcat
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+ Logcat
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index 9f4db37..f43ca09 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -1,13 +1,14 @@
-
-
-
-
-
+
+
+
+
+
+
\ No newline at end of file
diff --git a/library/build.gradle b/library/build.gradle
index d80bd6f..55d155a 100644
--- a/library/build.gradle
+++ b/library/build.gradle
@@ -9,8 +9,8 @@ android {
defaultConfig {
minSdkVersion 16
- versionCode 1000
- versionName "10.0"
+ versionCode 1020
+ versionName "10.2"
}
lintOptions {
diff --git a/library/src/main/AndroidManifest.xml b/library/src/main/AndroidManifest.xml
index 3136b67..bc502a3 100644
--- a/library/src/main/AndroidManifest.xml
+++ b/library/src/main/AndroidManifest.xml
@@ -1,3 +1,4 @@
+
@@ -5,6 +6,9 @@
+
+
+
+ android:launchMode="singleInstance"
+ android:theme="@style/Theme.AppCompat.Light.NoActionBar"
+ android:windowSoftInputMode="stateHidden" />
diff --git a/library/src/main/java/com/hjq/logcat/ChooseWindow.java b/library/src/main/java/com/hjq/logcat/ChooseWindow.java
index 0d990b1..c16eea2 100644
--- a/library/src/main/java/com/hjq/logcat/ChooseWindow.java
+++ b/library/src/main/java/com/hjq/logcat/ChooseWindow.java
@@ -1,6 +1,7 @@
package com.hjq.logcat;
import android.app.Activity;
+import android.os.Build;
import android.view.Gravity;
import android.view.View;
import android.view.WindowManager;
@@ -19,7 +20,8 @@
* time : 2020/01/24
* desc : 列表选择类
*/
-final class ChooseWindow extends XToast implements AdapterView.OnItemClickListener, XToast.OnClickListener {
+final class ChooseWindow extends XToast implements
+ AdapterView.OnItemClickListener, XToast.OnClickListener {
private final ChooseAdapter mAdapter;
private OnListener mListener;
@@ -28,6 +30,10 @@ final class ChooseWindow extends XToast implements AdapterView.OnI
super(activity);
setContentView(R.layout.logcat_window_choose);
setGravity(Gravity.CENTER);
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
+ // 设置沉浸式状态栏
+ addWindowFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
+ }
clearWindowFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
ListView listView = findViewById(R.id.lv_choose_list);
diff --git a/library/src/main/java/com/hjq/logcat/LogcatActivity.java b/library/src/main/java/com/hjq/logcat/LogcatActivity.java
index 8f0afe0..bd7f603 100644
--- a/library/src/main/java/com/hjq/logcat/LogcatActivity.java
+++ b/library/src/main/java/com/hjq/logcat/LogcatActivity.java
@@ -455,6 +455,10 @@ private void refreshLayout() {
if (window != null) {
// 在竖屏的状态下显示状态栏和导航栏
window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+ // 实现状态栏图标和文字颜色为亮色
+ window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
+ }
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
if (window != null) {
diff --git a/library/src/main/java/com/hjq/logcat/LogcatService.java b/library/src/main/java/com/hjq/logcat/LogcatService.java
index 9ec02c8..14ae13b 100644
--- a/library/src/main/java/com/hjq/logcat/LogcatService.java
+++ b/library/src/main/java/com/hjq/logcat/LogcatService.java
@@ -29,7 +29,14 @@ public IBinder onBind(Intent intent) {
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
Intent notificationIntent = new Intent(this, LogcatActivity.class);
- PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
+ int pendingIntentFlag = 0;
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
+ // Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
+ // Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g.
+ // if it needs to be used with inline replies or bubbles.
+ pendingIntentFlag = PendingIntent.FLAG_MUTABLE;
+ }
+ PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, pendingIntentFlag);
String applicationName = getApplicationName();
if (TextUtils.isEmpty(applicationName)) {