优化代码

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 {
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
}

Loading…
Cancel
Save