@@ -28,6 +28,7 @@ import com.mg4.control.model.DrivingProfile
2828import com.mg4.control.profile.ProfileApplier
2929import com.mg4.control.profile.ProfileManager
3030import com.mg4.control.util.LocaleHelper
31+ import com.mg4.control.util.ThemeHelper
3132import kotlinx.coroutines.CoroutineScope
3233import kotlinx.coroutines.Dispatchers
3334import kotlinx.coroutines.launch
@@ -128,15 +129,17 @@ object ProfilePickerOverlay {
128129
129130 // Le contexte du Service n'a pas de thème Material → on l'enveloppe
130131 // avec le thème de l'app pour que MaterialButton puisse s'instancier.
131- val themedContext = ContextThemeWrapper (localizedContext, R .style.Theme_MG4Control )
132+ val themedContext = ContextThemeWrapper (ThemeHelper .withAppTheme( localizedContext) , R .style.Theme_MG4Control )
132133
133134 // Inflate la vue depuis le layout XML (utilise le contexte thémé)
134135 val view = LayoutInflater .from(themedContext).inflate(R .layout.overlay_profile_picker, null )
135136
136137 // ── Grille 2 colonnes de profils ─────────────────────────────────
137138 val container = view.findViewById<LinearLayout >(R .id.overlay_profiles_container)
138- val accentColor = context.getColor(R .color.dash_accent)
139- val accentDimColor = context.getColor(R .color.dash_accent_dim)
139+ // Sur le contexte THÉMÉ : pris sur celui du service, ces deux bleus resteraient ceux du
140+ // thème sombre dans une fenêtre claire.
141+ val accentColor = themedContext.getColor(R .color.dash_accent)
142+ val accentDimColor = themedContext.getColor(R .color.dash_accent_dim)
140143 val dm = context.resources.displayMetrics
141144
142145 fun dp (value : Float ) = TypedValue .applyDimension(TypedValue .COMPLEX_UNIT_DIP , value, dm).toInt()
@@ -371,7 +374,7 @@ object ProfilePickerOverlay {
371374 // c'est aussi celui qu'applique le délai d'un conflit Bluetooth.
372375 val premierProfil = grille.indexOfFirst { it.firstOrNull() == = lignesProfils.firstOrNull()?.firstOrNull() }
373376 navigation = OverlayNavigation (
374- context = context ,
377+ context = themedContext ,
375378 grille = grille,
376379 depart = JoystickFocus .Position (premierProfil.coerceAtLeast(0 ), 0 ),
377380 surDeplacement = { resetTimers() },
@@ -391,7 +394,8 @@ object ProfilePickerOverlay {
391394 val inPark = MG4Hardware .isVehicleInPark()
392395 handler.post {
393396 if (inPark == true ) {
394- val themed = ContextThemeWrapper (LocaleHelper .applyLocale(context), R .style.Theme_MG4Control )
397+ val themed = ContextThemeWrapper (
398+ ThemeHelper .withAppTheme(LocaleHelper .applyLocale(context)), R .style.Theme_MG4Control )
395399 val dialog = AlertDialog .Builder (themed)
396400 .setTitle(R .string.vehicle_power_dialog_title)
397401 .setMessage(R .string.vehicle_power_dialog_msg)
0 commit comments