|
|
@ -35,10 +35,12 @@ class OnboardingThemePickerViewHolder(view: View) : RecyclerView.ViewHolder(view
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
radioLightTheme.addToRadioGroup(radioDarkTheme)
|
|
|
|
radioLightTheme.addToRadioGroup(radioDarkTheme)
|
|
|
|
radioDarkTheme.addToRadioGroup(radioLightTheme)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
radioLightTheme.addToRadioGroup(radioFollowDeviceTheme)
|
|
|
|
radioLightTheme.addToRadioGroup(radioFollowDeviceTheme)
|
|
|
|
|
|
|
|
radioLightTheme.addIllustration(view.theme_light_image)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
radioDarkTheme.addToRadioGroup(radioLightTheme)
|
|
|
|
radioDarkTheme.addToRadioGroup(radioFollowDeviceTheme)
|
|
|
|
radioDarkTheme.addToRadioGroup(radioFollowDeviceTheme)
|
|
|
|
|
|
|
|
radioDarkTheme.addIllustration(view.theme_dark_image)
|
|
|
|
|
|
|
|
|
|
|
|
radioFollowDeviceTheme.addToRadioGroup(radioDarkTheme)
|
|
|
|
radioFollowDeviceTheme.addToRadioGroup(radioDarkTheme)
|
|
|
|
radioFollowDeviceTheme.addToRadioGroup(radioLightTheme)
|
|
|
|
radioFollowDeviceTheme.addToRadioGroup(radioLightTheme)
|
|
|
@ -60,12 +62,10 @@ class OnboardingThemePickerViewHolder(view: View) : RecyclerView.ViewHolder(view
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
radioLightTheme.onClickListener {
|
|
|
|
radioLightTheme.onClickListener {
|
|
|
|
setLightIllustrationSelected()
|
|
|
|
|
|
|
|
setNewTheme(AppCompatDelegate.MODE_NIGHT_NO)
|
|
|
|
setNewTheme(AppCompatDelegate.MODE_NIGHT_NO)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
radioDarkTheme.onClickListener {
|
|
|
|
radioDarkTheme.onClickListener {
|
|
|
|
setDarkIllustrationSelected()
|
|
|
|
|
|
|
|
view.context.components.analytics.metrics.track(
|
|
|
|
view.context.components.analytics.metrics.track(
|
|
|
|
Event.DarkThemeSelected(
|
|
|
|
Event.DarkThemeSelected(
|
|
|
|
Event.DarkThemeSelected.Source.ONBOARDING
|
|
|
|
Event.DarkThemeSelected.Source.ONBOARDING
|
|
|
@ -75,7 +75,6 @@ class OnboardingThemePickerViewHolder(view: View) : RecyclerView.ViewHolder(view
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
radioFollowDeviceTheme.onClickListener {
|
|
|
|
radioFollowDeviceTheme.onClickListener {
|
|
|
|
setNoIllustrationSelected()
|
|
|
|
|
|
|
|
if (SDK_INT >= Build.VERSION_CODES.P) {
|
|
|
|
if (SDK_INT >= Build.VERSION_CODES.P) {
|
|
|
|
setNewTheme(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
|
|
|
|
setNewTheme(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -84,40 +83,21 @@ class OnboardingThemePickerViewHolder(view: View) : RecyclerView.ViewHolder(view
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
with(view.context.settings()) {
|
|
|
|
with(view.context.settings()) {
|
|
|
|
val radio: OnboardingRadioButton
|
|
|
|
val radio: OnboardingRadioButton = when {
|
|
|
|
when {
|
|
|
|
|
|
|
|
shouldUseLightTheme -> {
|
|
|
|
shouldUseLightTheme -> {
|
|
|
|
radio = radioLightTheme
|
|
|
|
radioLightTheme
|
|
|
|
setLightIllustrationSelected()
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
shouldUseDarkTheme -> {
|
|
|
|
shouldUseDarkTheme -> {
|
|
|
|
radio = radioDarkTheme
|
|
|
|
radioDarkTheme
|
|
|
|
setDarkIllustrationSelected()
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else -> {
|
|
|
|
else -> {
|
|
|
|
radio = radioFollowDeviceTheme
|
|
|
|
radioFollowDeviceTheme
|
|
|
|
setNoIllustrationSelected()
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
radio.isChecked = true
|
|
|
|
radio.updateRadioValue(true)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private fun setNoIllustrationSelected() {
|
|
|
|
|
|
|
|
itemView.theme_dark_image.isSelected = false
|
|
|
|
|
|
|
|
itemView.theme_light_image.isSelected = false
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun setDarkIllustrationSelected() {
|
|
|
|
|
|
|
|
itemView.theme_dark_image.isSelected = true
|
|
|
|
|
|
|
|
itemView.theme_light_image.isSelected = false
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun setLightIllustrationSelected() {
|
|
|
|
|
|
|
|
itemView.theme_dark_image.isSelected = false
|
|
|
|
|
|
|
|
itemView.theme_light_image.isSelected = true
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun setNewTheme(mode: Int) {
|
|
|
|
private fun setNewTheme(mode: Int) {
|
|
|
|
if (AppCompatDelegate.getDefaultNightMode() == mode) return
|
|
|
|
if (AppCompatDelegate.getDefaultNightMode() == mode) return
|
|
|
|
AppCompatDelegate.setDefaultNightMode(mode)
|
|
|
|
AppCompatDelegate.setDefaultNightMode(mode)
|
|
|
|