Skip to content

Commit

Permalink
Fix browser fragment insets
Browse files Browse the repository at this point in the history
  • Loading branch information
levinli303 committed Dec 18, 2022
1 parent ad5c904 commit 06b5a49
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:installLocation="auto"
android:versionCode="303"
android:versionCode="304"
android:versionName="1.5.14">

<uses-feature android:glEsVersion="0x00020000" android:required="true" />
Expand Down
10 changes: 1 addition & 9 deletions app/src/main/java/space/celestia/mobilecelestia/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,19 @@ import android.os.Bundle
import android.provider.DocumentsContract
import android.util.LayoutDirection
import android.util.Log
import android.view.Gravity
import android.view.MotionEvent
import android.view.View
import android.view.WindowManager
import android.widget.FrameLayout
import android.widget.Toast
import androidx.activity.OnBackPressedCallback
import androidx.activity.addCallback
import androidx.activity.result.ActivityResultLauncher
import androidx.activity.result.contract.ActivityResultContracts
import androidx.appcompat.app.AppCompatActivity
import androidx.constraintlayout.widget.Guideline
import androidx.core.animation.addListener
import androidx.core.app.ShareCompat
import androidx.core.content.FileProvider
import androidx.core.graphics.Insets
import androidx.core.view.GravityCompat
import androidx.core.view.ViewCompat
import androidx.core.view.WindowCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.WindowInsetsControllerCompat
import androidx.core.view.*
import androidx.drawerlayout.widget.DrawerLayout
import androidx.drawerlayout.widget.DrawerLayout.DrawerListener
import androidx.fragment.app.Fragment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ package space.celestia.mobilecelestia.browser
import android.os.Bundle
import android.view.*
import android.widget.LinearLayout
import androidx.core.graphics.Insets
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.fragment.app.Fragment
Expand Down Expand Up @@ -118,9 +119,11 @@ class BrowserFragment : Fragment(), Poppable, BrowserRootFragment, NavigationBar
browserContainer = view.findViewById(R.id.browser_container)
navigation = view.findViewById(R.id.navigation)

ViewCompat.setOnApplyWindowInsetsListener(browserContainer) { _, _ ->
// Consume insets because we have a bottom bar now
WindowInsetsCompat.CONSUMED
ViewCompat.setOnApplyWindowInsetsListener(view.findViewById(R.id.navigation_container)) { _, insets ->
// Consume bottom insets because we have a bottom bar now
// TODO: the suggested replacement for the deprecated methods does not work
val builder = WindowInsetsCompat.Builder(insets).setSystemWindowInsets(Insets.of(insets.systemWindowInsetLeft , insets.systemWindowInsetTop, insets.systemWindowInsetRight, 0))
return@setOnApplyWindowInsetsListener builder.build()
}

return view
Expand Down

0 comments on commit 06b5a49

Please sign in to comment.