-
Notifications
You must be signed in to change notification settings - Fork 710
update theme style implementation and use AppCompatDelegate for night… #584
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -20,15 +20,17 @@ package com.vrem.wifianalyzer.settings | |||||
| import android.graphics.Color | ||||||
| import androidx.annotation.ColorInt | ||||||
| import androidx.annotation.StyleRes | ||||||
| import androidx.appcompat.app.AppCompatDelegate | ||||||
| import com.vrem.wifianalyzer.R | ||||||
|
|
||||||
| enum class ThemeStyle( | ||||||
| @param:StyleRes val theme: Int, | ||||||
| @param:StyleRes val themeNoActionBar: Int, | ||||||
| @param:ColorInt val colorGraphText: Int, | ||||||
| val nightMode: Int, | ||||||
| ) { | ||||||
| DARK(R.style.ThemeDark, R.style.ThemeDarkNoActionBar, Color.WHITE), | ||||||
| LIGHT(R.style.ThemeLight, R.style.ThemeLightNoActionBar, Color.BLACK), | ||||||
| SYSTEM(R.style.ThemeSystem, R.style.ThemeSystemNoActionBar, Color.GRAY), | ||||||
| BLACK(R.style.ThemeBlack, R.style.ThemeBlackNoActionBar, Color.WHITE), | ||||||
| DARK(R.style.ThemeSystem, R.style.ThemeSystemNoActionBar, Color.WHITE, AppCompatDelegate.MODE_NIGHT_YES), | ||||||
| LIGHT(R.style.ThemeSystem, R.style.ThemeSystemNoActionBar, Color.BLACK, AppCompatDelegate.MODE_NIGHT_NO), | ||||||
| SYSTEM(R.style.ThemeSystem, R.style.ThemeSystemNoActionBar, Color.GRAY, AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM), | ||||||
|
||||||
| SYSTEM(R.style.ThemeSystem, R.style.ThemeSystemNoActionBar, Color.GRAY, AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM), | |
| SYSTEM(R.style.ThemeSystem, R.style.ThemeSystemNoActionBar, Color.BLACK, AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The AppCompatDelegate.setDefaultNightMode() call is not covered by tests. While the PR description mentions that unit tests were added or updated, there's no test verifying that this method is called with the correct nightMode value from the theme.
Consider adding a test in MainActivityTest that verifies AppCompatDelegate.setDefaultNightMode() is called appropriately during activity creation. This would ensure the night mode is properly set for different theme configurations.