forked from oppia/oppia-android
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix oppia#5615 : Scroll Position For Policies Screen On Orientation C…
…hange (oppia#5616) ## Explanation This PR fixes oppia#5615 the issue where the scroll position in the policies screen (Privacy Policy/Terms of Service) would reset after an orientation change. ### **Changes Made:** 1. **Updated `PoliciesFragmentPresenter`:** - Added a `scrollPosition` property to save and restore the scroll state. - Implemented `onSaveInstanceState` and `onRestoreInstanceState` handling using a constant key. - Ensured the scroll position is retained using `ScrollView.viewTreeObserver` in `onGlobalLayoutListener`. 2. **Modified `PoliciesFragment`:** - Delegated `onSaveInstanceState` calls to the presenter. - Passed the saved instance state to the presenter during fragment view creation. ### **Testing Performed:** - Verified that scroll position is correctly retained: - Across orientation changes (portrait↔️ landscape). - On both Privacy Policy and Terms of Service screens --- ## Essential Checklist - [x] The PR title and explanation each start with "Fix #bugnum: ". - [x] No unnecessary code changes or Android Studio formatting changes are included. - [x] The branch is **not** called "develop" and is up-to-date with "develop". - [x] Appropriate reviewers are assigned. --- After Changes : [Screen_recording_20241223_010758.webm](https://github.com/user-attachments/assets/f9648b03-5b27-4090-9eaa-82946214cd62) --------- Co-authored-by: Adhiambo Peres <[email protected]>
- Loading branch information
1 parent
68f20cb
commit 8ce374b
Showing
4 changed files
with
66 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters