realm-android-adapters icon indicating copy to clipboard operation
realm-android-adapters copied to clipboard

Auto scroll to end postion

Open KingWu opened this issue 7 years ago • 7 comments

i load the result from realm and set realm-android-adapters. The recycler view always auto scroll to the end position.

is it default behaviour?

KingWu avatar Oct 13 '17 05:10 KingWu

I think it depends on the data changeset. the adapter's behaviour is basically the default behavior from RecyclerView.

You can overwrite those behavior if you want. See https://github.com/realm/realm-android-adapters/blob/master/adapters/src/main/java/io/realm/RealmRecyclerViewAdapter.java#L44

beeender avatar Oct 13 '17 05:10 beeender

Actually in my project I used RealmRecyclerViewAdapter with header view at first time I load data from WS and update into realm. The particular scenario the recycler view scroll to bottom.

Once the data is stored into realm then it is working correctly.

Can you please check and update us ASAP ?

jayarajm avatar Mar 06 '18 16:03 jayarajm

Hi @jayarajm Can you provide a sample project showing the behaviour?

cmelchior avatar Mar 21 '18 11:03 cmelchior

The RealmRecyclerViewAdapter is updated when data is updated in realm db. Now I want to scroll to the end of the list when RealmRecyclerViewAdapter is updated (notifyDataSetChanged() is called by OrderedRealmCollectionChangeListener internaly)

Edit Found a solution add addChangeListener to RealmResults<E>

Sp4Rx avatar Mar 24 '18 14:03 Sp4Rx

We're having a similar issue where we're adding an item to an empty list. In this case it looks like the adapter inserts and extra row above the other rows. This results in the user not being able to see the new item in the list since it's above the current viewport.

lam-amsiq avatar May 22 '18 09:05 lam-amsiq

@lam-amsiq do you know how to solve this problem? @jayarajmI have the same situation as you, had you solved it?

nickming avatar Sep 06 '18 03:09 nickming

but I found that if I add header view for the adapter when I notify item changes should add the count of header view for start position

nickming avatar Sep 06 '18 08:09 nickming