Resolve unresponsiveness and state loss on Place type screen rotation#6685
Resolve unresponsiveness and state loss on Place type screen rotation#6685Roniscend wants to merge 1 commit intocommons-app:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Addresses issue #6676 by attempting to preserve “Place type” filter UI state across configuration changes, preventing unresponsiveness/state loss after rotation.
Changes:
- Track filter UI state (list visibility, query text, focus) in fragment fields.
- Persist and restore that state via
onSaveInstanceState()/onViewStateRestored(). - Re-apply saved UI state during filter initialization.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
app/src/main/java/fr/free/nrw/commons/nearby/fragments/NearbyParentFragment.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/fr/free/nrw/commons/nearby/fragments/NearbyParentFragment.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/fr/free/nrw/commons/nearby/fragments/NearbyParentFragment.kt
Outdated
Show resolved
Hide resolved
| * Restores the Place type filter UI state from the provided Bundle. | ||
| * This is called after configuration changes to restore the state. | ||
| */ | ||
| override fun onViewStateRestored(savedInstanceState: Bundle?) { |
There was a problem hiding this comment.
How about instead of onViewStateRestored? and get it from viewmodel and make it a single source of truth?
There was a problem hiding this comment.
Do we have view models here?
There was a problem hiding this comment.
I wasn’t aware that introducing ViewModels was allowed, as it hadn’t been discussed earlier. I was strictly following the existing MVP architecture used in the project.
There was a problem hiding this comment.
We'll be moving to MVVM soon, but I'm not expecting big migrations in the PRs. If it's a small change, please feel free to implement it. Please check the pinned issue on configuration changes for related discussions, thanks! :)
There was a problem hiding this comment.
Sure I'll update my implementation then
|
✅ Generated APK variants! |
|
@neeldoshii please can you re review this pr |
neeldoshii
left a comment
There was a problem hiding this comment.
Hi @Roniscend ,
I am unable to reproduce the issue on main, can you help me to reproduce?
Thanks
Main branch
XRecorder_20260312_01.mp4
|
Hi @Roniscend. just checking in do we have any updates on steps to reproduce? |
Description (required)
Handled configuration changes to prevent UI freezing and ensure state retention in the Place type selector
Fixes #6676
Tested 6.3.0-debug on Pixel 9 (Android 16[API 36])