Skip to content

login: preserve password visibility state on rotation - #6663

Merged
RitikaPahwa4444 merged 2 commits into
commons-app:mainfrom
Roniscend:fix-password-visibility-state
Feb 22, 2026
Merged

login: preserve password visibility state on rotation#6663
RitikaPahwa4444 merged 2 commits into
commons-app:mainfrom
Roniscend:fix-password-visibility-state

Conversation

@Roniscend

Copy link
Copy Markdown
Contributor

Description (required)
This PR resolves the issue where the password visibility toggle resets to its default state after a device rotation. It fixes this by explicitly saving and restoring the password field's transformationMethod in LoginActivity during configuration changes.
Fixes #6662

Tests performed (required)

Tested betaDebug on Pixel 9 with API level 36 (Android 16).

Screenshots (for UI changes only)
https://github.com/user-attachments/assets/6f7654c5-840d-4f38-bbda-f1872a63a506

Copilot AI review requested due to automatic review settings February 21, 2026 19:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes a login UX issue where the password visibility toggle state is lost after device rotation by persisting and restoring the password field’s visibility state in LoginActivity.

Changes:

  • Save password visibility state into outState during configuration changes.
  • Restore the password visibility (via transformationMethod) and cursor position in onRestoreInstanceState.
  • Add a new saved-state key constant for password visibility.

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

Comment thread app/src/main/java/fr/free/nrw/commons/auth/LoginActivity.kt Outdated
Saved the password visibility state in onSaveInstanceState and
restored it in onRestoreInstanceState to prevent the toggle
from resetting to default upon device rotation.

Signed-off-by: Owm Dubey <owmdubey163@gmail.com>
@Roniscend
Roniscend force-pushed the fix-password-visibility-state branch from 7ffcb72 to 97c0fdb Compare February 21, 2026 20:13
@github-actions

Copy link
Copy Markdown

✅ Generated APK variants!

@RitikaPahwa4444

Copy link
Copy Markdown
Collaborator

Observe that the password visibility behavior is inverted.

I thought we're fixing this as well, interesting observation 😄

@RitikaPahwa4444
RitikaPahwa4444 merged commit 43a9337 into commons-app:main Feb 22, 2026
2 checks passed
@Roniscend

Copy link
Copy Markdown
Contributor Author

Observe that the password visibility behavior is inverted.

I thought we're fixing this as well, interesting observation 😄

I'll create a Separate PR for that

@RitikaPahwa4444

Copy link
Copy Markdown
Collaborator

Thanks!

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.

[Bug]: Password visibility toggle behaves incorrectly and resets on rotation

3 participants