|
|
@@ -4,8 +4,10 @@ import android.app.Activity; |
|
|
|
import android.os.Build; |
|
|
|
import android.view.View; |
|
|
|
import android.view.ViewTreeObserver; |
|
|
|
import android.view.WindowManager; |
|
|
|
|
|
|
|
import com.qmuiteam.qmui.util.QMUINotchHelper; |
|
|
|
import com.qmuiteam.qmui.util.QMUIStatusBarHelper; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
@@ -34,7 +36,6 @@ public class ActiveMax { |
|
|
|
} |
|
|
|
|
|
|
|
//QMUINotchHelper.getSafeInsetBottom(activity) |
|
|
|
|
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { |
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { |
|
|
|
// 全屏显示,隐藏状态栏和导航栏,拉出状态栏和导航栏显示一会儿后消失。 |
|
|
@@ -45,8 +46,11 @@ public class ActiveMax { |
|
|
|
// | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
|
|
|
// | View.SYSTEM_UI_FLAG_FULLSCREEN |
|
|
|
// | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); |
|
|
|
activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN); |
|
|
|
//activity.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); |
|
|
|
// activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION|View.SYSTEM_UI_FLAG_FULLSCREEN); |
|
|
|
// activity.getWindow().getDecorView().setSystemUiVisibility(View.INVISIBLE); |
|
|
|
|
|
|
|
activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION); |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
// 全屏显示,隐藏状态栏 |
|
|
@@ -56,6 +60,17 @@ public class ActiveMax { |
|
|
|
|
|
|
|
// 注册监听器 |
|
|
|
activity.getWindow().getDecorView().getViewTreeObserver().addOnGlobalLayoutListener(keyboardVisibilityListener); |
|
|
|
// 禁用触摸事件触发导航栏显示 |
|
|
|
// activity.getWindow().getDecorView().setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() { |
|
|
|
// @Override |
|
|
|
// public void onSystemUiVisibilityChange(int visibility) { |
|
|
|
// if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) { |
|
|
|
// // 如果导航栏显示,则重新设置全屏 |
|
|
|
// activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION); |
|
|
|
// } |
|
|
|
// } |
|
|
|
// }); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@@ -71,13 +86,16 @@ public class ActiveMax { |
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { |
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { |
|
|
|
// 全屏显示,隐藏状态栏和导航栏,拉出状态栏和导航栏显示一会儿后消失。 |
|
|
|
activity.getWindow().getDecorView().setSystemUiVisibility( |
|
|
|
View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
|
|
|
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
|
|
|
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
|
|
|
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
|
|
|
| View.SYSTEM_UI_FLAG_FULLSCREEN |
|
|
|
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); |
|
|
|
// activity.getWindow().getDecorView().setSystemUiVisibility( |
|
|
|
// View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
|
|
|
// | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
|
|
|
// | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
|
|
|
// | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
|
|
|
// | View.SYSTEM_UI_FLAG_FULLSCREEN |
|
|
|
// | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); |
|
|
|
//activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION|View.SYSTEM_UI_FLAG_FULLSCREEN); |
|
|
|
activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION); |
|
|
|
|
|
|
|
} else { |
|
|
|
// 全屏显示,隐藏状态栏 |
|
|
|
activity.getWindow().getDecorView().setSystemUiVisibility(View.INVISIBLE); |
|
|
|