From e9a161782d13a3632aeed7994cdecfaf328baaae Mon Sep 17 00:00:00 2001 From: Levin Li Date: Fri, 30 Dec 2022 01:25:00 +0800 Subject: [PATCH] Hide bottom safe area when showing fallback --- .../celestia/mobilecelestia/resource/CommonWebFragment.kt | 6 +++++- app/src/main/res/layout/fragment_common_web.xml | 3 +-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/space/celestia/mobilecelestia/resource/CommonWebFragment.kt b/app/src/main/java/space/celestia/mobilecelestia/resource/CommonWebFragment.kt index f76446bb..3bd294ee 100644 --- a/app/src/main/java/space/celestia/mobilecelestia/resource/CommonWebFragment.kt +++ b/app/src/main/java/space/celestia/mobilecelestia/resource/CommonWebFragment.kt @@ -119,6 +119,8 @@ open class CommonWebFragment: NavigationFragment.SubFragment(), CelestiaJavascri val weakSelf = WeakReference(this) + val bottomSafeArea = view.findViewById(R.id.bottom_safe_area) + val defaultUri = uri val shouldFilterURL = filterURL val queryKeys = matchingQueryKeys @@ -222,6 +224,7 @@ open class CommonWebFragment: NavigationFragment.SubFragment(), CelestiaJavascri replace(fragment, R.id.fallback) fallbackContainer.isVisible = true webView?.isVisible = false + bottomSafeArea.isVisible = false loadingIndicator.isVisible = false weakSelf.get()?.showFallbackContainer = true } @@ -238,7 +241,7 @@ open class CommonWebFragment: NavigationFragment.SubFragment(), CelestiaJavascri } } - ViewCompat.setOnApplyWindowInsetsListener(view.findViewById(R.id.bottom_safe_area)) { container, windowInsets -> + ViewCompat.setOnApplyWindowInsetsListener(bottomSafeArea) { container, windowInsets -> val insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars()) container.updatePadding(bottom = insets.bottom) WindowInsetsCompat.CONSUMED @@ -252,6 +255,7 @@ open class CommonWebFragment: NavigationFragment.SubFragment(), CelestiaJavascri if (showFallbackContainer) { fallbackContainer.isVisible = true webView.isVisible = false + bottomSafeArea.isVisible = false loadingIndicator.isVisible = false } else if (initialLoadFinished) { loadingIndicator.isVisible = false diff --git a/app/src/main/res/layout/fragment_common_web.xml b/app/src/main/res/layout/fragment_common_web.xml index 4cfbbdc5..36d5f6dc 100644 --- a/app/src/main/res/layout/fragment_common_web.xml +++ b/app/src/main/res/layout/fragment_common_web.xml @@ -42,8 +42,7 @@ android:id="@+id/bottom_safe_area" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_alignParentBottom="true" - style="@style/Container"/> + android:layout_alignParentBottom="true"/>