Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

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

Maurice41134cc4555c
diff --git a/client/android/app/src/main/java/com/liketrek/trek/widget/TrekWidgets.kt b/client/android/app/src/main/java/com/liketrek/trek/widget/TrekWidgets.kt
index 71919eea7..1af7aa1e8 100644
--- a/client/android/app/src/main/java/com/liketrek/trek/widget/TrekWidgets.kt
+++ b/client/android/app/src/main/java/com/liketrek/trek/widget/TrekWidgets.kt
@@ -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) {