|
@@ -1,5 +1,6 @@
|
|
|
package com.cooleshow.base.widgets;
|
|
|
|
|
|
+import android.app.Dialog;
|
|
|
import android.content.res.Configuration;
|
|
|
import android.os.Build;
|
|
|
import android.os.Bundle;
|
|
@@ -75,28 +76,20 @@ public abstract class BaseDialog extends DialogFragment {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void hideNavigationBar() {
|
|
|
+ private void hideNavigationBar(Window window) {
|
|
|
int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
|
|
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
|
|
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
|
|
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
|
|
| View.SYSTEM_UI_FLAG_IMMERSIVE
|
|
|
| View.SYSTEM_UI_FLAG_FULLSCREEN;
|
|
|
- if (getDialog() == null) {
|
|
|
- return;
|
|
|
- }
|
|
|
- Window window = getDialog().getWindow();
|
|
|
if (window == null) {
|
|
|
return;
|
|
|
}
|
|
|
window.getDecorView().setSystemUiVisibility(uiOptions);
|
|
|
}
|
|
|
|
|
|
- public void adjustFullScreen() {
|
|
|
- if (getDialog() == null) {
|
|
|
- return;
|
|
|
- }
|
|
|
- Window window = getDialog().getWindow();
|
|
|
+ public void adjustFullScreen(Window window) {
|
|
|
if (window == null) {
|
|
|
return;
|
|
|
}
|
|
@@ -151,6 +144,15 @@ public abstract class BaseDialog extends DialogFragment {
|
|
|
initParams();
|
|
|
}
|
|
|
|
|
|
+ @NonNull
|
|
|
+ @Override
|
|
|
+ public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
|
|
+ Dialog dialog = new Dialog(requireContext(), getTheme());
|
|
|
+ hideNavigationBar(dialog.getWindow());
|
|
|
+ adjustFullScreen(dialog.getWindow());
|
|
|
+ return dialog;
|
|
|
+ }
|
|
|
+
|
|
|
private void initParams() {
|
|
|
Window window = getDialog().getWindow();
|
|
|
if (window != null) {
|
|
@@ -213,8 +215,6 @@ public abstract class BaseDialog extends DialogFragment {
|
|
|
window.setAttributes(lp);
|
|
|
}
|
|
|
setCancelable(outCancel);
|
|
|
- hideNavigationBar();
|
|
|
- adjustFullScreen();
|
|
|
}
|
|
|
|
|
|
public BaseDialog setMargin(int margin) {
|