[Fix]恢复动态请求悬浮窗权限
原因:Android11弹Toast需要悬浮窗权限
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -8,10 +8,8 @@ import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
|
||||
/**
|
||||
* 采用windowManager实现接口(取消系统级弹窗)
|
||||
* {@link DialogImpl}
|
||||
* 采用windowManager实现接口
|
||||
*/
|
||||
@Deprecated
|
||||
class WindowManagerImpl implements IWindowManagerView {
|
||||
|
||||
private WindowManager mWindowManager;
|
||||
|
||||
@@ -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." );
|
||||
|
||||
Reference in New Issue
Block a user