|
|
@ -10,6 +10,7 @@ import androidx.preference.PreferenceFragmentCompat |
|
|
|
import io.legado.app.App |
|
|
|
import io.legado.app.App |
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.constant.Bus |
|
|
|
import io.legado.app.constant.Bus |
|
|
|
|
|
|
|
import io.legado.app.help.AppConfig |
|
|
|
import io.legado.app.lib.dialogs.alert |
|
|
|
import io.legado.app.lib.dialogs.alert |
|
|
|
import io.legado.app.lib.dialogs.noButton |
|
|
|
import io.legado.app.lib.dialogs.noButton |
|
|
|
import io.legado.app.lib.dialogs.yesButton |
|
|
|
import io.legado.app.lib.dialogs.yesButton |
|
|
@ -110,25 +111,25 @@ class ThemeConfigFragment : PreferenceFragmentCompat(), SharedPreferences.OnShar |
|
|
|
putPrefInt("colorPrimary", getCompatColor(R.color.md_grey_100)) |
|
|
|
putPrefInt("colorPrimary", getCompatColor(R.color.md_grey_100)) |
|
|
|
putPrefInt("colorAccent", getCompatColor(R.color.lightBlue_color)) |
|
|
|
putPrefInt("colorAccent", getCompatColor(R.color.lightBlue_color)) |
|
|
|
putPrefInt("colorBackground", getCompatColor(R.color.md_grey_100)) |
|
|
|
putPrefInt("colorBackground", getCompatColor(R.color.md_grey_100)) |
|
|
|
putPrefBoolean("isNightTheme", false) |
|
|
|
AppConfig.isNightTheme = false |
|
|
|
} |
|
|
|
} |
|
|
|
1 -> { |
|
|
|
1 -> { |
|
|
|
putPrefInt("colorPrimaryNight", getCompatColor(R.color.shine_color)) |
|
|
|
putPrefInt("colorPrimaryNight", getCompatColor(R.color.shine_color)) |
|
|
|
putPrefInt("colorAccentNight", getCompatColor(R.color.lightBlue_color)) |
|
|
|
putPrefInt("colorAccentNight", getCompatColor(R.color.lightBlue_color)) |
|
|
|
putPrefInt("colorBackgroundNight", getCompatColor(R.color.shine_color)) |
|
|
|
putPrefInt("colorBackgroundNight", getCompatColor(R.color.shine_color)) |
|
|
|
putPrefBoolean("isNightTheme", true) |
|
|
|
AppConfig.isNightTheme = true |
|
|
|
} |
|
|
|
} |
|
|
|
2 -> { |
|
|
|
2 -> { |
|
|
|
putPrefInt("colorPrimary", getCompatColor(R.color.md_light_blue_500)) |
|
|
|
putPrefInt("colorPrimary", getCompatColor(R.color.md_light_blue_500)) |
|
|
|
putPrefInt("colorAccent", getCompatColor(R.color.md_pink_800)) |
|
|
|
putPrefInt("colorAccent", getCompatColor(R.color.md_pink_800)) |
|
|
|
putPrefInt("colorBackground", getCompatColor(R.color.md_grey_100)) |
|
|
|
putPrefInt("colorBackground", getCompatColor(R.color.md_grey_100)) |
|
|
|
putPrefBoolean("isNightTheme", false) |
|
|
|
AppConfig.isNightTheme = false |
|
|
|
} |
|
|
|
} |
|
|
|
3 -> { |
|
|
|
3 -> { |
|
|
|
putPrefInt("colorPrimary", getCompatColor(R.color.white)) |
|
|
|
putPrefInt("colorPrimary", getCompatColor(R.color.white)) |
|
|
|
putPrefInt("colorAccent", getCompatColor(R.color.black)) |
|
|
|
putPrefInt("colorAccent", getCompatColor(R.color.black)) |
|
|
|
putPrefInt("colorBackground", getCompatColor(R.color.white)) |
|
|
|
putPrefInt("colorBackground", getCompatColor(R.color.white)) |
|
|
|
putPrefBoolean("isNightTheme", false) |
|
|
|
AppConfig.isNightTheme = false |
|
|
|
} |
|
|
|
} |
|
|
|
4 -> { |
|
|
|
4 -> { |
|
|
|
putPrefInt("colorPrimaryNight", getCompatColor(R.color.black)) |
|
|
|
putPrefInt("colorPrimaryNight", getCompatColor(R.color.black)) |
|
|
@ -140,7 +141,7 @@ class ThemeConfigFragment : PreferenceFragmentCompat(), SharedPreferences.OnShar |
|
|
|
"colorBackgroundNight", |
|
|
|
"colorBackgroundNight", |
|
|
|
getCompatColor(R.color.black) |
|
|
|
getCompatColor(R.color.black) |
|
|
|
) |
|
|
|
) |
|
|
|
putPrefBoolean("isNightTheme", true) |
|
|
|
AppConfig.isNightTheme = true |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
App.INSTANCE.applyDayNight() |
|
|
|
App.INSTANCE.applyDayNight() |
|
|
@ -172,7 +173,7 @@ class ThemeConfigFragment : PreferenceFragmentCompat(), SharedPreferences.OnShar |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun upTheme(isNightTheme: Boolean) { |
|
|
|
private fun upTheme(isNightTheme: Boolean) { |
|
|
|
if (this.isNightTheme == isNightTheme) { |
|
|
|
if (AppConfig.isNightTheme == isNightTheme) { |
|
|
|
App.INSTANCE.applyTheme() |
|
|
|
App.INSTANCE.applyTheme() |
|
|
|
recreateActivities() |
|
|
|
recreateActivities() |
|
|
|
} |
|
|
|
} |
|
|
|