-
-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
优化 Android 14 前台 Service 类型适配 优化 Logcat 在有悬浮窗权限的情况下的显示逻辑
- Loading branch information
1 parent
dd34a59
commit ffbbbf8
Showing
14 changed files
with
177 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
library/src/main/java/com/hjq/logcat/LogcatGlobalDispatcher.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package com.hjq.logcat; | ||
|
||
import android.app.Activity; | ||
import android.app.Application; | ||
import android.os.Bundle; | ||
import android.view.View; | ||
|
||
/** | ||
* author : Android 轮子哥 | ||
* github : https://github.com/getActivity/Logcat | ||
* time : 2020/01/24 | ||
* desc : Logcat 悬浮窗全局显示派发 | ||
*/ | ||
final class LogcatGlobalDispatcher implements Application.ActivityLifecycleCallbacks { | ||
|
||
static void launch(Application application) { | ||
LogcatWindow logcatWindow = new LogcatWindow(application); | ||
logcatWindow.show(); | ||
|
||
application.registerActivityLifecycleCallbacks(new LogcatGlobalDispatcher(logcatWindow)); | ||
} | ||
|
||
private final LogcatWindow mLogcatWindow; | ||
|
||
private LogcatGlobalDispatcher(LogcatWindow logcatWindow) { | ||
mLogcatWindow = logcatWindow; | ||
} | ||
|
||
@Override | ||
public void onActivityCreated(Activity activity, Bundle savedInstanceState) {} | ||
|
||
@Override | ||
public void onActivityStarted(Activity activity) {} | ||
|
||
@Override | ||
public void onActivityResumed(Activity activity) { | ||
if (!(activity instanceof LogcatActivity)) { | ||
return; | ||
} | ||
mLogcatWindow.setWindowVisibility(View.GONE); | ||
} | ||
|
||
@Override | ||
public void onActivityPaused(Activity activity) {} | ||
|
||
@Override | ||
public void onActivityStopped(Activity activity) { | ||
if (!(activity instanceof LogcatActivity)) { | ||
return; | ||
} | ||
mLogcatWindow.setWindowVisibility(View.VISIBLE); | ||
} | ||
|
||
@Override | ||
public void onActivitySaveInstanceState(Activity activity, Bundle outState) {} | ||
|
||
@Override | ||
public void onActivityDestroyed(Activity activity) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
|
||
<string name="logcat_launch_error">參數錯誤,無法啓動 Logcat</string> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
|
||
<string name="logcat_launch_error">参数错误,无法启动 Logcat</string> | ||
|