Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I detect OnScrolled in RecycleView with RealmRecyclerViewAdapter? It won't call #167

Open
LeeSeungYongg opened this issue Jan 18, 2024 · 0 comments

Comments

@LeeSeungYongg
Copy link

LeeSeungYongg commented Jan 18, 2024

What do you want to achieve?

In RecycleView with Realm data, I need to detect the last item currently see through scrolling. So I added the listener so that RecycleView can check onScrolled.

Expected Results

Detecting onScrolled method

Actual Results

onScrolled is not called.. How do I detect OnScrolled in RecycleView with RealmRecyclerViewAdapter??

Code Sample

receivedAdapter = TestListAdapter(this@NotificationsActivity, receivedNotiRealmResults)
recyclerView.adapter = receivedAdapter
recyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() {
    override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
        super.onScrolled(recyclerView, dx, dy)
        //TODO: check. but is not called.
    }
})

class TestListAdapter(internal var activity: Activity, data: OrderedRealmCollection<TestNotification>)
    : RealmRecyclerViewAdapter<TestNotification, TestListAdapter.MyViewHolder>(data, true) {
    ....
    }

Version of Realm and tooling

Realm version(s): 10.16.1 and adapter is 4.0.0

Android Studio version: Giraffe 2022.3.1 Patch3

device: Android 12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant