Fix edge to edge view, force by SDK 35

This commit is contained in:
sim 2024-11-09 16:51:46 +00:00
parent 043c51e975
commit 6140b2a422
4 changed files with 15 additions and 4 deletions

View File

@ -18,6 +18,7 @@ import android.util.TypedValue
import android.view.ActionMode import android.view.ActionMode
import android.view.Menu import android.view.Menu
import android.view.MenuItem import android.view.MenuItem
import android.view.View
import android.widget.* // ktlint-disable no-wildcard-imports import android.widget.* // ktlint-disable no-wildcard-imports
import android.widget.AbsListView.MultiChoiceModeListener import android.widget.AbsListView.MultiChoiceModeListener
import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AlertDialog
@ -70,6 +71,11 @@ class MainActivity : AppCompatActivity() {
invalidateOptionsMenu() invalidateOptionsMenu()
RestartWorker.startPeriodic(this) RestartWorker.startPeriodic(this)
setDebugInformationListener() setDebugInformationListener()
findViewById<View>(android.R.id.content)?.setOnApplyWindowInsetsListener { _, insets ->
val statusBarSize = insets.systemWindowInsetTop
findViewById<androidx.appcompat.widget.Toolbar>(R.id.toolbar).setPadding(0, statusBarSize , 0, 0)
return@setOnApplyWindowInsetsListener insets
}
} }
override fun onStart() { override fun onStart() {

View File

@ -14,8 +14,7 @@
<androidx.appcompat.widget.Toolbar <androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar" android:id="@+id/toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
app:popupTheme="@style/Theme.NextPush.PopupOverlay" /> app:popupTheme="@style/Theme.NextPush.PopupOverlay" />
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>

View File

@ -13,5 +13,7 @@
<!-- Status bar color. --> <!-- Status bar color. -->
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item> <item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. --> <!-- Customize your theme here. -->
<item name="windowActionModeOverlay">true</item>
<item name="actionBarTheme">@style/Theme.NextPush.AppBarOverlay</item>
</style> </style>
</resources> </resources>

View File

@ -1,6 +1,6 @@
<resources xmlns:tools="http://schemas.android.com/tools"> <resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. --> <!-- Base application theme. -->
<style name="Theme.NextPush" parent="Theme.MaterialComponents.DayNight.DarkActionBar"> <style name="Theme.NextPush" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<!-- Primary brand color. --> <!-- Primary brand color. -->
<item name="colorPrimary">@color/nextcloud</item> <item name="colorPrimary">@color/nextcloud</item>
<item name="colorPrimaryVariant">@color/purple_700</item> <item name="colorPrimaryVariant">@color/purple_700</item>
@ -13,6 +13,8 @@
<!-- Status bar color. --> <!-- Status bar color. -->
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item> <item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. --> <!-- Customize your theme here. -->
<item name="windowActionModeOverlay">true</item>
<item name="actionBarTheme">@style/Theme.NextPush.AppBarOverlay</item>
</style> </style>
<style name="Theme.NextPush.NoActionBar"> <style name="Theme.NextPush.NoActionBar">
@ -20,7 +22,9 @@
<item name="windowNoTitle">true</item> <item name="windowNoTitle">true</item>
</style> </style>
<style name="Theme.NextPush.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" /> <style name="Theme.NextPush.AppBarOverlay" parent="ThemeOverlay.AppCompat.DayNight.ActionBar" >
<item name="colorSecondary">@android:color/transparent</item>
</style>
<style name="Theme.NextPush.PopupOverlay" parent="ThemeOverlay.AppCompat.DayNight" /> <style name="Theme.NextPush.PopupOverlay" parent="ThemeOverlay.AppCompat.DayNight" />