-
Notifications
You must be signed in to change notification settings - Fork 614
Description
Describe the bug
When selecting a profile from the "Select your profile" screen, the profile list slightly shifts and some profile colors change unexpectedly.
Steps To Reproduce
- Open the Oppia app.
- Go to the "Select your profile" screen.
- Set up multiple profiles (more than 5).
- Scroll down and click on any profile near the bottom of the list.
- Observe that the profiles slightly shift from their original position and profile colors change.
Expected Behavior
Profile positions and colors should remain consistent when selecting a profile.
Screenshots/Videos
InShot_20250909_141401577.mp4
What device/emulator are you using?
Oppo reno 2f
Which Android version is your device/emulator running?
Android 11
Which version of the Oppia Android app are you using?
No response
Additional Context
Cause:
When a profile is clicked, onProfileClick() updates the learner ID if it is absent. This causes the LiveData holding the profile list to emit a new list. Since the current adapter uses notifyDataSetChanged(), the entire RecyclerView reloads all items. As a result, the list briefly shows flickering, incorrect colors, and temporary item shifts.
Proposed Solution:
Introduce DiffUtilin RecyclerViewBindingAdapter for the profile_recycler_view. Since each profile has a unique id, we can use it to efficiently calculate differences and update only the changed items. This will eliminate flickering and keep profile colors stable during list updates.
Files to Check:
- ProfileChooserFragmentPresenter -> funs
onProfileClick(),updateLearnerIdIfAbsent(),computeLoginRoute() - ProfilemanagementController -> funs
initializeLearnerId() - ProfileChooserViewModel -> fun
retrieveProfiles() - RecyclerViewBindingAdapter
- BindableAdapter
Personal Note:
I personally tried using DiffUtil for the profile_recycler_view, and it solved the problem. After applying it, the list updates smoothly without shifts or temporary wrong colors.
Output:
Record_2025-09-13-10-15-42_943a62cb4c6fb83e010e1c2e82766a17.mp4
Metadata
Metadata
Assignees
Labels
Type
Projects
Status