PanelSwitchHelper
PanelSwitchHelper copied to clipboard
Fatal Exception: java.lang.IllegalStateException
window.decorView.rootWindowInsets must not be null
by com.effective.android.panel.utils.DisplayUtil.getNavigationBarHeight` (DisplayUtil.kt:123)
@JvmStatic fun getNavigationBarHeight(context: Context, window: Window): Int { val deviceNavigationHeight = getInternalDimensionSize(context.resources, Constants.NAVIGATION_BAR_HEIGHT_RES_NAME) //三星android9 OneUI2.0一下打开全面屏手势,导航栏实际高度比 deviceHeight 小,需要做兼容 val manufacturer = if (Build.MANUFACTURER == null) "" else Build.MANUFACTURER.trim { it <= ' ' } if (manufacturer.toLowerCase().contains("samsung") && Build.VERSION.SDK_INT >= Build.VERSION_CODES.P && Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) { val stableBottom = window.decorView.rootWindowInsets.stableInsetBottom if (stableBottom < deviceNavigationHeight) { return stableBottom; } } return deviceNavigationHeight; }
should be
@JvmStatic fun getNavigationBarHeight(context: Context, window: Window): Int { val deviceNavigationHeight = DisplayUtil.getInternalDimensionSize( context.resources, Constants.NAVIGATION_BAR_HEIGHT_RES_NAME ) //三星android9 OneUI2.0一下打开全面屏手势,导航栏实际高度比 deviceHeight 小,需要做兼容 val manufacturer = if (Build.MANUFACTURER == null) "" else Build.MANUFACTURER.trim { it <= ' ' } if (manufacturer.toLowerCase() .contains("samsung") && Build.VERSION.SDK_INT >= Build.VERSION_CODES.P && Build.VERSION.SDK_INT < Build.VERSION_CODES.Q ) { window.decorView.rootWindowInsets?.let { val stableBottom = it.stableInsetBottom if (stableBottom < deviceNavigationHeight) { return stableBottom; } } } return deviceNavigationHeight; }
grateful! It will be fixed in the next version