ViewPagerBottomSheet icon indicating copy to clipboard operation
ViewPagerBottomSheet copied to clipboard

can not use vpbs in project with androidx

Open moradi-morteza opened this issue 5 years ago • 3 comments

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

moradi-morteza avatar Apr 04 '20 13:04 moradi-morteza

Hi, did you find a solution?

BackPackerDz avatar May 19 '20 18:05 BackPackerDz

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

svrlopatrik avatar Jul 03 '20 14:07 svrlopatrik

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

nolanamy avatar Sep 04 '20 10:09 nolanamy