优化代码

pull/540/head
gedoor 4 years ago
parent 4234de1c32
commit c01a68e46d
  1. 16
      app/src/main/java/io/legado/app/utils/SystemUtils.kt

@ -56,12 +56,16 @@ object SystemUtils {
*/ */
fun isNavigationBarExist(activity: Activity?): Boolean { fun isNavigationBarExist(activity: Activity?): Boolean {
activity?.let { activity?.let {
val vp = it.window.decorView as? ViewGroup val viewGroup = it.window.decorView as? ViewGroup
if (vp != null) { if (viewGroup != null) {
for (i in 0 until vp.childCount) { for (i in 0 until viewGroup.childCount) {
vp.getChildAt(i).context.packageName viewGroup.getChildAt(i).context.packageName
if (vp.getChildAt(i).id != View.NO_ID if (viewGroup.getChildAt(i).id != View.NO_ID
&& NAVIGATION == activity.resources.getResourceEntryName(vp.getChildAt(i).id) && NAVIGATION == activity.resources.getResourceEntryName(
viewGroup.getChildAt(
i
).id
)
) { ) {
return true return true
} }

Loading…
Cancel
Save