Skip to content

Fix overlay edge position restore#852

Open
vibhor1102 wants to merge 1 commit into
Nain57:masterfrom
vibhor1102:codex/fix-overlay-edge-position
Open

Fix overlay edge position restore#852
vibhor1102 wants to merge 1 commit into
Nain57:masterfrom
vibhor1102:codex/fix-overlay-edge-position

Conversation

@vibhor1102
Copy link
Copy Markdown

Summary

Fixes #851.

This PR fixes overlay menu position restore for valid edge coordinates. A saved position with x = 0, y = 0, or both should mean "the user placed the overlay on the screen edge", not "there is no saved position".

Root Cause

SharedPreferences.getInt(..., 0) used 0 both as the missing-value fallback and as a valid coordinate. The restore code then treated 0 as invalid, so edge placements could fall back to first-run centering.

Changes

  • Use SharedPreferences.contains(...) to distinguish missing keys from saved zero coordinates.
  • Preserve first-run centering when no saved position exists.
  • Add unit coverage for saved (0, y), (x, 0), (0, 0), and missing preferences.

Validation

  • ./gradlew.bat --no-daemon --max-workers=3 --console=plain :core:common:overlays:testFDroidDebugUnitTest

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.

Overlay menu edge positions can restore as centered

1 participant