/** {@inheritDoc} */ @Override protected void onScrollChanged(int x, int y, int oldX, int oldY) { super.onScrollChanged(x, y, oldX, oldY); // Guard against framework issue where onScrollChanged() is called twice // for each touch-move event. This wreaked havoc on the tab-carousel: // the // view-pager moved twice as fast as it should because we called // fakeDragBy() // twice with the same value. if (mLastScrollPosition == x) { return; } // Since we never completely scroll the about/updates tabs off-screen, // the draggable range is less than the width of the carousel. Our // listeners don't care about this... if we scroll 75% percent of our // draggable range, they want to scroll 75% of the entire carousel // width, not the same number of pixels that we scrolled. final int scaledL = (int) (x * mScrollScaleFactor); final int oldScaledL = (int) (oldX * mScrollScaleFactor); mCarouselListener.onCarouselScrollChanged(scaledL, y, oldScaledL, oldY); mLastScrollPosition = x; updateAlphaLayers(); }