Skip to content

Commit

Permalink
Fix light status bar issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Domi04151309 committed Dec 26, 2023
1 parent 8ff5716 commit e9f5e76
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
1 change: 0 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
package io.github.domi04151309.powerapp.activities

import android.content.res.Configuration
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.google.android.material.elevation.SurfaceColors
import io.github.domi04151309.powerapp.R

abstract class BaseActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
if (resources.configuration.uiMode.and(
Configuration.UI_MODE_NIGHT_MASK,
) != Configuration.UI_MODE_NIGHT_YES
) {
setTheme(R.style.LightStatusBarOverlay)
}
val color = SurfaceColors.SURFACE_2.getColor(this)
window.statusBarColor = color
window.navigationBarColor = color
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<style name="LightStatusBarOverlay">
<item name="android:windowLightNavigationBar" tools:targetApi="o_mr1">true</item>
<item name="android:windowLightStatusBar">true</item>
</style>
</resources>

0 comments on commit e9f5e76

Please sign in to comment.