添加base dialog

This commit is contained in:
tongchenfei
2020-06-16 19:18:15 +08:00
parent 5e2103000d
commit bfe990271a
3 changed files with 122 additions and 60 deletions

View File

@@ -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);
}
}