@SuppressWarnings("unchecked")
    public static <V extends View> ViewPagerBottomSheetBehavior<V> from(V view) {
        ViewGroup.LayoutParams params = view.getLayoutParams();
        if (!(params instanceof CoordinatorLayout.LayoutParams)) {
            throw new IllegalArgumentException("The view is not a child of CoordinatorLayout");
        }
        CoordinatorLayout.Behavior behavior = ((CoordinatorLayout.LayoutParams) params)
                .getBehavior();
        if (!(behavior instanceof ViewPagerBottomSheetBehavior)) {
            throw new IllegalArgumentException(
                    "The view is not associated with ViewPagerBottomSheetBehavior");
        }
        return (ViewPagerBottomSheetBehavior<V>) behavior;
    }
A utility function to get the {@link ViewPagerBottomSheetBehavior} associated with the {@code view}.

@param view The {@link View} with {@link ViewPagerBottomSheetBehavior}.
@return The {@link ViewPagerBottomSheetBehavior} associated with the {@code view}.
vpbs/src/main/java/biz/laenger/android/vpbs/ViewPagerBottomSheetBehavior.java