@@ -0,0 +1,2413 @@
+package org.ccci.gto.android.common.support.v4.widget;%0A%0Aimport android.content.Context;%0Aimport android.support.v4.view.ViewPager;%0Aimport android.util.AttributeSet;%0Aimport android.view.View;%0A%0A/**%0A * Based on HeightWrappingViewPager.%0A *%0A * @see %3Ca href=%22http://stackoverflow.com/a/14983747/4721910%22%3Ehttp://stackoverflow.com/a/14983747/4721910%3C/a%3E%0A */%0Apublic class ChildHeightAwareViewPager extends ViewPager %7B%0A    public ChildHeightAwareViewPager(final Context context) %7B%0A        super(context);%0A    %7D%0A%0A    public ChildHeightAwareViewPager(final Context context, final AttributeSet attrs) %7B%0A        super(context, attrs);%0A    %7D%0A%0A    @Override%0A    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) %7B%0A        super.onMeasure(widthMeasureSpec, heightMeasureSpec);%0A%0A        // check child height if we don't have an exact height%0A        final int heightMode = MeasureSpec.getMode(heightMeasureSpec);%0A        if (heightMode != MeasureSpec.EXACTLY) %7B%0A            /**%0A             * The first super.onMeasure call made the pager take up all the available height. Since we really wanted%0A             * to dynamically wrap it, we need to remeasure it. Luckily, after that call the first child is now%0A             * available. So, we take the height from it.%0A             */%0A%0A            // If the pager actually has any children, calculate the children height and use the largest as our height%0A            int height = getMeasuredHeight();%0A            final int count = getChildCount();%0A            if (count %3E 0) %7B%0A                // simplify the calculations by using exactly the previous measured width%0A                widthMeasureSpec = MeasureSpec.makeMeasureSpec(getMeasuredWidth(), MeasureSpec.EXACTLY);%0A%0A                // measure the children%0A                measureChildren(widthMeasureSpec, heightMeasureSpec);%0A%0A                // calculate the max height for all the (current) children%0A                final int paddingVertical = getPaddingTop() + getPaddingBottom();%0A                for (int i = 0; i %3C count; i++) %7B%0A                    final View child = getChildAt(0);%0A                    height = Math.max(height, child.getMeasuredHeight() + paddingVertical);%0A                %7D%0A%0A                // re-measure ViewPager using the calculated height%0A                super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY));%0A            %7D%0A        %7D%0A    %7D%0A%7D%0A

create a ViewPager that will observe height requirements of children