Browse Source

现场改动12

tags/old_version_1
fyf 1 year ago
parent
commit
64c9872803
3 changed files with 41 additions and 22 deletions
  1. +6
    -3
      app/src/main/java/com/bonait/bnframework/common/base/BaseActivity.java
  2. +28
    -10
      app/src/main/java/com/bonait/bnframework/common/helper/ActiveMax.java
  3. +7
    -9
      app/src/main/res/layout/fragment_home1.xml

+ 6
- 3
app/src/main/java/com/bonait/bnframework/common/base/BaseActivity.java View File

@@ -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() {
}



+ 28
- 10
app/src/main/java/com/bonait/bnframework/common/helper/ActiveMax.java View File

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


+ 7
- 9
app/src/main/res/layout/fragment_home1.xml View File

@@ -235,17 +235,15 @@ android:orientation="vertical">
app:imagesrc_ks="@mipmap/ks_jb"
app:imagesrc_tz="@mipmap/tz_jb"
/>
<Button
<com.suke.widget.SwitchButton
app:sb_uncheck_color="@color/app_color_blue"
app:sb_uncheckcircle_color="@color/app_color_blue"
app:sb_button_color="@color/app_color_blue"
android:layout_centerVertical="true"
android:id="@+id/btn_jiaoban"
android:layout_width="80dp"
android:layout_height="30dp"
android:layout_marginBottom="10dp"
android:layout_centerVertical="true"
android:background="@drawable/bg_btn_login_selected"
android:text="设置"
android:textColor="@color/white"
android:textSize="16dp"
/>
android:layout_height="wrap_content"
android:focusable="true"></com.suke.widget.SwitchButton>

<ImageView
android:layout_width="wrap_content"


Loading…
Cancel
Save