@@ -0,0 +1,1776 @@
+package org.ccci.gto.android.common.support.v4.widget;%0A%0Aimport android.support.annotation.NonNull;%0Aimport android.support.v4.view.ViewPager;%0Aimport android.view.View;%0Aimport android.widget.HorizontalScrollView;%0A%0A/**%0A * Link a HorizontalScrollView to a ViewPager to create a Parallax effect. Logic based off of%0A * http://stackoverflow.com/a/38543133%0A */%0Apublic class ParallaxScrollListener extends ViewPager.SimpleOnPageChangeListener %7B%0A    @NonNull%0A    private final ViewPager mPager;%0A    @NonNull%0A    private final HorizontalScrollView mParallax;%0A%0A    public ParallaxScrollListener(@NonNull final ViewPager pager,%0A                                  @NonNull final HorizontalScrollView parallaxContainer) %7B%0A        mPager = pager;%0A        mParallax = parallaxContainer;%0A    %7D%0A%0A    @Override%0A    public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) %7B%0A        int x = (int) ((getPageWidth() * position + positionOffsetPixels) * computeFactor());%0A        mParallax.scrollTo(x, 0);%0A    %7D%0A%0A    private int getPageWidth() %7B%0A        return mPager.getWidth() - mPager.getPaddingLeft() - mPager.getPaddingRight() + mPager.getPageMargin();%0A    %7D%0A%0A    private int getScrollRange() %7B%0A        int scrollRange = 0;%0A        if (mParallax.getChildCount() %3E 0) %7B%0A            final View child = mParallax.getChildAt(0);%0A            scrollRange = Math.max(0, child.getWidth() -%0A                    (mParallax.getWidth() - mParallax.getPaddingLeft() - mParallax.getPaddingRight()));%0A        %7D%0A        return scrollRange;%0A    %7D%0A%0A    private float computeFactor() %7B%0A        final int pages = mPager.getAdapter().getCount();%0A        if (pages %3E 1) %7B%0A            return getScrollRange() / (float) (getPageWidth() * (pages - 1));%0A        %7D%0A        return 0;%0A    %7D%0A%7D%0A

create a ParallaxScrollListener to link a HorizontalScrollView to a ViewPager