Files
web_fengzhuang/Dmcslot/src/main/java/com/web/dmcslot/DialogUtil.java
2025-02-06 17:39:24 +08:00

58 lines
2.0 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package com.web.dmcslot;
import android.os.Build;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
public class DialogUtil {
/**
* 隐藏虚拟栏 ,显示的时候再隐藏掉
* @param window
*/
public static void hideNavigationBar(final Window window) {
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
window.getDecorView().setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
@Override
public void onSystemUiVisibilityChange(int visibility) {
int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
//布局位于状态栏下方
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
//全屏
View.SYSTEM_UI_FLAG_FULLSCREEN |
//隐藏导航栏
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
if (Build.VERSION.SDK_INT >= 19) {
uiOptions |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
} else {
uiOptions |= View.SYSTEM_UI_FLAG_LOW_PROFILE;
}
window.getDecorView().setSystemUiVisibility(uiOptions);
}
});
}
/**
* dialog 需要全屏的时候用和clearFocusNotAle() 成对出现
* 在show 前调用 focusNotAle show后调用clearFocusNotAle
* @param window
*/
public static void focusNotAle(Window window) {
window.setFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
}
/**
* dialog 需要全屏的时候用focusNotAle() 成对出现
* 在show 前调用 focusNotAle show后调用clearFocusNotAle
* @param window
*/
public static void clearFocusNotAle(Window window) {
window.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
}
}