realm / realm-android-adapters

Adapters for combining Realm Java with Android UI components and framework classes
realm.io
Apache License 2.0
414 stars 134 forks source link

Auto scroll to end postion #130

Open KingWu opened 7 years ago

KingWu commented 7 years ago

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?

beeender commented 7 years ago

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

jayarajm commented 6 years ago

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 ?

cmelchior commented 6 years ago

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

Sp4Rx commented 6 years ago

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>

lam-amsiq commented 6 years ago

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.

nickming commented 6 years ago

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

nickming commented 6 years ago

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