From bab6fd175a5f868cf92cecef4ad2a732f309bc5d Mon Sep 17 00:00:00 2001 From: Jean-Luc Makiola Date: Thu, 18 Jun 2026 10:28:13 +0200 Subject: [PATCH] fix(i18n): make the language picker actually apply on device The in-app language picker silently did nothing: AppCompatDelegate.set ApplicationLocales only syncs to the system from an AppCompatActivity, but MainActivity was a plain ComponentActivity (with a platform theme). Switch MainActivity to AppCompatActivity and base Theme.Calendula on Theme.AppCompat.DayNight.NoActionBar. Changing the locale recreates the activity; set android:windowBackground to a DayNight colour matching the Compose background (light #FBFCFE / dark #101316) so the recreation no longer flashes a contrasting backdrop. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../main/java/de/jeanlucmakiola/calendula/MainActivity.kt | 4 ++-- app/src/main/res/values-night/colors.xml | 6 ++++++ app/src/main/res/values/colors.xml | 4 ++++ app/src/main/res/values/themes.xml | 7 ++++++- 4 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 app/src/main/res/values-night/colors.xml diff --git a/app/src/main/java/de/jeanlucmakiola/calendula/MainActivity.kt b/app/src/main/java/de/jeanlucmakiola/calendula/MainActivity.kt index f8b07b1..d8d6599 100644 --- a/app/src/main/java/de/jeanlucmakiola/calendula/MainActivity.kt +++ b/app/src/main/java/de/jeanlucmakiola/calendula/MainActivity.kt @@ -3,9 +3,9 @@ package de.jeanlucmakiola.calendula import android.content.Context import android.content.Intent import android.os.Bundle -import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.activity.enableEdgeToEdge +import androidx.appcompat.app.AppCompatActivity import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.runtime.getValue @@ -24,7 +24,7 @@ import de.jeanlucmakiola.calendula.ui.theme.CalendulaTheme import kotlinx.datetime.LocalDate @AndroidEntryPoint -class MainActivity : ComponentActivity() { +class MainActivity : AppCompatActivity() { // The occurrence a reminder notification was tapped for (eventId, begin, // end — the detail screen's key shape). singleTop + onNewIntent route a diff --git a/app/src/main/res/values-night/colors.xml b/app/src/main/res/values-night/colors.xml new file mode 100644 index 0000000..15fc990 --- /dev/null +++ b/app/src/main/res/values-night/colors.xml @@ -0,0 +1,6 @@ + + + #FF101316 + diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index eefed3d..3435ae8 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -3,4 +3,8 @@ #FF5C6B7A #FF5C6B7A + + #FFFBFCFE diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index 7a8c0b8..254dfad 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -1,5 +1,10 @@ -