fix(native): read the flight widget's direction from the locale

Android lint refuses a composition reading the Configuration through
LocalContext. The arc's mirroring now follows the locale's layout direction,
which is what the widget's language decides anyway.
This commit is contained in:
Maurice
2026-11-13 15:36:43 +01:00
parent 27f12c2245
commit 41134cc455
@@ -537,10 +537,13 @@ class FlightWidget : TrekWidget() {
}
}
/** The origin stands on the right in a right-to-left layout, so the drawn arc is mirrored with it. */
@Composable
/**
* The origin stands on the right in a right-to-left layout, so the drawn arc is
* mirrored with it. Read from the locale the widget speaks, not from the
* Configuration, which a composition may not read directly.
*/
private fun isRtl(): Boolean =
LocalContext.current.resources.configuration.layoutDirection == android.view.View.LAYOUT_DIRECTION_RTL
android.text.TextUtils.getLayoutDirectionFromLocale(java.util.Locale.getDefault()) == android.view.View.LAYOUT_DIRECTION_RTL
@Composable
private fun ColumnScope.FlightBody(f: WidgetSnapshot.Flight, labels: WidgetSnapshot.Labels, wide: Boolean, tall: Boolean) {