From 64c9872803b00d6783e48534d7f346407921e025 Mon Sep 17 00:00:00 2001
From: fyf <11621@LAPTOP-04QQU0AO>
Date: Mon, 21 Aug 2023 17:44:20 +0800
Subject: [PATCH] =?UTF-8?q?=E7=8E=B0=E5=9C=BA=E6=94=B9=E5=8A=A812?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../bnframework/common/base/BaseActivity.java | 9 +++--
.../bnframework/common/helper/ActiveMax.java | 38 ++++++++++++++-----
app/src/main/res/layout/fragment_home1.xml | 16 ++++----
3 files changed, 41 insertions(+), 22 deletions(-)
diff --git a/app/src/main/java/com/bonait/bnframework/common/base/BaseActivity.java b/app/src/main/java/com/bonait/bnframework/common/base/BaseActivity.java
index f01c26a0..579845b0 100644
--- a/app/src/main/java/com/bonait/bnframework/common/base/BaseActivity.java
+++ b/app/src/main/java/com/bonait/bnframework/common/base/BaseActivity.java
@@ -5,6 +5,7 @@ import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.provider.Settings;
+
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -28,12 +29,14 @@ import pub.devrel.easypermissions.EasyPermissions;
* Created by LY on 2019/3/21.
*/
@SuppressLint("Registered")
-public class BaseActivity extends QMUIActivity implements EasyPermissions.PermissionCallbacks {
+public class BaseActivity extends QMUIActivity implements EasyPermissions.PermissionCallbacks {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
-// ActiveMax.MaxFrom(this);
+
// QMUIStatusBarHelper.translucent(this);
+// QMUIStatusBarHelper.setStatusBarLightMode(this);
+ //ActiveMax.MaxFrom(this);
//
super.onCreate(savedInstanceState);
}
@@ -59,7 +62,7 @@ public class BaseActivity extends QMUIActivity implements EasyPermissions.Permi
/**
* 检查权限,子类要申请权限,需要重写该方法
- * */
+ */
public void checkPermission() {
}
diff --git a/app/src/main/java/com/bonait/bnframework/common/helper/ActiveMax.java b/app/src/main/java/com/bonait/bnframework/common/helper/ActiveMax.java
index 72e5e6f3..499c0456 100644
--- a/app/src/main/java/com/bonait/bnframework/common/helper/ActiveMax.java
+++ b/app/src/main/java/com/bonait/bnframework/common/helper/ActiveMax.java
@@ -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);
diff --git a/app/src/main/res/layout/fragment_home1.xml b/app/src/main/res/layout/fragment_home1.xml
index edf83471..61612b2a 100644
--- a/app/src/main/res/layout/fragment_home1.xml
+++ b/app/src/main/res/layout/fragment_home1.xml
@@ -235,17 +235,15 @@ android:orientation="vertical">
app:imagesrc_ks="@mipmap/ks_jb"
app:imagesrc_tz="@mipmap/tz_jb"
/>
-
+ android:layout_height="wrap_content"
+ android:focusable="true">