Skip to content

[BUG]: Profile colors and positions change when selecting a profile in the Profile screen #5959

@subhajitxyz

Description

@subhajitxyz

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:

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

Impact: LowLow perceived user impact (e.g. edge cases).Work: MediumThe means to find the solution is clear, but it isn't at good-first-issue level yet.bugEnd user-perceivable behaviors which are not desirable.

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions