mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-26 11:51:10 +01:00
Improve the Android 12 splash screen.
This commit is contained in:
@@ -8,6 +8,7 @@ import org.thoughtcrime.securesms.components.settings.DSLSettingsAdapter
|
||||
import org.thoughtcrime.securesms.components.settings.DSLSettingsFragment
|
||||
import org.thoughtcrime.securesms.components.settings.DSLSettingsText
|
||||
import org.thoughtcrime.securesms.components.settings.configure
|
||||
import org.thoughtcrime.securesms.keyvalue.SettingsValues
|
||||
import org.thoughtcrime.securesms.util.navigation.safeNavigate
|
||||
|
||||
class AppearanceSettingsFragment : DSLSettingsFragment(R.string.preferences__appearance) {
|
||||
@@ -36,9 +37,9 @@ class AppearanceSettingsFragment : DSLSettingsFragment(R.string.preferences__app
|
||||
radioListPref(
|
||||
title = DSLSettingsText.from(R.string.preferences__theme),
|
||||
listItems = themeLabels,
|
||||
selected = themeValues.indexOf(state.theme),
|
||||
selected = themeValues.indexOf(state.theme.serialize()),
|
||||
onSelected = {
|
||||
viewModel.setTheme(themeValues[it])
|
||||
viewModel.setTheme(activity, SettingsValues.Theme.deserialize(themeValues[it]))
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package org.thoughtcrime.securesms.components.settings.app.appearance
|
||||
|
||||
import org.thoughtcrime.securesms.keyvalue.SettingsValues
|
||||
|
||||
data class AppearanceSettingsState(
|
||||
val theme: String,
|
||||
val theme: SettingsValues.Theme,
|
||||
val messageFontSize: Int,
|
||||
val language: String
|
||||
)
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
package org.thoughtcrime.securesms.components.settings.app.appearance
|
||||
|
||||
import android.app.Activity
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import org.thoughtcrime.securesms.jobs.EmojiSearchIndexDownloadJob
|
||||
import org.thoughtcrime.securesms.keyvalue.SettingsValues.Theme
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
||||
import org.thoughtcrime.securesms.util.SplashScreenUtil
|
||||
import org.thoughtcrime.securesms.util.livedata.Store
|
||||
|
||||
class AppearanceSettingsViewModel : ViewModel() {
|
||||
@@ -21,9 +24,10 @@ class AppearanceSettingsViewModel : ViewModel() {
|
||||
|
||||
val state: LiveData<AppearanceSettingsState> = store.stateLiveData
|
||||
|
||||
fun setTheme(theme: String) {
|
||||
fun setTheme(activity: Activity?, theme: Theme) {
|
||||
store.update { it.copy(theme = theme) }
|
||||
SignalStore.settings().theme = theme
|
||||
SplashScreenUtil.setSplashScreenThemeIfNecessary(activity, theme)
|
||||
}
|
||||
|
||||
fun setLanguage(language: String) {
|
||||
|
||||
Reference in New Issue
Block a user