Enable edge to edge

This commit is contained in:
Super12138 2024-05-19 20:09:35 +08:00
parent 752a037380
commit 329b341325
3 changed files with 15 additions and 19 deletions

View file

@ -3,6 +3,8 @@ package cn.super12138.todo.views
import android.os.Build import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.view.WindowManager import android.view.WindowManager
import androidx.activity.SystemBarStyle
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.app.AppCompatDelegate import androidx.appcompat.app.AppCompatDelegate
import cn.super12138.todo.constant.GlobalValues import cn.super12138.todo.constant.GlobalValues
@ -11,8 +13,8 @@ open class BaseActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
/*if (GlobalValues.springFestivalTheme) { /*if (GlobalValues.springFestivalTheme) {
setTheme(R.style.Theme_SpringFestival) setTheme(R.style.Theme_SpringFestival)
} }*/
enableEdgeToEdge()*/ enableEdgeToEdge()
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
// 深色模式 // 深色模式

View file

@ -1,16 +0,0 @@
<resources>
<style name="Theme.ToDo" parent="Base.Theme.ToDo">
<!-- Transparent system bars for edge-to-edge. -->
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowLightStatusBar">?attr/isLightTheme</item>
</style>
<style name="Theme.SpringFestival" parent="Base.Theme.SpringFestival">
<!-- Transparent system bars for edge-to-edge. -->
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowLightStatusBar">?attr/isLightTheme</item>
</style>
</resources>

View file

@ -53,7 +53,11 @@
<item name="alertDialogTheme">@style/ToDo.M3AlertDialog</item> <item name="alertDialogTheme">@style/ToDo.M3AlertDialog</item>
</style> </style>
<style name="Theme.ToDo" parent="Base.Theme.ToDo" /> <style name="Theme.ToDo" parent="Base.Theme.ToDo">
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowLightStatusBar">?attr/isLightTheme</item>
</style>
<style name="AppPreferenceThemeOverlay" parent="@style/PreferenceThemeOverlay"> <style name="AppPreferenceThemeOverlay" parent="@style/PreferenceThemeOverlay">
<item name="switchPreferenceCompatStyle">@style/AppSwitchPreference</item> <item name="switchPreferenceCompatStyle">@style/AppSwitchPreference</item>
@ -122,4 +126,10 @@
<item name="preferenceTheme">@style/AppPreferenceThemeOverlay</item> <item name="preferenceTheme">@style/AppPreferenceThemeOverlay</item>
<item name="alertDialogTheme">@style/ToDo.M3AlertDialog</item> <item name="alertDialogTheme">@style/ToDo.M3AlertDialog</item>
</style> </style>
<!--<style name="Theme.SpringFestival" parent="Base.Theme.SpringFestival">
&lt;!&ndash; Transparent system bars for edge-to-edge. &ndash;&gt;
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowLightStatusBar">?attr/isLightTheme</item>
</style>-->
</resources> </resources>