Skip to content

Conversation

@314systems
Copy link
Contributor

Summary

  • Fix navigation drawer highlighting incorrect menu item after language/theme change
  • NavigationView's auto state restoration was conflicting with app's state management

What does this implement/fix?

  • Disables NavigationView's automatic state saving/restoration by adding android:saveEnabled="false"
  • Scope: Single line change in app/src/main/res/layout/main_activity.xml
  • Root cause: NavigationView was restoring its checked state (e.g., SETTINGS) in onRestoreInstanceState, overwriting the correct state set in onCreate from SharedPreferences

Before: Change language in Settings → Activity recreates → Shows AccessPoints screen but drawer highlights Settings
After: Change language in Settings → Activity recreates → Shows AccessPoints screen and drawer correctly highlights AccessPoints

How was this tested?

  • Devices / OS (e.g. Android 13 emulator, Pixel 6): Android 16 emulator
  • Steps to reproduce:
    1. Open app, note current screen (e.g., Access Points)
    2. Open drawer → tap Settings
    3. Change Language to different value
    4. App recreates → verify drawer highlights Access Points (not Settings)

Checklist (required before marking ready)

  • I added or updated unit tests (see app/src/test/)
  • I followed the project's coding style (ktlint) and formatting
  • I ran lint and addressed or documented any warnings
  • CI checks pass (unit tests, coverage, lint)
  • No sensitive data, keys, or secrets are included

Copilot AI review requested due to automatic review settings December 30, 2025 08:12
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a UI state management bug where the navigation drawer highlights the wrong menu item after the activity is recreated due to language or theme changes. The fix disables NavigationView's automatic state saving/restoration mechanism, allowing the app's manual state management through SharedPreferences to work correctly.

  • Adds android:saveEnabled="false" to NavigationView to prevent automatic state restoration conflicts
  • Resolves incorrect menu highlighting after activity recreation from configuration changes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Dec 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.67%. Comparing base (5a0722f) to head (ce98511).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main     #580   +/-   ##
=========================================
  Coverage     97.67%   97.67%           
  Complexity      975      975           
=========================================
  Files           121      121           
  Lines          2579     2579           
  Branches        211      211           
=========================================
  Hits           2519     2519           
  Misses           21       21           
  Partials         39       39           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@VREMSoftwareDevelopment VREMSoftwareDevelopment merged commit 78b6a81 into VREMSoftwareDevelopment:main Dec 31, 2025
16 checks passed
@VREMSoftwareDevelopment
Copy link
Owner

Thank you for your contribution

@314systems 314systems deleted the nav-drawer branch December 31, 2025 22:25
314systems added a commit to 314systems/WiFiAnalyzer that referenced this pull request Dec 31, 2025
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.

2 participants