diff --git a/ATTRIBUTION.md b/ATTRIBUTION.md index fdce39403..57bd82688 100644 --- a/ATTRIBUTION.md +++ b/ATTRIBUTION.md @@ -353,3 +353,9 @@ Generated-in-code art is original and has no file to list: the UI icon set (`cra | `apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_AttachmentsScreenshotTest_unfoldedDark200_attachments_unfolded_dark_200.png` | MailCraft contributors | Drawn by Paparazzi (`cargo xtask mobile`, `recordPaparazziDebug`) from the app's own screens with invented example.org mail | MIT OR Apache-2.0 | Golden screenshot of the folded and unfolded attachments (MR3, #1962) | | `apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_AttachmentsScreenshotTest_unfoldedLight100_attachments_unfolded_light_100.png` | MailCraft contributors | Drawn by Paparazzi (`cargo xtask mobile`, `recordPaparazziDebug`) from the app's own screens with invented example.org mail | MIT OR Apache-2.0 | Golden screenshot of the folded and unfolded attachments (MR3, #1962) | | `apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_AttachmentsScreenshotTest_unfoldedLight200_attachments_unfolded_light_200.png` | MailCraft contributors | Drawn by Paparazzi (`cargo xtask mobile`, `recordPaparazziDebug`) from the app's own screens with invented example.org mail | MIT OR Apache-2.0 | Golden screenshot of the folded and unfolded attachments (MR3, #1962) | +| `apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_SettingsScreenshotTest_appearance_settings_appearance_dark_100.png` | MailCraft contributors | Drawn by Paparazzi (`cargo xtask mobile`, `recordPaparazziDebug`) from the app's own screens with invented example.org mail | MIT OR Apache-2.0 | Golden screenshot of Android Settings › Appearance (#1997) | +| `apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_SettingsScreenshotTest_appearance_settings_appearance_dark_200.png` | MailCraft contributors | Drawn by Paparazzi (`cargo xtask mobile`, `recordPaparazziDebug`) from the app's own screens with invented example.org mail | MIT OR Apache-2.0 | Golden screenshot of Android Settings › Appearance (#1997) | +| `apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_SettingsScreenshotTest_appearance_settings_appearance_light_100.png` | MailCraft contributors | Drawn by Paparazzi (`cargo xtask mobile`, `recordPaparazziDebug`) from the app's own screens with invented example.org mail | MIT OR Apache-2.0 | Golden screenshot of Android Settings › Appearance (#1997) | +| `apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_SettingsScreenshotTest_appearance_settings_appearance_light_200.png` | MailCraft contributors | Drawn by Paparazzi (`cargo xtask mobile`, `recordPaparazziDebug`) from the app's own screens with invented example.org mail | MIT OR Apache-2.0 | Golden screenshot of Android Settings › Appearance (#1997) | +| `apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_SettingsScreenshotTest_darkChosenOnLightPhone_settings_appearance_forced_dark_on_light_100.png` | MailCraft contributors | Drawn by Paparazzi (`cargo xtask mobile`, `recordPaparazziDebug`) from the app's own screens with invented example.org mail | MIT OR Apache-2.0 | Golden screenshot of Android Settings › Appearance (#1997) | +| `apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_SettingsScreenshotTest_lightChosenOnDarkPhone_settings_appearance_forced_light_on_dark_100.png` | MailCraft contributors | Drawn by Paparazzi (`cargo xtask mobile`, `recordPaparazziDebug`) from the app's own screens with invented example.org mail | MIT OR Apache-2.0 | Golden screenshot of Android Settings › Appearance (#1997) | diff --git a/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/MainActivity.kt b/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/MainActivity.kt index 3c6cbe476..94007f46b 100644 --- a/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/MainActivity.kt +++ b/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/MainActivity.kt @@ -13,8 +13,10 @@ import android.content.IntentFilter import android.net.Uri import android.os.Bundle import androidx.activity.compose.setContent +import androidx.activity.SystemBarStyle import androidx.activity.enableEdgeToEdge import androidx.appcompat.app.AppCompatActivity +import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.material3.Surface import androidx.compose.runtime.Composable @@ -83,7 +85,6 @@ class MainActivity : AppCompatActivity() { if (savedInstanceState == null || window.handoff.readAgain) takeHandedOver(intent) // A window built again (turned, or its language changed) has already taken a message it was asked for up. if (savedInstanceState == null) incoming.value = incomingOf(intent) - enableEdgeToEdge() val application = application as? MailCraftApplication application?.begin() val starting = application?.started ?: MutableStateFlow(Phase.Failed) @@ -103,13 +104,35 @@ class MainActivity : AppCompatActivity() { started = phase } } - MailCraftTheme { + // The theme is the owner's choice (kept with the reading choices); the bars' icons follow it. + val store = remember { DeviceReadingPrefs(applicationContext) } + var reading by remember { mutableStateOf(store.load()) } + // Another window (split screen) may save a newer choice: take it in, so a save here never undoes it. + DisposableEffect(store) { + val stop = store.watch { reading = store.load() } + onDispose { stop() } + } + val dark = reading.theme.dark(isSystemInDarkTheme()) + DisposableEffect(dark) { + val clear = android.graphics.Color.TRANSPARENT + val bars = SystemBarStyle.auto(clear, clear) { dark } + enableEdgeToEdge(statusBarStyle = bars, navigationBarStyle = bars) + onDispose {} + } + MailCraftTheme(dark) { DeviceDateSettings { Surface(modifier = Modifier.fillMaxSize()) { var chosen by remember { mutableStateOf(LanguageChoice.current()) } val handedOver by window.handoff.file.collectAsState() val asked = Asked({ incoming.value }, { incoming.value = null }) - Root(started, version, chosen, handedOver, window.handoff::handled, window, asked) { + Root( + started, version, chosen, handedOver, window.handoff::handled, window, asked, + ReadingChoice(reading) { edit -> + val next = edit(store.load()) + reading = next + store.save(next) + }, + ) { chosen = it LanguageChoice.choose(it) } @@ -186,11 +209,14 @@ internal fun Root( onHandled: () -> Unit = {}, window: WindowModel? = null, asked: Asked = Asked.None, + readingChoice: ReadingChoice = ReadingChoice(ReadingPrefs()) {}, onLanguage: (String) -> Unit, ) { when (started) { is Phase.Ready -> - CoreShell(started.value, version, chosenLanguage, handedOver, onHandled, window, asked, onLanguage) + CoreShell( + started.value, version, chosenLanguage, handedOver, onHandled, window, asked, readingChoice, onLanguage, + ) Phase.Loading -> Opening() Phase.Failed -> Centered(stringResource(R.string.start_failed)) } @@ -225,6 +251,7 @@ private fun CoreShell( onHandled: () -> Unit, window: WindowModel?, asked: Asked, + readingChoice: ReadingChoice, onLanguage: (String) -> Unit, ) { val (core, hub, list) = Triple(opened.core, opened.hub, opened.mail) @@ -242,8 +269,6 @@ private fun CoreShell( var swipe by remember { mutableStateOf(prefs.load()) } val noticeStore = remember { DeviceNoticeButtons(appContext) } var noticeButtons by remember { mutableStateOf(noticeStore.load()) } - val readingStore = remember { DeviceReadingPrefs(appContext) } - var readingPrefs by remember { mutableStateOf(readingStore.load()) } // (A folder of 0 is the first Inbox.) var query by rememberSaveable(stateSaver = MailQuery.Saver) { mutableStateOf(MailQuery(0uL)) } val ui by list.ui.collectAsState() @@ -289,7 +314,7 @@ private fun CoreShell( nowMillis = now, swipe = swipe, noticeButtons = noticeButtons, - readingPrefs = readingPrefs, + readingPrefs = readingChoice.prefs, reading = pictured.reading, pictures = pictured.settings, avatars = pictured.avatars, @@ -314,10 +339,7 @@ private fun CoreShell( noticeButtons = it noticeStore.save(it) }, - onReadingPrefs = { - readingPrefs = it - readingStore.save(it) - }, + onReadingPrefs = readingChoice.onChange, reading = pictured.reader.actions(writing::begin), onPictures = pictures::changed, onClearPictures = pictures::clear, diff --git a/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/Navigation.kt b/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/Navigation.kt index 3c18117aa..d8a70fa1c 100644 --- a/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/Navigation.kt +++ b/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/Navigation.kt @@ -30,6 +30,7 @@ internal enum class SettingsPage { Notifications, NotificationButtons, SwipeActions, + Appearance, Reading, Pictures, SenderImages, @@ -45,6 +46,7 @@ internal enum class SettingsPage { Notifications -> texts.t("Notifications") NotificationButtons -> texts.t("Notification buttons") SwipeActions -> texts.t("Swipe actions") + Appearance -> texts.t("Appearance") Reading -> texts.t("Reading") Pictures -> texts.t("Pictures") SenderImages -> texts.t("Sender images") diff --git a/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingPrefs.kt b/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingPrefs.kt index 6d4bc9f31..5be7011f4 100644 --- a/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingPrefs.kt +++ b/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingPrefs.kt @@ -4,6 +4,7 @@ package work.mailcraft.android import android.annotation.SuppressLint import android.content.Context +import android.content.SharedPreferences /** What the owner chose about reading, kept on this phone only. */ internal data class ReadingPrefs( @@ -15,8 +16,41 @@ internal data class ReadingPrefs( val foldAttachments: Boolean = true, /** When an opened message counts as read. */ val markRead: MarkRead = MarkRead.WhenOpened, + /** Light, dark, or the phone's setting. */ + val theme: ThemeChoice = ThemeChoice.System, ) +/** The reading prefs the window holds, and how it changes them (kept by the window: the theme is outside the shell). */ +/** One field changed on the choices as stored now, so another window's newer save is kept. */ +internal typealias ReadingEdit = (ReadingPrefs) -> ReadingPrefs + +internal class ReadingChoice(val prefs: ReadingPrefs, val onChange: (ReadingEdit) -> Unit) + +/** The app's theme: its own light or dark, or whatever the phone is set to. */ +internal enum class ThemeChoice(val code: String) { + System("system"), + Light("light"), + Dark("dark"), + ; + + /** Whether the app is dark, given whether the phone is. */ + fun dark(system: Boolean): Boolean = when (this) { + System -> system + Light -> false + Dark -> true + } + + fun label(texts: Texts): String = when (this) { + System -> texts.t("Follow system") + Light -> texts.t("Light") + Dark -> texts.t("Dark") + } + + companion object { + fun fromCode(code: String?): ThemeChoice = entries.firstOrNull { it.code == code } ?: System + } +} + /** When a message that was opened is marked read. */ @Suppress("MagicNumber") internal enum class MarkRead(val code: String, private val seconds: Int) { @@ -58,6 +92,7 @@ internal fun readingPrefsFrom( headerOpen = get("header_open", false), foldAttachments = get("fold_attachments", true), markRead = MarkRead.fromCode(text("mark_read")), + theme = ThemeChoice.fromCode(text("theme")), ) /** [ReadingPrefs] in the app's private preferences. A store that cannot be read gives the defaults. */ @@ -77,15 +112,25 @@ internal class DeviceReadingPrefs(context: Context) { ?.putBoolean(HEADER, value.headerOpen) ?.putBoolean(FOLD, value.foldAttachments) ?.putString(MARK, value.markRead.code) + ?.putString(THEME, value.theme.code) ?.apply() } } + /** Calls [onChange] whenever any window saves; returns the call that stops watching. */ + fun watch(onChange: () -> Unit): () -> Unit { + // Held here: the preferences keep only a weak reference to a listener. + val listener = SharedPreferences.OnSharedPreferenceChangeListener { _, _ -> onChange() } + prefs?.registerOnSharedPreferenceChangeListener(listener) + return { prefs?.unregisterOnSharedPreferenceChangeListener(listener) } + } + private companion object { const val FILE = "reading" const val LIGHT = "light_messages" const val HEADER = "header_open" const val FOLD = "fold_attachments" const val MARK = "mark_read" + const val THEME = "theme" } } diff --git a/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingScreen.kt b/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingScreen.kt index 32b6ed720..3f09387d3 100644 --- a/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingScreen.kt +++ b/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingScreen.kt @@ -4,7 +4,6 @@ package work.mailcraft.android import androidx.compose.foundation.background -import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.BoxWithConstraints import androidx.compose.foundation.layout.Column @@ -89,7 +88,7 @@ internal fun ReadingPane( draft: Boolean = false, tools: ReadingTools = ReadingTools.None, ) { - val dark = isSystemInDarkTheme() + val dark = appIsDark() // In a dark window the body may sit on a light page; the choice for this message alone wins. var pageChoice by remember(id) { mutableStateOf(null) } val light = dark && (pageChoice ?: tools.prefs.lightMessages) @@ -211,7 +210,7 @@ internal fun MessageBody( ) { item(key = "header") { Box(side) { - MessageHeader(texts, view, tools.prefs.headerOpen) { tools.onPrefs(tools.prefs.copy(headerOpen = it)) } + MessageHeader(texts, view, tools.prefs.headerOpen) { tools.onPrefs { p -> p.copy(headerOpen = it) } } } } item(key = "banner") { Box(side) { PicturesBanner(texts, ui, actions) } } diff --git a/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingTools.kt b/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingTools.kt index fa281a9fd..dccbad7e8 100644 --- a/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingTools.kt +++ b/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingTools.kt @@ -13,7 +13,7 @@ internal class ReadingTools( /** The message left the list's place (archived, moved, deleted): the view goes back to the list. */ val onLeave: () -> Unit, val prefs: ReadingPrefs, - val onPrefs: (ReadingPrefs) -> Unit, + val onPrefs: (ReadingEdit) -> Unit, /** The message fills a phone's screen: the bar over it has the back button, since the app's own bar is gone. */ val phone: Boolean = false, /** The messages either side of this one in the list it was opened from; null: no list, no swiping. */ diff --git a/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/SettingsScreen.kt b/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/SettingsScreen.kt index df3387b9c..1699a0305 100644 --- a/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/SettingsScreen.kt +++ b/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/SettingsScreen.kt @@ -1,6 +1,7 @@ // SPDX-FileCopyrightText: MailCraft contributors // SPDX-License-Identifier: MIT OR Apache-2.0 @file:OptIn(ExperimentalMaterial3Api::class) +@file:Suppress("TooManyFunctions") package work.mailcraft.android @@ -79,7 +80,8 @@ internal fun SettingsScreen( } @Composable -@Suppress("LongParameterList") +// One flat arm per page: the exhaustive `when` is the clearest form. +@Suppress("LongParameterList", "CyclomaticComplexMethod") private fun SettingsBody( texts: Texts, page: SettingsPage?, @@ -97,6 +99,7 @@ private fun SettingsBody( SettingsPage.Language -> LanguagePage(texts, data.chosenLanguage, actions.onLanguage) SettingsPage.SwipeActions -> SwipePage(texts, data.swipe, actions.onSwipe) SettingsPage.NotificationButtons -> NoticeButtonsPage(texts, data.noticeButtons, actions.onNoticeButtons) + SettingsPage.Appearance -> AppearancePage(texts, data.readingPrefs, actions.onReadingPrefs) SettingsPage.Reading -> ReadingPage(texts, data.readingPrefs, actions.onReadingPrefs) SettingsPage.RemoveData -> RemoveDataPage(texts, data.settingsUi.removal, actions.settings) SettingsPage.About -> AboutScreenPage(texts, data.version, actions.settings, licences, onLicences) @@ -109,6 +112,7 @@ private fun SettingsBody( } @Composable +@Suppress("CyclomaticComplexMethod") // one flat arm per page, as in SettingsBody private fun SettingsRows(texts: Texts, data: ShellData, onOpen: (SettingsPage) -> Unit) { SettingsPage.entries.forEach { entry -> val summary = when (entry) { @@ -116,6 +120,7 @@ private fun SettingsRows(texts: Texts, data: ShellData, onOpen: (SettingsPage) - SettingsPage.Language -> languageName(texts, data.chosenLanguage) SettingsPage.SwipeActions -> "${data.swipe.start.label(texts)} · ${data.swipe.end.label(texts)}" SettingsPage.NotificationButtons -> noticeButtonsSummary(texts, data.noticeButtons) + SettingsPage.Appearance -> data.readingPrefs.theme.label(texts) SettingsPage.Reading -> readingSummary(texts, data.readingPrefs) SettingsPage.About -> data.version SettingsPage.RemoveData -> removeDataSummary(texts) @@ -204,28 +209,35 @@ private fun ChoiceRow(name: String, selected: Boolean, onClick: () -> Unit) { HorizontalDivider() } +@Composable +private fun AppearancePage(texts: Texts, prefs: ReadingPrefs, onPrefs: (ReadingEdit) -> Unit) { + ThemeChoice.entries.forEach { choice -> + ChoiceRow(choice.label(texts), selected = prefs.theme == choice) { onPrefs { it.copy(theme = choice) } } + } +} + /** The summary under the Reading row. */ private fun readingSummary(texts: Texts, prefs: ReadingPrefs): String = if (prefs.lightMessages) texts.t("Light page in the dark theme") else texts.t("Dark page in the dark theme") @Composable @Suppress("MaxLineLength") -private fun ReadingPage(texts: Texts, prefs: ReadingPrefs, onPrefs: (ReadingPrefs) -> Unit) { +private fun ReadingPage(texts: Texts, prefs: ReadingPrefs, onPrefs: (ReadingEdit) -> Unit) { SwitchRow( texts.t("Show messages on a light background in the dark theme"), texts.t( "The message body is drawn on a light page, as its sender made it. The header stays dark. You can change it for one message in its menu.", ), prefs.lightMessages, - ) { onPrefs(prefs.copy(lightMessages = it)) } + ) { onPrefs { p -> p.copy(lightMessages = it) } } Text( texts.t("Attachments"), style = MaterialTheme.typography.labelLarge, color = MaterialTheme.colorScheme.primary, modifier = Modifier.padding(Gutter), ) - ChoiceRow(texts.t("Show"), selected = !prefs.foldAttachments) { onPrefs(prefs.copy(foldAttachments = false)) } - ChoiceRow(texts.t("Fold"), selected = prefs.foldAttachments) { onPrefs(prefs.copy(foldAttachments = true)) } + ChoiceRow(texts.t("Show"), selected = !prefs.foldAttachments) { onPrefs { it.copy(foldAttachments = false) } } + ChoiceRow(texts.t("Fold"), selected = prefs.foldAttachments) { onPrefs { it.copy(foldAttachments = true) } } Text( texts.t("Mark as read"), style = MaterialTheme.typography.labelLarge, @@ -233,6 +245,6 @@ private fun ReadingPage(texts: Texts, prefs: ReadingPrefs, onPrefs: (ReadingPref modifier = Modifier.padding(Gutter), ) MarkRead.entries.forEach { choice -> - ChoiceRow(choice.label(texts), selected = prefs.markRead == choice) { onPrefs(prefs.copy(markRead = choice)) } + ChoiceRow(choice.label(texts), selected = prefs.markRead == choice) { onPrefs { it.copy(markRead = choice) } } } } diff --git a/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/Shell.kt b/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/Shell.kt index 808d4122a..22e353984 100644 --- a/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/Shell.kt +++ b/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/Shell.kt @@ -139,7 +139,7 @@ internal class ShellActions( val settings: SettingsActions = SettingsActions(), val mail: MailListActions = MailListActions.None, val onSwipe: (SwipeConfig) -> Unit = {}, - val onReadingPrefs: (ReadingPrefs) -> Unit = {}, + val onReadingPrefs: (ReadingEdit) -> Unit = {}, val reading: ReadingActions = ReadingActions.None, val onPictures: (PicturePrefs) -> Unit = {}, val onClearPictures: () -> Unit = {}, diff --git a/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/Theme.kt b/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/Theme.kt index 09fe2cf31..3a2af2287 100644 --- a/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/Theme.kt +++ b/apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/Theme.kt @@ -8,6 +8,8 @@ import androidx.compose.material3.MaterialTheme import androidx.compose.material3.darkColorScheme import androidx.compose.material3.lightColorScheme import androidx.compose.runtime.Composable +import androidx.compose.runtime.CompositionLocalProvider +import androidx.compose.runtime.staticCompositionLocalOf import androidx.compose.ui.graphics.Color internal val LightColors: ColorScheme = lightColorScheme( @@ -58,8 +60,17 @@ private val DarkColors: ColorScheme = darkColorScheme( outlineVariant = Color(0xFF41484D), ) -/** The app's colours: light or dark as the system is. */ +/** Whether the app is dark, as [MailCraftTheme] set it; null outside it. */ +private val LocalDark = staticCompositionLocalOf { null } + +/** Whether the app is dark now: the owner's choice, which every screen follows, not the phone's setting. */ +@Composable +internal fun appIsDark(): Boolean = LocalDark.current ?: isSystemInDarkTheme() + +/** The app's colours: light or dark as [dark] says (the owner's choice, resolved against the system's). */ @Composable internal fun MailCraftTheme(dark: Boolean = isSystemInDarkTheme(), content: @Composable () -> Unit) { - MaterialTheme(colorScheme = if (dark) DarkColors else LightColors, content = content) + CompositionLocalProvider(LocalDark provides dark) { + MaterialTheme(colorScheme = if (dark) DarkColors else LightColors, content = content) + } } diff --git a/apps/mailcraft-android/app/src/test/kotlin/work/mailcraft/android/NavigationTest.kt b/apps/mailcraft-android/app/src/test/kotlin/work/mailcraft/android/NavigationTest.kt index 42a5dba6f..7f0dc0669 100644 --- a/apps/mailcraft-android/app/src/test/kotlin/work/mailcraft/android/NavigationTest.kt +++ b/apps/mailcraft-android/app/src/test/kotlin/work/mailcraft/android/NavigationTest.kt @@ -19,7 +19,8 @@ class NavigationTest { fun settingsHasItsSections() { assertEquals( listOf( - "Accounts", "Mail to keep offline", "Notifications", "Notification buttons", "Swipe actions", "Reading", + "Accounts", "Mail to keep offline", "Notifications", "Notification buttons", "Swipe actions", + "Appearance", "Reading", "Pictures", "Sender images", "Signatures", "Language", "Remove local data", "About", ), SettingsPage.entries.map { it.label(EnglishTexts) }, diff --git a/apps/mailcraft-android/app/src/test/kotlin/work/mailcraft/android/SettingsScreenshotTest.kt b/apps/mailcraft-android/app/src/test/kotlin/work/mailcraft/android/SettingsScreenshotTest.kt index 5d2eab005..23f2be9f8 100644 --- a/apps/mailcraft-android/app/src/test/kotlin/work/mailcraft/android/SettingsScreenshotTest.kt +++ b/apps/mailcraft-android/app/src/test/kotlin/work/mailcraft/android/SettingsScreenshotTest.kt @@ -41,6 +41,18 @@ class SettingsScreenshotTest { shoot("${name}_dark_200", true, 2f, if (tallAtTwice) TALL else null, content) } + @Test + fun appearance() = four("settings_appearance") { SettingsShots.Page(SettingsPage.Appearance) } + + // The app set to Light on a phone that is dark, and Dark on a phone that is light: the choice wins. + @Test + fun lightChosenOnDarkPhone() = + shoot("settings_appearance_forced_light_on_dark_100", true, 1f) { SettingsShots.Page(SettingsPage.Appearance, theme = ThemeChoice.Light) } + + @Test + fun darkChosenOnLightPhone() = + shoot("settings_appearance_forced_dark_on_light_100", false, 1f) { SettingsShots.Page(SettingsPage.Appearance, theme = ThemeChoice.Dark) } + @Test fun rowsLight100() = shoot("settings_rows_light_100", false, 1f) { SettingsShots.Page(null) } diff --git a/apps/mailcraft-android/app/src/test/kotlin/work/mailcraft/android/SettingsShots.kt b/apps/mailcraft-android/app/src/test/kotlin/work/mailcraft/android/SettingsShots.kt index 5633c3fab..6754f4389 100644 --- a/apps/mailcraft-android/app/src/test/kotlin/work/mailcraft/android/SettingsShots.kt +++ b/apps/mailcraft-android/app/src/test/kotlin/work/mailcraft/android/SettingsShots.kt @@ -4,6 +4,7 @@ package work.mailcraft.android +import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding @@ -29,7 +30,7 @@ internal object SettingsShots { ), ) - private fun data(settings: SettingsUi = ui) = ShellData( + private fun data(settings: SettingsUi = ui, theme: ThemeChoice = ThemeChoice.System) = ShellData( accounts = listOf(ada, bo), folderName = "Inbox", folderId = 1uL, @@ -37,18 +38,19 @@ internal object SettingsShots { version = "0.12.0", chosenLanguage = "", settingsUi = settings, + readingPrefs = ReadingPrefs(theme = theme), ) @Composable - private fun Themed(content: @Composable () -> Unit) { - MailCraftTheme { Surface(modifier = Modifier.fillMaxSize()) { content() } } + private fun Themed(theme: ThemeChoice = ThemeChoice.System, content: @Composable () -> Unit) { + MailCraftTheme(theme.dark(isSystemInDarkTheme())) { Surface(modifier = Modifier.fillMaxSize()) { content() } } } @Composable - fun Page(page: SettingsPage?, settings: SettingsUi = ui) = Themed { + fun Page(page: SettingsPage?, settings: SettingsUi = ui, theme: ThemeChoice = ThemeChoice.System) = Themed(theme) { AppShell( EnglishTexts, - data(settings), + data(settings, theme), ShellActions(onFolder = { _, _ -> }, onLanguage = {}), initialNav = page?.let { NavState().openPage(it) } ?: NavState().openSettings(), ) diff --git a/apps/mailcraft-android/app/src/test/kotlin/work/mailcraft/android/ThemeChoiceTest.kt b/apps/mailcraft-android/app/src/test/kotlin/work/mailcraft/android/ThemeChoiceTest.kt new file mode 100644 index 000000000..2c753ef6c --- /dev/null +++ b/apps/mailcraft-android/app/src/test/kotlin/work/mailcraft/android/ThemeChoiceTest.kt @@ -0,0 +1,34 @@ +// SPDX-FileCopyrightText: MailCraft contributors +// SPDX-License-Identifier: MIT OR Apache-2.0 +package work.mailcraft.android + +import org.junit.Assert.assertEquals +import org.junit.Test + +class ThemeChoiceTest { + @Test + fun theDefaultFollowsTheSystem() = assertEquals(ThemeChoice.System, ReadingPrefs().theme) + + @Test + fun aStoredChoiceIsRestored() { + ThemeChoice.entries.forEach { choice -> + val read = readingPrefsFrom({ if (it == "theme") choice.code else null }) { _, default -> default } + assertEquals(choice, read.theme) + } + } + + @Test + fun anOlderVersionOrAnUnknownCodeReadsAsFollowSystem() { + assertEquals(ThemeChoice.System, readingPrefsFrom { _, default -> default }.theme) + assertEquals(ThemeChoice.System, readingPrefsFrom({ if (it == "theme") "sepia" else null }) { _, d -> d }.theme) + } + + @Test + fun theChoiceDecidesWhetherTheAppIsDark() { + listOf(true, false).forEach { system -> + assertEquals(system, ThemeChoice.System.dark(system)) + assertEquals(false, ThemeChoice.Light.dark(system)) + assertEquals(true, ThemeChoice.Dark.dark(system)) + } + } +} diff --git a/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_AccountScreenshotTest_settingsRowsLight100_settings_with_accounts_light_100.png b/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_AccountScreenshotTest_settingsRowsLight100_settings_with_accounts_light_100.png index 7cd1ad9c1..449f8bd53 100644 Binary files a/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_AccountScreenshotTest_settingsRowsLight100_settings_with_accounts_light_100.png and b/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_AccountScreenshotTest_settingsRowsLight100_settings_with_accounts_light_100.png differ diff --git a/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_PhoneShellScreenshotTest_settingsDark200_phone_settings_dark_200.png b/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_PhoneShellScreenshotTest_settingsDark200_phone_settings_dark_200.png index 46f7e3b7b..a067b584b 100644 Binary files a/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_PhoneShellScreenshotTest_settingsDark200_phone_settings_dark_200.png and b/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_PhoneShellScreenshotTest_settingsDark200_phone_settings_dark_200.png differ diff --git a/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_PhoneShellScreenshotTest_settingsLight100_phone_settings_light_100.png b/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_PhoneShellScreenshotTest_settingsLight100_phone_settings_light_100.png index 7cd1ad9c1..449f8bd53 100644 Binary files a/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_PhoneShellScreenshotTest_settingsLight100_phone_settings_light_100.png and b/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_PhoneShellScreenshotTest_settingsLight100_phone_settings_light_100.png differ diff --git a/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_SettingsScreenshotTest_appearance_settings_appearance_dark_100.png b/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_SettingsScreenshotTest_appearance_settings_appearance_dark_100.png new file mode 100644 index 000000000..e36b811af Binary files /dev/null and b/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_SettingsScreenshotTest_appearance_settings_appearance_dark_100.png differ diff --git a/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_SettingsScreenshotTest_appearance_settings_appearance_dark_200.png b/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_SettingsScreenshotTest_appearance_settings_appearance_dark_200.png new file mode 100644 index 000000000..dc9207772 Binary files /dev/null and b/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_SettingsScreenshotTest_appearance_settings_appearance_dark_200.png differ diff --git a/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_SettingsScreenshotTest_appearance_settings_appearance_light_100.png b/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_SettingsScreenshotTest_appearance_settings_appearance_light_100.png new file mode 100644 index 000000000..133b92574 Binary files /dev/null and b/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_SettingsScreenshotTest_appearance_settings_appearance_light_100.png differ diff --git a/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_SettingsScreenshotTest_appearance_settings_appearance_light_200.png b/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_SettingsScreenshotTest_appearance_settings_appearance_light_200.png new file mode 100644 index 000000000..81afddef6 Binary files /dev/null and b/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_SettingsScreenshotTest_appearance_settings_appearance_light_200.png differ diff --git a/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_SettingsScreenshotTest_darkChosenOnLightPhone_settings_appearance_forced_dark_on_light_100.png b/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_SettingsScreenshotTest_darkChosenOnLightPhone_settings_appearance_forced_dark_on_light_100.png new file mode 100644 index 000000000..6ccecc33f Binary files /dev/null and b/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_SettingsScreenshotTest_darkChosenOnLightPhone_settings_appearance_forced_dark_on_light_100.png differ diff --git a/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_SettingsScreenshotTest_lightChosenOnDarkPhone_settings_appearance_forced_light_on_dark_100.png b/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_SettingsScreenshotTest_lightChosenOnDarkPhone_settings_appearance_forced_light_on_dark_100.png new file mode 100644 index 000000000..a7c917106 Binary files /dev/null and b/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_SettingsScreenshotTest_lightChosenOnDarkPhone_settings_appearance_forced_light_on_dark_100.png differ diff --git a/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_SettingsScreenshotTest_rowsDark200_settings_rows_dark_200.png b/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_SettingsScreenshotTest_rowsDark200_settings_rows_dark_200.png index a2accb802..f32ca9747 100644 Binary files a/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_SettingsScreenshotTest_rowsDark200_settings_rows_dark_200.png and b/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_SettingsScreenshotTest_rowsDark200_settings_rows_dark_200.png differ diff --git a/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_SettingsScreenshotTest_rowsLight100_settings_rows_light_100.png b/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_SettingsScreenshotTest_rowsLight100_settings_rows_light_100.png index 425b49d73..246e483a2 100644 Binary files a/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_SettingsScreenshotTest_rowsLight100_settings_rows_light_100.png and b/apps/mailcraft-android/app/src/test/snapshots/images/work.mailcraft.android_SettingsScreenshotTest_rowsLight100_settings_rows_light_100.png differ diff --git a/crates/i18n/po/cs.po b/crates/i18n/po/cs.po index c8af16612..48bc15595 100644 --- a/crates/i18n/po/cs.po +++ b/crates/i18n/po/cs.po @@ -1818,6 +1818,12 @@ msgstr "Jakýkoli jiný poštovní server" msgid "Anything still waiting to go to the server goes first: mail in the Outbox, and flags and moves made while you were offline. If MailCraft can't reach the server, the switch waits until it can." msgstr "Vše, co ještě čeká na odeslání na server, jde první: pošta ve složce Pošta k odeslání a příznaky a přesuny provedené offline. Pokud se MailCraft k serveru nedostane, přepnutí počká, dokud to nepůjde." +#. android +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/Navigation.kt +#, fuzzy +msgid "Appearance" +msgstr "Vzhled" + #. interface #: crates/ui-egui/src/account_setup.rs #, fuzzy @@ -4438,8 +4444,8 @@ msgstr "Vyjmout nepřijímá žádné parametry: vyjme, co je vybrané" msgid "DOMAIN\\user or you@example.org; empty for your address" msgstr "DOMÉNA\\uživatel nebo vy@example.org; prázdné pro vaši adresu" -#. name -#: crates/ui-egui/src/theme.rs +#. android, name +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingPrefs.kt crates/ui-egui/src/theme.rs #, fuzzy msgid "Dark" msgstr "Tmavý" @@ -6300,6 +6306,12 @@ msgstr "" msgid "Follow Up" msgstr "K vyřízení" +#. android +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingPrefs.kt +#, fuzzy +msgid "Follow system" +msgstr "Podle systému" + #. interface #: crates/ui-egui/src/alerts.rs crates/ui-egui/src/reminders.rs #, fuzzy @@ -8578,8 +8590,8 @@ msgstr "Dejte lidem vědět, že jste pryč nebo chvíli nemůžete odpovídat: msgid "Licences" msgstr "Licence" -#. name -#: crates/ui-egui/src/theme.rs +#. android, name +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingPrefs.kt crates/ui-egui/src/theme.rs #, fuzzy msgid "Light" msgstr "Světlý" diff --git a/crates/i18n/po/de.po b/crates/i18n/po/de.po index cb7798a45..11afff400 100644 --- a/crates/i18n/po/de.po +++ b/crates/i18n/po/de.po @@ -1736,6 +1736,12 @@ msgstr "Anderer Mailserver" msgid "Anything still waiting to go to the server goes first: mail in the Outbox, and flags and moves made while you were offline. If MailCraft can't reach the server, the switch waits until it can." msgstr "Alles, was noch an den Server gehen soll, geht zuerst: E-Mails im Postausgang sowie Kennzeichnungen und Verschiebungen, die Sie offline vorgenommen haben. Erreicht MailCraft den Server nicht, wartet der Wechsel, bis es so weit ist." +#. android +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/Navigation.kt +#, fuzzy +msgid "Appearance" +msgstr "Darstellung" + #. interface #: crates/ui-egui/src/account_setup.rs #, fuzzy @@ -4228,8 +4234,8 @@ msgstr "Ausschneiden nimmt keine Parameter an: Es schneidet aus, was ausgewählt msgid "DOMAIN\\user or you@example.org; empty for your address" msgstr "DOMAIN\\Benutzer oder you@example.org; leer lassen, um Ihre eigene Adresse zu verwenden" -#. name -#: crates/ui-egui/src/theme.rs +#. android, name +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingPrefs.kt crates/ui-egui/src/theme.rs msgid "Dark" msgstr "Dunkel" @@ -5944,6 +5950,12 @@ msgstr "" msgid "Follow Up" msgstr "Nachverfolgung" +#. android +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingPrefs.kt +#, fuzzy +msgid "Follow system" +msgstr "Systemeinstellung folgen" + #. interface #: crates/ui-egui/src/alerts.rs crates/ui-egui/src/reminders.rs #, fuzzy @@ -8053,8 +8065,8 @@ msgstr "Lassen Sie andere wissen, dass Sie abwesend sind oder eine Zeit lang nic msgid "Licences" msgstr "Lizenzen" -#. name -#: crates/ui-egui/src/theme.rs +#. android, name +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingPrefs.kt crates/ui-egui/src/theme.rs #, fuzzy msgid "Light" msgstr "Hell" diff --git a/crates/i18n/po/es.po b/crates/i18n/po/es.po index 055d56f14..cdb2a79f8 100644 --- a/crates/i18n/po/es.po +++ b/crates/i18n/po/es.po @@ -1824,6 +1824,12 @@ msgstr "Cualquier otro servidor de correo" msgid "Anything still waiting to go to the server goes first: mail in the Outbox, and flags and moves made while you were offline. If MailCraft can't reach the server, the switch waits until it can." msgstr "Primero se envía todo lo que aún espera para ir al servidor: el correo de la Bandeja de salida y las marcas y movimientos hechos mientras estaba sin conexión. Si MailCraft no puede conectar con el servidor, el cambio espera hasta que pueda." +#. android +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/Navigation.kt +#, fuzzy +msgid "Appearance" +msgstr "Apariencia" + #. interface #: crates/ui-egui/src/account_setup.rs #, fuzzy @@ -4440,8 +4446,8 @@ msgstr "Cortar no admite parámetros: corta lo que está seleccionado" msgid "DOMAIN\\user or you@example.org; empty for your address" msgstr "DOMINIO\\usuario o usted@example.org; vacío para su dirección" -#. name -#: crates/ui-egui/src/theme.rs +#. android, name +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingPrefs.kt crates/ui-egui/src/theme.rs #, fuzzy msgid "Dark" msgstr "Oscuro" @@ -6292,6 +6298,12 @@ msgstr "Seguimiento" msgid "Follow Up" msgstr "Seguimiento" +#. android +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingPrefs.kt +#, fuzzy +msgid "Follow system" +msgstr "Seguir el sistema" + #. interface #: crates/ui-egui/src/alerts.rs crates/ui-egui/src/reminders.rs #, fuzzy @@ -8559,8 +8571,8 @@ msgstr "Avise a la gente de que está ausente o no puede responder por un tiempo msgid "Licences" msgstr "Licencias" -#. name -#: crates/ui-egui/src/theme.rs +#. android, name +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingPrefs.kt crates/ui-egui/src/theme.rs #, fuzzy msgid "Light" msgstr "Claro" diff --git a/crates/i18n/po/fr.po b/crates/i18n/po/fr.po index 31078d0ca..8c5563af6 100644 --- a/crates/i18n/po/fr.po +++ b/crates/i18n/po/fr.po @@ -1821,6 +1821,12 @@ msgstr "Tout autre serveur de messagerie" msgid "Anything still waiting to go to the server goes first: mail in the Outbox, and flags and moves made while you were offline. If MailCraft can't reach the server, the switch waits until it can." msgstr "Tout ce qui attend encore d'être envoyé au serveur part d'abord : le courrier de la Boîte d'envoi, ainsi que les indicateurs et déplacements effectués hors connexion. Si MailCraft ne peut pas joindre le serveur, le basculement attend que ce soit possible." +#. android +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/Navigation.kt +#, fuzzy +msgid "Appearance" +msgstr "Apparence" + #. interface #: crates/ui-egui/src/account_setup.rs #, fuzzy @@ -4426,8 +4432,8 @@ msgstr "Couper ne prend aucun paramètre : il coupe ce qui est sélectionné" msgid "DOMAIN\\user or you@example.org; empty for your address" msgstr "DOMAINE\\utilisateur ou vous@example.org ; vide pour votre adresse" -#. name -#: crates/ui-egui/src/theme.rs +#. android, name +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingPrefs.kt crates/ui-egui/src/theme.rs #, fuzzy msgid "Dark" msgstr "Sombre" @@ -6268,6 +6274,12 @@ msgstr "Suivi" msgid "Follow Up" msgstr "Suivi" +#. android +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingPrefs.kt +#, fuzzy +msgid "Follow system" +msgstr "Suivre le système" + #. interface #: crates/ui-egui/src/alerts.rs crates/ui-egui/src/reminders.rs #, fuzzy @@ -8522,8 +8534,8 @@ msgstr "Prévenez les gens que vous êtes absent ou ne pouvez pas répondre pend msgid "Licences" msgstr "Licences" -#. name -#: crates/ui-egui/src/theme.rs +#. android, name +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingPrefs.kt crates/ui-egui/src/theme.rs #, fuzzy msgid "Light" msgstr "Clair" diff --git a/crates/i18n/po/hu.po b/crates/i18n/po/hu.po index be0de62db..3cf91ecbd 100644 --- a/crates/i18n/po/hu.po +++ b/crates/i18n/po/hu.po @@ -1826,6 +1826,12 @@ msgstr "Más levelezési kiszolgáló" msgid "Anything still waiting to go to the server goes first: mail in the Outbox, and flags and moves made while you were offline. If MailCraft can't reach the server, the switch waits until it can." msgstr "Bármi, ami még vár a szerverre, az az első: a postafiókban, a zászlók és a mozdulatok, amíg offline. Ha MailCraft nem éri el a szervert, a kapcsoló vár, amíg nem." +#. android +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/Navigation.kt +#, fuzzy +msgid "Appearance" +msgstr "Megjelenés" + #. interface #: crates/ui-egui/src/account_setup.rs #, fuzzy @@ -4440,8 +4446,8 @@ msgstr "A Kivágás nem fogad paramétert: azt vágja ki, ami ki van jelölve" msgid "DOMAIN\\user or you@example.org; empty for your address" msgstr "DOMAIN\\user or you@pexage.org; üresen áll a címre" -#. name -#: crates/ui-egui/src/theme.rs +#. android, name +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingPrefs.kt crates/ui-egui/src/theme.rs #, fuzzy msgid "Dark" msgstr "Sötét" @@ -6282,6 +6288,12 @@ msgstr "Elintézendő" msgid "Follow Up" msgstr "Elintézendő" +#. android +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingPrefs.kt +#, fuzzy +msgid "Follow system" +msgstr "Rendszerbeállítás követése" + #. interface #: crates/ui-egui/src/alerts.rs crates/ui-egui/src/reminders.rs #, fuzzy @@ -8554,8 +8566,8 @@ msgstr "Tudasd az emberekkel, hogy távol vagy, vagy nem tudsz válaszolni egy i msgid "Licences" msgstr "Licencek" -#. name -#: crates/ui-egui/src/theme.rs +#. android, name +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingPrefs.kt crates/ui-egui/src/theme.rs #, fuzzy msgid "Light" msgstr "Világos" diff --git a/crates/i18n/po/it.po b/crates/i18n/po/it.po index 6c8a8ff92..9a34ab0c3 100644 --- a/crates/i18n/po/it.po +++ b/crates/i18n/po/it.po @@ -1822,6 +1822,12 @@ msgstr "Qualsiasi altro server di posta" msgid "Anything still waiting to go to the server goes first: mail in the Outbox, and flags and moves made while you were offline. If MailCraft can't reach the server, the switch waits until it can." msgstr "Tutto ciò che è ancora in attesa di andare al server parte per primo: la posta in Posta in uscita e i contrassegni e gli spostamenti fatti offline. Se MailCraft non riesce a raggiungere il server, il passaggio attende finché non ci riesce." +#. android +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/Navigation.kt +#, fuzzy +msgid "Appearance" +msgstr "Aspetto" + #. interface #: crates/ui-egui/src/account_setup.rs #, fuzzy @@ -4436,8 +4442,8 @@ msgstr "Taglia non accetta parametri: taglia ciò che è selezionato" msgid "DOMAIN\\user or you@example.org; empty for your address" msgstr "DOMINIO\\utente oppure tu@example.org; vuoto per usare il tuo indirizzo" -#. name -#: crates/ui-egui/src/theme.rs +#. android, name +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingPrefs.kt crates/ui-egui/src/theme.rs #, fuzzy msgid "Dark" msgstr "Scuro" @@ -6288,6 +6294,12 @@ msgstr "Completamento" msgid "Follow Up" msgstr "Completamento" +#. android +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingPrefs.kt +#, fuzzy +msgid "Follow system" +msgstr "Segui il sistema" + #. interface #: crates/ui-egui/src/alerts.rs crates/ui-egui/src/reminders.rs #, fuzzy @@ -8554,8 +8566,8 @@ msgstr "Fai sapere alle persone che sei assente o non puoi rispondere per un po' msgid "Licences" msgstr "Licenze" -#. name -#: crates/ui-egui/src/theme.rs +#. android, name +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingPrefs.kt crates/ui-egui/src/theme.rs #, fuzzy msgid "Light" msgstr "Chiaro" diff --git a/crates/i18n/po/ka.po b/crates/i18n/po/ka.po index 64f93160a..c134cd4e5 100644 --- a/crates/i18n/po/ka.po +++ b/crates/i18n/po/ka.po @@ -1821,6 +1821,12 @@ msgstr "ნებისმიერი სხვა საფოსტო სე msgid "Anything still waiting to go to the server goes first: mail in the Outbox, and flags and moves made while you were offline. If MailCraft can't reach the server, the switch waits until it can." msgstr "ჯერ იგზავნება ყველაფერი, რაც სერვერზე გასაგზავნად ელოდება: გასაგზავნებში არსებული ფოსტა და ოფლაინ რეჟიმში დასმული დროშები და გადატანები. თუ MailCraft სერვერს ვერ უკავშირდება, გადასვლა დაელოდება, სანამ შეძლებს." +#. android +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/Navigation.kt +#, fuzzy +msgid "Appearance" +msgstr "იერსახე" + #. interface #: crates/ui-egui/src/account_setup.rs #, fuzzy @@ -4429,8 +4435,8 @@ msgstr "ამოჭრა პარამეტრებს არ იღებ msgid "DOMAIN\\user or you@example.org; empty for your address" msgstr "DOMAIN\\user ან you@example.org; თქვენი მისამართისთვის ცარიელი დატოვეთ" -#. name -#: crates/ui-egui/src/theme.rs +#. android, name +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingPrefs.kt crates/ui-egui/src/theme.rs #, fuzzy msgid "Dark" msgstr "მუქი" @@ -6279,6 +6285,12 @@ msgstr "" msgid "Follow Up" msgstr "შემდგომი რეაგირება" +#. android +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingPrefs.kt +#, fuzzy +msgid "Follow system" +msgstr "სისტემის მიყოლა" + #. interface #: crates/ui-egui/src/alerts.rs crates/ui-egui/src/reminders.rs #, fuzzy @@ -8541,8 +8553,8 @@ msgstr "აცნობეთ ხალხს, რომ არ ხართ ა msgid "Licences" msgstr "ლიცენზიები" -#. name -#: crates/ui-egui/src/theme.rs +#. android, name +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingPrefs.kt crates/ui-egui/src/theme.rs #, fuzzy msgid "Light" msgstr "ღია" diff --git a/crates/i18n/po/messages.pot b/crates/i18n/po/messages.pot index 90cb6da02..1b30c4a7d 100644 --- a/crates/i18n/po/messages.pot +++ b/crates/i18n/po/messages.pot @@ -1517,6 +1517,11 @@ msgstr "" msgid "Anything still waiting to go to the server goes first: mail in the Outbox, and flags and moves made while you were offline. If MailCraft can't reach the server, the switch waits until it can." msgstr "" +#. android +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/Navigation.kt +msgid "Appearance" +msgstr "" + #. interface #: crates/ui-egui/src/account_setup.rs msgid "Application (client) ID" @@ -3693,8 +3698,8 @@ msgstr "" msgid "DOMAIN\\user or you@example.org; empty for your address" msgstr "" -#. name -#: crates/ui-egui/src/theme.rs +#. android, name +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingPrefs.kt crates/ui-egui/src/theme.rs msgid "Dark" msgstr "" @@ -5225,6 +5230,11 @@ msgstr "" msgid "Follow Up" msgstr "" +#. android +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingPrefs.kt +msgid "Follow system" +msgstr "" + #. interface #: crates/ui-egui/src/alerts.rs crates/ui-egui/src/reminders.rs msgid "Follow up" @@ -7106,8 +7116,8 @@ msgstr "" msgid "Licences" msgstr "" -#. name -#: crates/ui-egui/src/theme.rs +#. android, name +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingPrefs.kt crates/ui-egui/src/theme.rs msgid "Light" msgstr "" diff --git a/crates/i18n/po/nl.po b/crates/i18n/po/nl.po index cba3c6eda..4e4395a82 100644 --- a/crates/i18n/po/nl.po +++ b/crates/i18n/po/nl.po @@ -1783,6 +1783,12 @@ msgstr "Elke andere e-mailserver" msgid "Anything still waiting to go to the server goes first: mail in the Outbox, and flags and moves made while you were offline. If MailCraft can't reach the server, the switch waits until it can." msgstr "Alles wat nog naar de server moet, gaat eerst: e-mail in Postvak UIT, en markeringen en verplaatsingen die u hebt gemaakt terwijl u offline was. Als MailCraft de server niet kan bereiken, wacht de overstap tot dat wel kan." +#. android +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/Navigation.kt +#, fuzzy +msgid "Appearance" +msgstr "Weergave" + #. interface #: crates/ui-egui/src/account_setup.rs #, fuzzy @@ -4293,8 +4299,8 @@ msgstr "Knippen neemt geen parameters: het knipt wat geselecteerd is" msgid "DOMAIN\\user or you@example.org; empty for your address" msgstr "DOMAIN\\user of naam@example.org; leeg voor uw adres" -#. name -#: crates/ui-egui/src/theme.rs +#. android, name +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingPrefs.kt crates/ui-egui/src/theme.rs #, fuzzy msgid "Dark" msgstr "Donker" @@ -6057,6 +6063,12 @@ msgstr "Opvolgen" msgid "Follow Up" msgstr "Opvolgen" +#. android +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingPrefs.kt +#, fuzzy +msgid "Follow system" +msgstr "Systeem volgen" + #. interface #: crates/ui-egui/src/alerts.rs crates/ui-egui/src/reminders.rs #, fuzzy @@ -8258,8 +8270,8 @@ msgstr "Laat weten dat u afwezig bent of een tijd niet kunt antwoorden: uw postv msgid "Licences" msgstr "Licenties" -#. name -#: crates/ui-egui/src/theme.rs +#. android, name +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingPrefs.kt crates/ui-egui/src/theme.rs #, fuzzy msgid "Light" msgstr "Licht" diff --git a/crates/i18n/po/pl.po b/crates/i18n/po/pl.po index 84418f6a2..a39deb78a 100644 --- a/crates/i18n/po/pl.po +++ b/crates/i18n/po/pl.po @@ -1827,6 +1827,12 @@ msgstr "Dowolny inny serwer poczty" msgid "Anything still waiting to go to the server goes first: mail in the Outbox, and flags and moves made while you were offline. If MailCraft can't reach the server, the switch waits until it can." msgstr "Najpierw wysyłane jest wszystko, co nadal czeka na serwer: poczta w Skrzynce nadawczej oraz flagi i przeniesienia wykonane w trybie offline. Jeśli MailCraft nie może połączyć się z serwerem, przełączenie czeka, aż będzie to możliwe." +#. android +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/Navigation.kt +#, fuzzy +msgid "Appearance" +msgstr "Wygląd" + #. interface #: crates/ui-egui/src/account_setup.rs #, fuzzy @@ -4448,8 +4454,8 @@ msgstr "Wytnij nie przyjmuje parametrów: wycina to, co jest zaznaczone" msgid "DOMAIN\\user or you@example.org; empty for your address" msgstr "DOMENA\\użytkownik lub ty@example.org; puste dla Twojego adresu" -#. name -#: crates/ui-egui/src/theme.rs +#. android, name +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingPrefs.kt crates/ui-egui/src/theme.rs #, fuzzy msgid "Dark" msgstr "Ciemny" @@ -6311,6 +6317,12 @@ msgstr "" msgid "Follow Up" msgstr "Do działania" +#. android +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingPrefs.kt +#, fuzzy +msgid "Follow system" +msgstr "Zgodnie z systemem" + #. interface #: crates/ui-egui/src/alerts.rs crates/ui-egui/src/reminders.rs #, fuzzy @@ -8591,8 +8603,8 @@ msgstr "Poinformuj innych, że jesteś nieobecny lub przez pewien czas nie może msgid "Licences" msgstr "Licencje" -#. name -#: crates/ui-egui/src/theme.rs +#. android, name +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingPrefs.kt crates/ui-egui/src/theme.rs #, fuzzy msgid "Light" msgstr "Jasny" diff --git a/crates/i18n/po/ro.po b/crates/i18n/po/ro.po index d5f19ecc4..e11a93b6c 100644 --- a/crates/i18n/po/ro.po +++ b/crates/i18n/po/ro.po @@ -1825,6 +1825,12 @@ msgstr "Orice alt server de e-mail" msgid "Anything still waiting to go to the server goes first: mail in the Outbox, and flags and moves made while you were offline. If MailCraft can't reach the server, the switch waits until it can." msgstr "Tot ce încă așteaptă să ajungă pe server pleacă primul: e-mailurile din Mesaje de trimis și marcajele și mutările făcute cât ați fost offline. Dacă MailCraft nu poate contacta serverul, schimbarea așteaptă până poate." +#. android +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/Navigation.kt +#, fuzzy +msgid "Appearance" +msgstr "Aspect" + #. interface #: crates/ui-egui/src/account_setup.rs #, fuzzy @@ -4446,8 +4452,8 @@ msgstr "Decuparea nu primește parametri: decupează ce este selectat" msgid "DOMAIN\\user or you@example.org; empty for your address" msgstr "DOMENIU\\utilizator sau dvs@example.org; gol pentru adresa dvs." -#. name -#: crates/ui-egui/src/theme.rs +#. android, name +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingPrefs.kt crates/ui-egui/src/theme.rs #, fuzzy msgid "Dark" msgstr "Întunecat" @@ -6307,6 +6313,12 @@ msgstr "Urmărire" msgid "Follow Up" msgstr "Urmărire" +#. android +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingPrefs.kt +#, fuzzy +msgid "Follow system" +msgstr "Urmează sistemul" + #. interface #: crates/ui-egui/src/alerts.rs crates/ui-egui/src/reminders.rs #, fuzzy @@ -8587,8 +8599,8 @@ msgstr "Anunțați-i pe ceilalți că sunteți plecat sau nu puteți răspunde o msgid "Licences" msgstr "Licențe" -#. name -#: crates/ui-egui/src/theme.rs +#. android, name +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingPrefs.kt crates/ui-egui/src/theme.rs #, fuzzy msgid "Light" msgstr "Luminos" diff --git a/crates/i18n/po/zh_CN.po b/crates/i18n/po/zh_CN.po index a6c04b5df..5d195af0c 100644 --- a/crates/i18n/po/zh_CN.po +++ b/crates/i18n/po/zh_CN.po @@ -1821,6 +1821,12 @@ msgstr "任何其他邮件服务器" msgid "Anything still waiting to go to the server goes first: mail in the Outbox, and flags and moves made while you were offline. If MailCraft can't reach the server, the switch waits until it can." msgstr "等待发送到服务器的内容将先被处理:发件箱中的邮件,以及您离线时的标记和移动。如果 MailCraft 无法连接服务器,切换将等待连接恢复。" +#. android +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/Navigation.kt +#, fuzzy +msgid "Appearance" +msgstr "外观" + #. interface #: crates/ui-egui/src/account_setup.rs #, fuzzy @@ -4440,8 +4446,8 @@ msgstr "剪切不接受参数:它剪切所选内容" msgid "DOMAIN\\user or you@example.org; empty for your address" msgstr "DOMAIN\\user 或 you@example.org;留空则使用您的地址" -#. name -#: crates/ui-egui/src/theme.rs +#. android, name +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingPrefs.kt crates/ui-egui/src/theme.rs #, fuzzy msgid "Dark" msgstr "深色" @@ -6284,6 +6290,12 @@ msgstr "后续 ↵ 操作" msgid "Follow Up" msgstr "跟进" +#. android +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingPrefs.kt +#, fuzzy +msgid "Follow system" +msgstr "跟随系统" + #. interface #: crates/ui-egui/src/alerts.rs crates/ui-egui/src/reminders.rs #, fuzzy @@ -8552,8 +8564,8 @@ msgstr "让别人知道您不在或暂时无法回复:邮箱会自动回复" msgid "Licences" msgstr "许可证" -#. name -#: crates/ui-egui/src/theme.rs +#. android, name +#: apps/mailcraft-android/app/src/main/kotlin/work/mailcraft/android/ReadingPrefs.kt crates/ui-egui/src/theme.rs #, fuzzy msgid "Light" msgstr "浅色" diff --git a/docs/log.d/ROADMAP/progress/1997.md b/docs/log.d/ROADMAP/progress/1997.md new file mode 100644 index 000000000..938398549 --- /dev/null +++ b/docs/log.d/ROADMAP/progress/1997.md @@ -0,0 +1 @@ +| 2026-11-26 | Android Settings › Appearance: Light, Dark or Follow system (#1997) | diff --git a/docs/log.d/ROADMAP/revisions/1997.md b/docs/log.d/ROADMAP/revisions/1997.md new file mode 100644 index 000000000..aabe1c09e --- /dev/null +++ b/docs/log.d/ROADMAP/revisions/1997.md @@ -0,0 +1 @@ +| 2026-11-26 | patch: Android theme choice in Settings (#1997). | diff --git a/packaging/release-notes.d/new/1997.android.md b/packaging/release-notes.d/new/1997.android.md new file mode 100644 index 000000000..0fefd01c8 --- /dev/null +++ b/packaging/release-notes.d/new/1997.android.md @@ -0,0 +1 @@ +- Android: Settings › Appearance lets you choose Light, Dark or Follow system (the default). It applies at once to every screen and to the status and navigation bars, and is kept on the phone. "Light page in the dark theme" applies only when the app is dark ([#1997](https://github.com/GITHUB_REPOSITORY/issues/1997)).