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

Public RecyclerViewOverScrollDecorAdapter.Impl class #84

Open
hushenghao opened this issue Sep 20, 2023 · 0 comments
Open

Public RecyclerViewOverScrollDecorAdapter.Impl class #84

hushenghao opened this issue Sep 20, 2023 · 0 comments

Comments

@hushenghao
Copy link

hushenghao commented Sep 20, 2023

Used to support custom LayoutManager.

Such as: CarouselLayoutManager, this is material3 built-in LayoutManager, it extends from RecyclerView.LayoutManager

At present only through broken encapsulation methods to access RecyclerViewOverScrollDecorAdapter.Impl

package me.everything.android.ui.overscroll.adapters // same package name

import androidx.recyclerview.widget.RecyclerView

/**
 * CarouselLayoutManager over scroll.
 */
class CarouselOverScrollAdapter(recyclerView: RecyclerView) :
    RecyclerViewOverScrollDecorAdapter(recyclerView, CarouselImpl(recyclerView))

private class CarouselImpl(private val recyclerView: RecyclerView) :
    RecyclerViewOverScrollDecorAdapter.Impl {
    override fun isInAbsoluteStart(): Boolean {
        return !recyclerView.canScrollHorizontally(-1)
    }

    override fun isInAbsoluteEnd(): Boolean {
        return !recyclerView.canScrollHorizontally(1)
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant