Skip to content

Refactor settings UI, harden receiver, add tests/CI, i18n and a11y fixes - #98

Merged
LeanBitLab merged 14 commits into
mainfrom
chore/improvements
Nov 14, 2026
Merged

LeanBitLab merged 14 commits into
mainfrom
chore/improvements

Conversation

@LeanBitLab

@LeanBitLab LeanBitLab commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Refactor: MainActivity.kt split from 2,404 to 448 lines; section code moved verbatim into Settings*.kt extension files (only private -> internal on shared members).
  • Reliability: AwidgetProvider broadcast work now shares one runAsync() helper that always releases goAsync() within 8s; String.format calls use an explicit locale.
  • i18n: 28 hardcoded English strings (weather dialogs, snackbars, widget picker, permission labels, notification text) moved to strings.xml with translations for all 11 locales (translations need native review). Duplicate "Important Step" dialog is now one function.
  • Accessibility: decorative setup icons hidden from screen readers; reorder list gains TalkBack "Move up / Move down" actions.
  • UI/perf: settings column capped at 640dp on wide screens; slider-driven widget updates debounced (120 ms trailing); light haptic on user-initiated switch toggles.
  • Tests/CI: Robolectric smoke tests for MainActivity, plus tests for FallbackPreferences, ReorderAdapter (incl. accessibility actions), update-alarm scheduling, content-width inset and update debounce. New ci.yml (strings check, unit tests, lint, debug build) on push to main and PRs; lint now fails on errors only (0 currently; release/F-Droid builds still skip lint). scripts/check_strings.py verifies all locales match the base strings and placeholders.
  • Cleanup: removed unused ALARM_LISTENER permission (not a standard permission, unreferenced; next-alarm uses AlarmManager.nextAlarmClock, which needs none), unused gradle/libs.versions.toml, and duplicate docs/images/1-8.png (README now points at the fastlane screenshots). No permissions were added.

Notes

  • README screenshots load from main, so they appear after merge.
  • Not included: AGP/Kotlin upgrade (needs network-enabled verification) and restructuring the widget's own RemoteViews layouts (lint warnings there left as-is to avoid unverified visual changes).

Test plan

  • ./gradlew --offline test passes
  • ./gradlew lintDebug passes (0 errors)
  • ./gradlew assembleRelease (R8 minified) builds
  • Debug build installed and launched on device (no crash in log)
  • Manually walk through the settings screen on a device (tabs, sliders, reorder, weather/permission dialogs)
  • CI workflow runs green on this PR

LeanBitLab added 14 commits November 15, 2026 00:25
The docs/images/1-8.png files were byte-identical to the fastlane
phoneScreenshots. Banners and badges in docs/images are kept.
scripts/check_strings.py compares every locale against values/strings.xml
for missing/extra keys and format placeholder mismatches.
Lint currently reports 0 errors (271 warnings). abortOnError=true guards
against new errors; checkReleaseBuilds stays false so release and F-Droid
builds are unaffected.
Launches the settings screen under Robolectric (launch, first-launch
redirect, recreate). Enables Android resources for unit tests and pins
Robolectric to SDK 34 (max supported by 4.11.1). Guards onResume when
onCreate returns early before prefs is initialized.
MainActivity.kt: 2404 -> 448 lines. Function bodies moved verbatim into
Settings*.kt as MainActivity extension functions (binders, permissions,
accordion, reorder, display/system/events sections, appearance, search)
and ReorderAdapter.kt. Only visibility changed (private -> internal on
shared members). Verified with smoke tests, lint and a minified release build.
…xplicit

AwidgetProvider: the three goAsync() blocks now share runAsync(), which
always releases the broadcast within 8s even if a data source hangs
(finish() guarded to run once). SystemStatsFetcher: String.format now
passes Locale.getDefault() explicitly (same behavior, resolves lint).
gradle/libs.versions.toml was not referenced by any build script
(dependencies are declared in app/build.gradle.kts).
Not a standard Android permission and not referenced in code. The next
alarm feature uses AlarmManager.getNextAlarmClock() and the
ACTION_NEXT_ALARM_CLOCK_CHANGED broadcast, neither of which needs a permission.
… dialog

28 strings (weather dialogs, snackbars, widget picker, permission 'Granted'
labels, notification text) were hardcoded in English; they now live in
strings.xml with translations for all 11 locales. Permission labels reuse
existing section_* strings. The duplicated 'Important Step' dialog is now
a single showWeatherSetupHint(). Translations should be native-reviewed.
…rder list

Decorative icons next to text labels are marked importantForAccessibility=no.
Reorder rows gain TalkBack 'Move up/Move down' actions (previously touch-drag
only), sharing the same persistence path as drag. Strings for 11 locales.
Centers the settings column (max 640dp) by widening the scroll view's side
padding on wide screens; phones are unaffected. Pure inset function is unit
tested, plus a wide-screen smoke test.
Dragging a slider ran updateWidget() (preview rebuild, FAB animation, widget
broadcast) on every tick. Slider listeners now use scheduleWidgetUpdate(), a
120ms trailing debounce cancelled in onDestroy; discrete actions are unchanged.
User-initiated switch toggles give a light CLOCK_TICK haptic.
@LeanBitLab
LeanBitLab merged commit f4fd26a into main Nov 14, 2026
1 check passed
@LeanBitLab
LeanBitLab deleted the chore/improvements branch November 14, 2026 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant