diff --git a/app/src/main/java/io/legado/app/utils/SystemUtils.kt b/app/src/main/java/io/legado/app/utils/SystemUtils.kt index b8027528d..7faccc935 100644 --- a/app/src/main/java/io/legado/app/utils/SystemUtils.kt +++ b/app/src/main/java/io/legado/app/utils/SystemUtils.kt @@ -56,12 +56,16 @@ object SystemUtils { */ fun isNavigationBarExist(activity: Activity?): Boolean { activity?.let { - val vp = it.window.decorView as? ViewGroup - if (vp != null) { - for (i in 0 until vp.childCount) { - vp.getChildAt(i).context.packageName - if (vp.getChildAt(i).id != View.NO_ID - && NAVIGATION == activity.resources.getResourceEntryName(vp.getChildAt(i).id) + val viewGroup = it.window.decorView as? ViewGroup + if (viewGroup != null) { + for (i in 0 until viewGroup.childCount) { + viewGroup.getChildAt(i).context.packageName + if (viewGroup.getChildAt(i).id != View.NO_ID + && NAVIGATION == activity.resources.getResourceEntryName( + viewGroup.getChildAt( + i + ).id + ) ) { return true }