diff options
| author | Claude <noreply@anthropic.com> | 2026-04-10 16:27:42 +0000 |
|---|---|---|
| committer | Claude <noreply@anthropic.com> | 2026-04-10 16:27:42 +0000 |
| commit | bf57713ef0e378ebedd518f4fb243328de08179d (patch) | |
| tree | 63e130972b2306cf578b51052219ed290f994e34 /android-app/app/src/main/res | |
| parent | 4daf9dfcd00844075768e5b0d1dd7a17002a26d0 (diff) | |
Add unit settings, wind particles toggle, and recenter-to-top
- New UnitPrefs: persisted C/F, ft/m, hPa/inHg, kt/mph/kph — defaults to °F
- InstrumentHandler now accepts raw values (knots, metres, hPa, °C) and formats
via UnitPrefs on every update
- LayerPickerSheet expanded with wind particles toggle and unit chip selectors;
wrapped in ScrollView to handle the additional height
- MapLayerManager tracks particlesEnabled (persisted); setParticlesEnabled() added
- MainActivity: caches last raw values so refreshUnits() can reformat everything
instantly when the user changes a unit without waiting for new sensor data
- Recenter button moved to top (below HUD strip) so it's never obscured by the
bottom sheet or bottom nav
- Unit label TextViews given IDs in HUD and instrument sheet for live updates
https://claude.ai/code/session_01HXPjBsogsJVRwCiekDGkJX
Diffstat (limited to 'android-app/app/src/main/res')
4 files changed, 290 insertions, 81 deletions
diff --git a/android-app/app/src/main/res/layout/activity_main.xml b/android-app/app/src/main/res/layout/activity_main.xml index 5147506..5943949 100644 --- a/android-app/app/src/main/res/layout/activity_main.xml +++ b/android-app/app/src/main/res/layout/activity_main.xml @@ -90,10 +90,10 @@ android:visibility="gone" app:cornerRadius="20dp" app:elevation="20dp" - app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintTop_toBottomOf="@id/nav_hud" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" - android:layout_marginBottom="24dp" /> + android:layout_marginTop="8dp" /> </androidx.constraintlayout.widget.ConstraintLayout> diff --git a/android-app/app/src/main/res/layout/layout_instruments_sheet.xml b/android-app/app/src/main/res/layout/layout_instruments_sheet.xml index faec826..03cefb7 100644 --- a/android-app/app/src/main/res/layout/layout_instruments_sheet.xml +++ b/android-app/app/src/main/res/layout/layout_instruments_sheet.xml @@ -56,7 +56,7 @@ android:id="@+id/value_tws" style="@style/InstrumentPrimaryValue" tools:text="15.5" /> - <TextView style="@style/InstrumentUnit" android:text="kts" /> + <TextView android:id="@+id/unit_tws" style="@style/InstrumentUnit" android:text="kt" /> <org.terst.nav.ui.DirectionArrowView android:id="@+id/arrow_tws" android:layout_width="14dp" @@ -95,7 +95,7 @@ android:id="@+id/value_temp" style="@style/InstrumentPrimaryValue" tools:text="18" /> - <TextView style="@style/InstrumentUnit" android:text="°C" /> + <TextView android:id="@+id/unit_temp" style="@style/InstrumentUnit" android:text="°F" /> </LinearLayout> </LinearLayout> @@ -123,7 +123,7 @@ android:id="@+id/value_baro" style="@style/InstrumentPrimaryValue" tools:text="1013" /> - <TextView style="@style/InstrumentUnit" android:text="hPa" /> + <TextView android:id="@+id/unit_baro" style="@style/InstrumentUnit" android:text="hPa" /> </LinearLayout> </LinearLayout> @@ -175,7 +175,7 @@ android:id="@+id/value_curr_spd" style="@style/ForecastValue" tools:text="0.8" /> - <TextView style="@style/ForecastUnit" android:text="kts" /> + <TextView android:id="@+id/unit_curr_spd" style="@style/ForecastUnit" android:text="kt" /> </LinearLayout> <LinearLayout android:layout_width="wrap_content" @@ -214,7 +214,7 @@ android:id="@+id/value_wave_ht" style="@style/ForecastValue" tools:text="3.5" /> - <TextView style="@style/ForecastUnit" android:text="ft" /> + <TextView android:id="@+id/unit_wave_ht" style="@style/ForecastUnit" android:text="ft" /> </LinearLayout> <LinearLayout android:layout_width="wrap_content" @@ -253,7 +253,7 @@ android:id="@+id/value_swell_ht" style="@style/ForecastValue" tools:text="5.2" /> - <TextView style="@style/ForecastUnit" android:text="ft" /> + <TextView android:id="@+id/unit_swell_ht" style="@style/ForecastUnit" android:text="ft" /> </LinearLayout> <LinearLayout android:layout_width="wrap_content" diff --git a/android-app/app/src/main/res/layout/layout_layer_picker_sheet.xml b/android-app/app/src/main/res/layout/layout_layer_picker_sheet.xml index c424606..fdfbb7a 100644 --- a/android-app/app/src/main/res/layout/layout_layer_picker_sheet.xml +++ b/android-app/app/src/main/res/layout/layout_layer_picker_sheet.xml @@ -1,104 +1,310 @@ <?xml version="1.0" encoding="utf-8"?> -<LinearLayout +<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" - android:orientation="vertical" - android:paddingStart="24dp" - android:paddingEnd="24dp" - android:paddingBottom="32dp" android:background="?attr/colorSurface"> - <View - android:layout_width="36dp" - android:layout_height="4dp" - android:layout_gravity="center_horizontal" - android:layout_marginTop="12dp" - android:layout_marginBottom="20dp" - android:background="@color/md_theme_outline" /> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginBottom="16dp" - android:text="MAP LAYERS" - android:textSize="11sp" - android:textAllCaps="true" - android:letterSpacing="0.12" - android:fontFamily="sans-serif-light" - android:textColor="@color/instrument_text_secondary" /> - - <!-- Base map selection --> - <com.google.android.material.chip.ChipGroup - android:id="@+id/chip_group_base" + <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginBottom="24dp" - app:singleSelection="true" - app:selectionRequired="true" - xmlns:app="http://schemas.android.com/apk/res-auto"> - - <com.google.android.material.chip.Chip - android:id="@+id/chip_satellite" - style="@style/Widget.Material3.Chip.Filter" + android:orientation="vertical" + android:paddingStart="24dp" + android:paddingEnd="24dp" + android:paddingBottom="40dp"> + + <View + android:layout_width="36dp" + android:layout_height="4dp" + android:layout_gravity="center_horizontal" + android:layout_marginTop="12dp" + android:layout_marginBottom="20dp" + android:background="@color/md_theme_outline" /> + + <!-- ── MAP LAYERS ──────────────────────────────────────────── --> + + <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="Satellite" /> + android:layout_marginBottom="12dp" + android:text="MAP LAYERS" + android:textSize="11sp" + android:textAllCaps="true" + android:letterSpacing="0.12" + android:fontFamily="sans-serif-light" + android:textColor="@color/instrument_text_secondary" /> - <com.google.android.material.chip.Chip - android:id="@+id/chip_charts" - style="@style/Widget.Material3.Chip.Filter" - android:layout_width="wrap_content" + <!-- Base map selection --> + <com.google.android.material.chip.ChipGroup + android:id="@+id/chip_group_base" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:text="Charts" /> + android:layout_marginBottom="20dp" + app:singleSelection="true" + app:selectionRequired="true"> - <com.google.android.material.chip.Chip - android:id="@+id/chip_hybrid" - style="@style/Widget.Material3.Chip.Filter" - android:layout_width="wrap_content" + <com.google.android.material.chip.Chip + android:id="@+id/chip_satellite" + style="@style/Widget.Material3.Chip.Filter" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="Satellite" /> + + <com.google.android.material.chip.Chip + android:id="@+id/chip_charts" + style="@style/Widget.Material3.Chip.Filter" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="Charts" /> + + <com.google.android.material.chip.Chip + android:id="@+id/chip_hybrid" + style="@style/Widget.Material3.Chip.Filter" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="Hybrid" /> + + </com.google.android.material.chip.ChipGroup> + + <View + android:layout_width="match_parent" + android:layout_height="1dp" + android:layout_marginBottom="16dp" + android:background="@color/md_theme_surfaceVariant" /> + + <!-- Wind overlay toggle --> + <LinearLayout + android:layout_width="match_parent" android:layout_height="wrap_content" - android:text="Hybrid" /> + android:orientation="horizontal" + android:gravity="center_vertical" + android:layout_marginBottom="12dp"> - </com.google.android.material.chip.ChipGroup> + <LinearLayout + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:orientation="vertical"> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="Wind overlay" + android:textSize="15sp" + android:textColor="@color/instrument_text_normal" /> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="Wind speed colour map" + android:textSize="12sp" + android:textColor="@color/instrument_text_secondary" /> + </LinearLayout> - <!-- Wind divider --> - <View - android:layout_width="match_parent" - android:layout_height="1dp" - android:layout_marginBottom="16dp" - android:background="@color/md_theme_surfaceVariant" /> + <com.google.android.material.switchmaterial.SwitchMaterial + android:id="@+id/switch_wind" + android:layout_width="wrap_content" + android:layout_height="wrap_content" /> - <!-- Wind toggle --> - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal" - android:gravity="center_vertical"> + </LinearLayout> + <!-- Wind particles toggle --> <LinearLayout - android:layout_width="0dp" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_weight="1" - android:orientation="vertical"> + android:orientation="horizontal" + android:gravity="center_vertical" + android:layout_marginBottom="8dp"> + + <LinearLayout + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:orientation="vertical"> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="Wind particles" + android:textSize="15sp" + android:textColor="@color/instrument_text_normal" /> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="Animated particle overlay" + android:textSize="12sp" + android:textColor="@color/instrument_text_secondary" /> + </LinearLayout> + + <com.google.android.material.switchmaterial.SwitchMaterial + android:id="@+id/switch_particles" + android:layout_width="wrap_content" + android:layout_height="wrap_content" /> + + </LinearLayout> + + <!-- ── UNITS ───────────────────────────────────────────────── --> + + <View + android:layout_width="match_parent" + android:layout_height="1dp" + android:layout_marginTop="8dp" + android:layout_marginBottom="16dp" + android:background="@color/md_theme_surfaceVariant" /> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginBottom="12dp" + android:text="UNITS" + android:textSize="11sp" + android:textAllCaps="true" + android:letterSpacing="0.12" + android:fontFamily="sans-serif-light" + android:textColor="@color/instrument_text_secondary" /> + + <!-- Temperature --> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:gravity="center_vertical" + android:layout_marginBottom="10dp"> <TextView + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="Temperature" + android:textSize="14sp" + android:textColor="@color/instrument_text_normal" /> + <com.google.android.material.chip.ChipGroup + android:id="@+id/chip_group_temp" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="Wind overlay" - android:textSize="15sp" + app:singleSelection="true" + app:selectionRequired="true"> + <com.google.android.material.chip.Chip + android:id="@+id/chip_fahrenheit" + style="@style/Widget.Material3.Chip.Filter" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="°F" /> + <com.google.android.material.chip.Chip + android:id="@+id/chip_celsius" + style="@style/Widget.Material3.Chip.Filter" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="°C" /> + </com.google.android.material.chip.ChipGroup> + </LinearLayout> + + <!-- Depth / height --> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:gravity="center_vertical" + android:layout_marginBottom="10dp"> + <TextView + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="Depth / height" + android:textSize="14sp" android:textColor="@color/instrument_text_normal" /> + <com.google.android.material.chip.ChipGroup + android:id="@+id/chip_group_depth" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + app:singleSelection="true" + app:selectionRequired="true"> + <com.google.android.material.chip.Chip + android:id="@+id/chip_feet" + style="@style/Widget.Material3.Chip.Filter" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="ft" /> + <com.google.android.material.chip.Chip + android:id="@+id/chip_meters" + style="@style/Widget.Material3.Chip.Filter" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="m" /> + </com.google.android.material.chip.ChipGroup> + </LinearLayout> + + <!-- Pressure --> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:gravity="center_vertical" + android:layout_marginBottom="10dp"> <TextView + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="Pressure" + android:textSize="14sp" + android:textColor="@color/instrument_text_normal" /> + <com.google.android.material.chip.ChipGroup + android:id="@+id/chip_group_pressure" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="OpenWeatherMap wind speed" - android:textSize="12sp" - android:textColor="@color/instrument_text_secondary" /> + app:singleSelection="true" + app:selectionRequired="true"> + <com.google.android.material.chip.Chip + android:id="@+id/chip_hpa" + style="@style/Widget.Material3.Chip.Filter" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="hPa" /> + <com.google.android.material.chip.Chip + android:id="@+id/chip_inhg" + style="@style/Widget.Material3.Chip.Filter" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="inHg" /> + </com.google.android.material.chip.ChipGroup> </LinearLayout> - <com.google.android.material.switchmaterial.SwitchMaterial - android:id="@+id/switch_wind" - android:layout_width="wrap_content" - android:layout_height="wrap_content" /> + <!-- Speed --> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:gravity="center_vertical"> + <TextView + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="Speed" + android:textSize="14sp" + android:textColor="@color/instrument_text_normal" /> + <com.google.android.material.chip.ChipGroup + android:id="@+id/chip_group_speed" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + app:singleSelection="true" + app:selectionRequired="true"> + <com.google.android.material.chip.Chip + android:id="@+id/chip_knots" + style="@style/Widget.Material3.Chip.Filter" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="kt" /> + <com.google.android.material.chip.Chip + android:id="@+id/chip_mph" + style="@style/Widget.Material3.Chip.Filter" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="mph" /> + <com.google.android.material.chip.Chip + android:id="@+id/chip_kph" + style="@style/Widget.Material3.Chip.Filter" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="kph" /> + </com.google.android.material.chip.ChipGroup> + </LinearLayout> </LinearLayout> - -</LinearLayout> +</ScrollView> diff --git a/android-app/app/src/main/res/layout/layout_nav_hud.xml b/android-app/app/src/main/res/layout/layout_nav_hud.xml index 4623bb1..90119fa 100644 --- a/android-app/app/src/main/res/layout/layout_nav_hud.xml +++ b/android-app/app/src/main/res/layout/layout_nav_hud.xml @@ -39,6 +39,7 @@ android:fontFamily="sans-serif-medium" tools:text="7.1" /> <TextView + android:id="@+id/unit_hud_sog" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="kt" @@ -110,6 +111,7 @@ android:fontFamily="sans-serif-medium" tools:text="6.8" /> <TextView + android:id="@+id/unit_hud_bsp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="kt" @@ -149,6 +151,7 @@ android:fontFamily="sans-serif-medium" tools:text="42.0" /> <TextView + android:id="@+id/unit_hud_depth" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="ft" |
