Skip to content

Commit

Permalink
Hide bottom safe area when showing fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
levinli303 committed Dec 29, 2022
1 parent b5c8a05 commit e9a1617
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ open class CommonWebFragment: NavigationFragment.SubFragment(), CelestiaJavascri

val weakSelf = WeakReference(this)

val bottomSafeArea = view.findViewById<FrameLayout>(R.id.bottom_safe_area)

val defaultUri = uri
val shouldFilterURL = filterURL
val queryKeys = matchingQueryKeys
Expand Down Expand Up @@ -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
}
Expand All @@ -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
Expand All @@ -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
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/res/layout/fragment_common_web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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"/>
<com.google.android.material.progressindicator.CircularProgressIndicator
android:id="@+id/loading_indicator"
android:layout_width="wrap_content"
Expand Down

0 comments on commit e9a1617

Please sign in to comment.