Skip to content

Commit

Permalink
fix: statusbar not hidden in pixel8 pro.
Browse files Browse the repository at this point in the history
  • Loading branch information
plateaukao committed Nov 10, 2023
1 parent 801ac3a commit 9aa260c
Show file tree
Hide file tree
Showing 5 changed files with 1,757 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.text.TextRange
import androidx.compose.ui.text.input.TextFieldValue
import androidx.constraintlayout.widget.ConstraintSet
import androidx.core.graphics.Insets
import androidx.core.view.ViewCompat
import androidx.core.view.WindowCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.isVisible
import androidx.fragment.app.FragmentActivity
import androidx.lifecycle.lifecycleScope
Expand Down Expand Up @@ -286,6 +290,17 @@ open class BrowserActivity : FragmentActivity(), BrowserController {
super.onCreate(null)

binding = ActivityMainBinding.inflate(layoutInflater)
WindowCompat.setDecorFitsSystemWindows(window, false)
ViewCompat.setOnApplyWindowInsetsListener(
binding.root
) { view, windowInsets ->
val insets: Insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars())
val params =
view.layoutParams as FrameLayout.LayoutParams
params.bottomMargin = insets.bottom
WindowInsetsCompat.CONSUMED
}


savedInstanceState?.let {
shouldLoadTabState = it.getBoolean(K_SHOULD_LOAD_TAB_STATE)
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:fitsSystemWindows="false"
tools:ignore="ContentDescription">

<FrameLayout
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-night/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<resources>

<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
<!-- <item name="preferenceTheme">@style/PreferenceThemeOverlay.v14</item>-->
<item name="dragIcon">@drawable/ic_drag</item>
<item name="android:textColor">@color/lightGray</item>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
</style>

<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
<item name="android:forceDarkAllowed">true</item>
<!-- <item name="preferenceTheme">@style/preferenceTheme</item>-->
<item name="dragIcon">@drawable/ic_drag</item>
Expand Down
Loading

0 comments on commit 9aa260c

Please sign in to comment.