element-hq / element-android

A Matrix collaboration client for Android.
https://element.io/
GNU Affero General Public License v3.0
3.39k stars 735 forks source link

Save scroll position #2735

Open xster opened 3 years ago

xster commented 3 years ago

Describe the bug After the chat activity dies, the scroll position isn't saved on relaunch

To Reproduce Steps to reproduce the behavior:

  1. Open some popular chat channel like wallstreetbets
  2. Scroll up for a while so you're not at the latest message
  3. Leave the app for a bit or turn on don't save activities in developer options
  4. Come back to the app
  5. Observe that the chat is scrolled back to the bottom again

Expected behavior Would be nice to keep the previous scroll position if you're trying to read things sequentially from a position and want to keep reading after taking a break.

Smartphone (please complete the following information):

Additional context

Add any other context about the problem here.

xster commented 3 years ago

Don't know if https://github.com/vector-im/element-android/blob/develop/vector/src/main/java/im/vector/app/core/epoxy/LayoutManagerStateRestorer.kt is it. There might be some race going on.

xster commented 3 years ago

oh it's probably not the local layout manager since it's paginated. Don't know if the remote page and the local scroll are both saved.

bagvand commented 1 year ago

Hi, This problem occurred after the following change https://github.com/vector-im/element-android/pull/7734

polyzen commented 1 year ago

Not sure if this is the same issue, but opening links from Element results in the chat being scrolled to the bottom once I've returned.

Edit: This seems to occur when very low on RAM.