Introduce "Black" theme and refactor theme handling
* Add `Theme.Black` to the `Theme` enum and update `isDark()` to include it. * Refactor `ElementTheme` to accept a `Theme` object instead of a `darkTheme` boolean, allowing for more specific color mapping (e.g., setting `bgCanvasDefault` to `Color.Black` for the Black theme). * Update `AdvancedSettingsPresenter` and `AdvancedSettingsState` to include "Black" as a user-selectable theme option. * Adjust `ElementThemeApp` and `MaterialTextPreview` to handle the expanded theme selection. * Add `ElementPreviewBlack` and update existing preview components to support the new theme. * Update Konsist tests to ensure `@PreviewsDayNight` annotated functions don't have "BlackPreview" suffix.
This commit is contained in:
parent
fdbe518db3
commit
a96c146d30
23 changed files with 121 additions and 36 deletions
|
|
@ -56,6 +56,7 @@ class AdvancedSettingsPresenter(
|
|||
when (theme.value) {
|
||||
Theme.System -> ThemeOption.System
|
||||
Theme.Dark -> ThemeOption.Dark
|
||||
Theme.Black -> ThemeOption.Black
|
||||
Theme.Light -> ThemeOption.Light
|
||||
}
|
||||
}
|
||||
|
|
@ -98,6 +99,7 @@ class AdvancedSettingsPresenter(
|
|||
when (event.theme) {
|
||||
ThemeOption.System -> appPreferencesStore.setTheme(Theme.System.name)
|
||||
ThemeOption.Dark -> appPreferencesStore.setTheme(Theme.Dark.name)
|
||||
ThemeOption.Black -> appPreferencesStore.setTheme(Theme.Black.name)
|
||||
ThemeOption.Light -> appPreferencesStore.setTheme(Theme.Light.name)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,6 +48,13 @@ enum class ThemeOption : DropdownOption {
|
|||
@ReadOnlyComposable
|
||||
override fun getText(): String = stringResource(CommonStrings.common_dark)
|
||||
},
|
||||
|
||||
Black {
|
||||
@Composable
|
||||
@ReadOnlyComposable
|
||||
override fun getText(): String = stringResource(CommonStrings.common_black)
|
||||
},
|
||||
|
||||
Light {
|
||||
@Composable
|
||||
@ReadOnlyComposable
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import io.element.android.libraries.designsystem.components.preferences.Preferen
|
|||
import io.element.android.libraries.designsystem.components.preferences.PreferenceSwitch
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreviewDark
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreviewBlack
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreviewLight
|
||||
import io.element.android.libraries.designsystem.preview.PreviewWithLargeHeight
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
|
|
@ -324,6 +325,11 @@ internal fun AdvancedSettingsViewLightPreview(@PreviewParameter(AdvancedSettings
|
|||
internal fun AdvancedSettingsViewDarkPreview(@PreviewParameter(AdvancedSettingsStateProvider::class) state: AdvancedSettingsState) =
|
||||
ElementPreviewDark { ContentToPreview(state) }
|
||||
|
||||
@PreviewWithLargeHeight
|
||||
@Composable
|
||||
internal fun AdvancedSettingsViewBlackPreview(@PreviewParameter(AdvancedSettingsStateProvider::class) state: AdvancedSettingsState) =
|
||||
ElementPreviewBlack { ContentToPreview(state) }
|
||||
|
||||
@ExcludeFromCoverage
|
||||
@Composable
|
||||
private fun ContentToPreview(state: AdvancedSettingsState) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue