Improve lifecycle management, compass reliability, and accessibility

- Use repeatOnLifecycle(STARTED) for location updates so GPS stops
  when Activity is paused (battery conservation)
- Pair enableMyLocation/disableMyLocation with onResume/onPause
- Add low-pass filter for accelerometer+magnetometer compass fallback
  to reduce arrow jitter
- Detect missing compass sensors and show warning instead of frozen
  arrow
- Monitor compass accuracy via onAccuracyChanged and indicate
  degraded readings
- Show permission rationale dialog using existing i18n strings
- Guide user to Settings when location permission is permanently
  denied
- Check cacheMapArea return value and show banner on failure
- Add error handling around shelter Flow and location Flow collection
- Add contentDescription to direction arrow views for screen readers
- Use safe casts for system services (as? instead of as)
- Use explicit dark theme parent (Theme.Material3.Dark.NoActionBar)
  instead of DayNight with hardcoded dark colors
- Add error_no_compass and direction_arrow_description strings in
  en/nb/nn

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Ole-Morten Duesund 2026-03-08 17:54:06 +01:00
commit 55761718e1
5 changed files with 186 additions and 57 deletions

View file

@ -40,6 +40,10 @@
<!-- Errors -->
<string name="error_download_failed">Could not download shelter data. Check your internet connection.</string>
<string name="error_no_data_offline">No cached data available. Connect to the internet to download shelter data.</string>
<string name="error_no_compass">Compass not available on this device</string>
<string name="update_success">Shelter data updated</string>
<string name="update_failed">Update failed — using cached data</string>
<!-- Accessibility -->
<string name="direction_arrow_description">Direction to shelter, %s away</string>
</resources>