/*
 * Copyright 2012 GitHub Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.github.mobile.ui;

import static android.os.Build.VERSION.SDK_INT;
import static android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;

/**
 * {@link ViewPager} extension with support for horizontally scrolling an
 * embedded {@link WebView}
 */
public class ViewPager extends android.support.v4.view.ViewPager {

    /**
     * @param context
     */
    public ViewPager(final Context context) {
        super(context);
    }

    /**
     * @param context
     * @param attrs
     */
    public ViewPager(final Context context, final AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    protected boolean canScroll(final View v, final boolean checkV,
            final int dx, final int x, final int y) {
        if (SDK_INT < ICE_CREAM_SANDWICH && v instanceof WebView)
            return ((WebView) v).canScrollHorizontally(-dx);
        else
            return super.canScroll(v, checkV, dx, x, y);
    }
}

@@ -1279,24 +1279,1457 @@
 rs);%0A    %7D%0A%0A
+    /**%0A     * Set current item and return whether the item changed%0A     * %3Cp%3E%0A     * This method does not call %7B@link #setCurrentItem(int)%7D unless the item%0A     * parameter differs from the current item%0A     *%0A     * @param item%0A     * @return true if set, false if same%0A     */%0A    public boolean setItem(final int item) %7B%0A        final boolean changed = item != getCurrentItem();%0A        if (changed)%0A            setCurrentItem(item);%0A        return changed;%0A    %7D%0A%0A    /**%0A     * Set current item, invoke the listener if changes, and return whether the%0A     * item changed%0A     * %3Cp%3E%0A     * This method does not call %7B@link #setCurrentItem(int)%7D unless the item%0A     * parameter differs from the current item%0A     *%0A     * @param item%0A     * @param listener%0A     * @return true if set, false if same%0A     */%0A    public boolean setItem(final int item, final OnPageChangeListener listener) %7B%0A        final boolean changed = setItem(item);%0A        if (changed)%0A            listener.onPageSelected(item);%0A        return changed;%0A    %7D%0A%0A    /**%0A     * Schedule a call to %7B@link #setItem(int)%7D to occur on the UI-thread%0A     *%0A     * @param item%0A     * @param listener%0A     */%0A    public void scheduleSetItem(final int item,%0A            final OnPageChangeListener listener) %7B%0A        post(new Runnable() %7B%0A%0A            @Override%0A            public void run() %7B%0A                setItem(item, listener);%0A            %7D%0A        %7D);%0A    %7D%0A%0A
     @Overrid

Add helpers to set and schedule item updates