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

can not use vpbs in project with androidx #35

Open
moradi-morteza opened this issue Apr 4, 2020 · 3 comments
Open

can not use vpbs in project with androidx #35

moradi-morteza opened this issue Apr 4, 2020 · 3 comments

Comments

@moradi-morteza
Copy link

hello
i have a project with androidx
and i add vpbs module in my project
but in class ViewPagerUtils
layoutParams.position (position is private in viewpager in androidx)
so i have an error and can not use vbps
now how i should do?
thanks

@BackPackerDz
Copy link

BackPackerDz commented May 19, 2020

Hi, did you find a solution?

@svrlopatrik
Copy link

Check forked repo https://github.com/svrlopatrik/ViewPagerBottomSheet

@nolanamy
Copy link

nolanamy commented Sep 4, 2020

Try this:

// ViewPagerBottomSheetBehavior.kt

// must be in the same package as BottomSheetBehavior
package com.google.android.material.bottomsheet

import android.content.Context
import android.util.AttributeSet
import android.view.View
import androidx.coordinatorlayout.widget.CoordinatorLayout
import java.lang.ref.WeakReference

class ViewPagerBottomSheetBehavior<V : View>(context: Context, attrs: AttributeSet?) : BottomSheetBehavior<V>(context, attrs) {

    override fun onStartNestedScroll(coordinatorLayout: CoordinatorLayout, child: V, directTargetChild: View, target: View, axes: Int, type: Int): Boolean {
        nestedScrollingChildRef = WeakReference(target)
        return super.onStartNestedScroll(coordinatorLayout, child, directTargetChild, target, axes, type)
    }
}

https://gist.github.com/nolanamy/9fc31c3056e561fa22d6e3ef71630870

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

4 participants