From c01a68e46daf0667b3c809481eb603b72b819e9c Mon Sep 17 00:00:00 2001 From: gedoor Date: Sun, 13 Dec 2020 18:50:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/legado/app/utils/SystemUtils.kt | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) 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 }