Skip to content

Commit

Permalink
Fixed text highlight color wrong
Browse files Browse the repository at this point in the history
  • Loading branch information
Super12138 committed Mar 2, 2024
1 parent 0fd7920 commit 1e5e62a
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package cn.super12138.todo.constant

import cn.super12138.todo.logic.database.SPDelegates
import cn.super12138.todo.utils.SPDelegates

object GlobalValues {
var darkMode: String by SPDelegates(Constants.PREF_DARK_MODE, "0")
var devMode: Boolean by SPDelegates(Constants.PREF_DEV_MODE, false)
var springFestivalTheme: Boolean by SPDelegates(Constants.PREF_SPRING_FESTIVAL_THEME, false)
var secureMode: Boolean by SPDelegates(Constants.PREF_SECURE_MODE, false)

}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package cn.super12138.todo.logic.database
package cn.super12138.todo.utils

import cn.super12138.todo.utils.SPUtils
import kotlin.properties.ReadWriteProperty
import kotlin.reflect.KProperty

class SPDelegates<T>(private val key: String, private val default: T) : ReadWriteProperty<Any?, T> {
override fun getValue(thisRef: Any?, property: KProperty<*>): T {
return SPUtils.getValue(key, default)
}

override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) {
SPUtils.putValue(key, value)
}
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/kotlin/cn/super12138/todo/views/BaseActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import cn.super12138.todo.logic.Repository

open class BaseActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
if (GlobalValues.springFestivalTheme) {
/*if (GlobalValues.springFestivalTheme) {
setTheme(R.style.Theme_SpringFestival)
}
// enableEdgeToEdge()
enableEdgeToEdge()*/
super.onCreate(savedInstanceState)

// 深色模式
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ class AboutActivity : BaseActivity() {
when (clickCount) {
5 -> {
clickCount = 0
GlobalValues.springFestivalTheme = !GlobalValues.springFestivalTheme
"🧧".showToast()
// GlobalValues.springFestivalTheme = !GlobalValues.springFestivalTheme
"\uD83C\uDF3C".showToast()
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/values-night/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
<item name="colorSurfaceContainerHigh">@color/md_theme_surfaceContainerHigh</item>
<item name="colorSurfaceContainerHighest">@color/md_theme_surfaceContainerHighest</item>


<item name="android:textColorHighlight">@color/md_theme_secondary</item>
<item name="preferenceTheme">@style/AppPreferenceThemeOverlay</item>
<item name="alertDialogTheme">@style/ToDo.M3AlertDialog</item>
</style>
Expand Down Expand Up @@ -100,6 +102,7 @@
<item name="colorSurfaceContainerHigh">@color/md_theme_red_surfaceContainerHigh</item>
<item name="colorSurfaceContainerHighest">@color/md_theme_red_surfaceContainerHighest</item>

<item name="android:textColorHighlight">@color/md_theme_red_secondary</item>
<item name="preferenceTheme">@style/AppPreferenceThemeOverlay</item>
<item name="alertDialogTheme">@style/ToDo.M3AlertDialog</item>
</style>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
<item name="colorSurfaceContainerHigh">@color/md_theme_surfaceContainerHigh</item>
<item name="colorSurfaceContainerHighest">@color/md_theme_surfaceContainerHighest</item>

<item name="android:textColorHighlight">@color/md_theme_secondary</item>
<item name="preferenceTheme">@style/AppPreferenceThemeOverlay</item>
<item name="alertDialogTheme">@style/ToDo.M3AlertDialog</item>
</style>
Expand Down Expand Up @@ -117,6 +118,7 @@
<item name="colorSurfaceContainerHigh">@color/md_theme_red_surfaceContainerHigh</item>
<item name="colorSurfaceContainerHighest">@color/md_theme_red_surfaceContainerHighest</item>

<item name="android:textColorHighlight">@color/md_theme_red_secondary</item>
<item name="preferenceTheme">@style/AppPreferenceThemeOverlay</item>
<item name="alertDialogTheme">@style/ToDo.M3AlertDialog</item>
</style>
Expand Down

0 comments on commit 1e5e62a

Please sign in to comment.