Skip to content

Conversation

@Kota-Jagadeesh
Copy link
Collaborator

Description (required)

What changes did you make and why?

  1. Implemented State Restoration in SearchActivity: added tha onSaveInstanceState to track the current media position and updated onCreate to restore the media detail view if a position was previously saved. This replaces the previous temporary fix in onResume which forced a back-press on rotation.
  2. Synchronized MediaDetailPagerFragment: Updated the fragment to save and restore its internal ViewPager current item index.
  3. Improved UX & Navigation: By using binding.root.post for restoration, I ensured the UI is fully laid out before re-opening details, preventing crashes and ensuring the user stays on the same image they were viewing before rotating the device.
  4. Cleaned up Fragment Stack: Removed the onBackPressed() call from onResume() which was an anti-pattern causing the fragment back-stack to increase incorrectly.

Tests performed (required)

Tested ProdDebug on Redmi Note 13 Pro with API level 35.

  • Verified that rotating from Portrait to Landscape while viewing an image detail does not return the user to the search results list.
  • Verified that the Back button correctly returns the user to the search results after a rotation occurs.
  • Verified that isFeaturedImage and editable flags are preserved after rotation, keeping menu items consistent.

@github-actions
Copy link

github-actions bot commented Jan 5, 2026

✅ Generated APK variants!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant