Commit 288f1e3b by 万齐军

是否有导航栏判断

parent 247de44c
ext {
dev_mode = false
ydl2PublishVersion = "0.2.0"
ydl2PublishVersion = "0.2.0.2"
ydlPublishVersion = [
// -------------- 业务模块 --------------
//第三步 若干
......
......@@ -37,6 +37,7 @@ import com.ydl.webview.ProgressWebView
import com.ydl.webview.TellData
import com.ydl.webview.WebModularServiceUtils
import com.ydl.ydlcommon.modular.findRouteService
import com.ydl.ydlcommon.utils.ScreenUtil
import com.ydl.ydlcommon.utils.TimeUtil
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.view.dialog.CommonDialog
......@@ -292,7 +293,10 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
val layoutParams = FrameLayout.LayoutParams(
FrameLayout.LayoutParams.WRAP_CONTENT,
FrameLayout.LayoutParams.WRAP_CONTENT
).apply { gravity = Gravity.BOTTOM or Gravity.CENTER_HORIZONTAL }
).apply {
gravity = Gravity.BOTTOM or Gravity.CENTER_HORIZONTAL
bottomMargin = ScreenUtil.getNavBarHeight(context)
}
dialog?.window?.addContentView(itemView, layoutParams)
bottomSheet =
(it as BottomSheetDialog).findViewById<View>(com.google.android.material.R.id.design_bottom_sheet) as FrameLayout?
......
......@@ -2,8 +2,11 @@ package com.ydl.ydlcommon.utils;
import android.content.Context;
import android.content.res.Resources;
import android.os.Build;
import android.provider.Settings;
import android.util.DisplayMetrics;
import android.util.Log;
import com.ydl.ydlcommon.base.BaseApp;
import java.lang.reflect.Field;
......@@ -118,6 +121,7 @@ public class ScreenUtil {
}
public static int getNavBarHeight(Context context) {
if (hasNavBarHide(context)) return 0;
Resources resources = context.getResources();
int resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
if (resourceId > 0) {
......@@ -125,4 +129,23 @@ public class ScreenUtil {
}
return 0;
}
}
public static boolean hasNavBarHide(Context context){
return Settings.Global.getInt(context.getContentResolver(), getNavBarShowKey(), 0) != 0;
}
private static String getNavBarShowKey() {
String brand = Build.BRAND;
if (brand.equalsIgnoreCase("HUAWEI")) {
return "navigationbar_is_min";
} else if (brand.equalsIgnoreCase("XIAOMI")) {
return "force_fsg_nav_bar";
} else if (brand.equalsIgnoreCase("VIVO")) {
return "navigation_gesture_on";
} else if (brand.equalsIgnoreCase("OPPO")) {
return "navigation_gesture_on";
} else {
return "navigationbar_is_min";
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment