android / android/architecture-samples
dev-todo-mvvm-rxjava: Tasks list is not restoring scroll position on config changes
- Dominant language
- Kotlin
- Stars
- 45.8k
- Forks
- 11.9k
- PR merge metrics
- No merged PRs in 30d
Description
I guess this issue goes to @florina-muntenescu (who is the project owner).
I'm aware this branch is still under development, but I noticed this example is not handling restoring the scroll position properly on `TasksFragment`, instead, the scroll position gets reset to the top on orientation changes. I tested this by adding a lot of tasks to the list and then rotating my device.
I presume this is because the `TasksFragment.updateView()` method gets called after the layout pass of the activity and thus the `RecyclerView` does not know its correct size at rendering time.
It would be awesome if we are provided with a working example on how to restore the scroll position properly using MVVM and RxJava together.
Here is the link to [TasksFragment.](https://github.com/googlesamples/android-architecture/blob/dev-todo-mvvm-rxjava/todoapp/app/src/main/java/com/example/android/architecture/blueprints/todoapp/tasks/TasksFragment.java)
Thank you for your help.
Contributor guide
Research direction
Start with todoapp/app/src/main/java/com/example/android/architecture/blueprints/todoapp/tasks/TasksFragment.java, especially updateView(), and reproduce the issue by creating many tasks and rotating the device. Done means the Tasks list keeps its scroll position across configuration changes in the dev-todo-mvvm-rxjava example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100