[Fix]恢复动态请求悬浮窗权限

原因:Android11弹Toast需要悬浮窗权限
This commit is contained in:
chenfufeng
2022-03-18 11:02:20 +08:00
parent 646d4d4e2b
commit 244859f9a0
7 changed files with 36 additions and 35 deletions

View File

@@ -2,6 +2,7 @@ package com.mogo.module.common.dialog;
import android.app.Dialog;
import android.content.Context;
import android.os.Build;
import android.view.WindowManager;
import androidx.annotation.NonNull;
@@ -31,12 +32,11 @@ public class BaseFloatDialog extends Dialog {
}
private void addFlag() {
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
// getWindow().setType(WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY);
// } else {
// getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
// }
getWindow().setType(WindowManager.LayoutParams.LAST_SUB_WINDOW);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
getWindow().setType(WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY);
} else {
getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
}
getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
| WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION
| WindowManager.LayoutParams.FLAG_LOCAL_FOCUS_MODE);

View File

@@ -8,10 +8,8 @@ import android.view.View;
import android.view.WindowManager;
/**
* 采用windowManager实现接口(取消系统级弹窗)
* {@link DialogImpl}
* 采用windowManager实现接口
*/
@Deprecated
class WindowManagerImpl implements IWindowManagerView {
private WindowManager mWindowManager;

View File

@@ -97,7 +97,6 @@ public class WindowManagerView {
return new WindowManagerView( mParams, new DialogImpl() );
}
@Deprecated
public WindowManagerView showInWindowManager() {
if ( mParams.mContentView == null ) {
throw new NullPointerException( "WMViewParams#mContentView must not be null." );