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

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.Tilfluktsrom" parent="Theme.Material3.DayNight.NoActionBar">
<style name="Theme.Tilfluktsrom" parent="Theme.Material3.Dark.NoActionBar">
<item name="colorPrimary">@color/shelter_primary</item>
<item name="colorPrimaryDark">@color/shelter_primary_dark</item>
<item name="colorAccent">@color/shelter_accent</item>