添加base dialog
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package com.mogo.module.common.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.mogo.module.common.R;
|
||||
|
||||
/**
|
||||
* 浮在各种wm上面的dialog基类,调用了window.setType
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class BaseFloatDialog extends Dialog {
|
||||
public BaseFloatDialog(@NonNull Context context) {
|
||||
this(context, R.style.BaseFloatDialogStyle);
|
||||
}
|
||||
|
||||
public BaseFloatDialog(@NonNull Context context, int themeResId) {
|
||||
super(context, themeResId);
|
||||
addFlag();
|
||||
}
|
||||
|
||||
private void addFlag() {
|
||||
getWindow().setType(WindowManager.LayoutParams.FIRST_SYSTEM_WINDOW + 10);
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
|
||||
| WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION
|
||||
| WindowManager.LayoutParams.FLAG_LOCAL_FOCUS_MODE);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user