Java Code Examples for android.widget.Scroller

The following examples show how to use android.widget.Scroller. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: BookReader   Source File: BaseReadView.java    License: Apache License 2.0 6 votes vote down vote up
public BaseReadView(Context context, String bookId, List<BookMixAToc.mixToc.Chapters> chaptersList,
                    OnReadStateChangeListener listener) {
    super(context);
    this.listener = listener;
    this.bookId = bookId;

    mScreenWidth = ScreenUtils.getScreenWidth();
    mScreenHeight = ScreenUtils.getScreenHeight();

    mCurPageBitmap = Bitmap.createBitmap(mScreenWidth, mScreenHeight, Bitmap.Config.ARGB_8888);
    mNextPageBitmap = Bitmap.createBitmap(mScreenWidth, mScreenHeight, Bitmap.Config.ARGB_8888);
    mCurrentPageCanvas = new Canvas(mCurPageBitmap);
    mNextPageCanvas = new Canvas(mNextPageBitmap);

    mScroller = new Scroller(getContext());


    pagefactory = new PageFactory(getContext(), bookId, chaptersList);
    pagefactory.setOnReadStateChangeListener(listener);
}
 
Example 2
Source Project: nono-android   Source File: PageWidget.java    License: GNU General Public License v3.0 6 votes vote down vote up
public PageWidget(Context context) {
	super(context);

	// TODO Auto-generated constructor stub
	mPath0 = new Path();
	mPath1 = new Path();
	createDrawable();

	mPaint = new Paint();
	mPaint.setStyle(Paint.Style.FILL);

	ColorMatrix cm = new ColorMatrix();
	float array[] = { 0.55f, 0, 0, 0, 80.0f, 0, 0.55f, 0, 0, 80.0f, 0, 0,
			0.55f, 0, 80.0f, 0, 0, 0, 0.2f, 0 };
	cm.set(array);
	mColorMatrixFilter = new ColorMatrixColorFilter(cm);
	mMatrix = new Matrix();
	mScroller = new Scroller(getContext());

	mTouch.x = 0.01f;
	mTouch.y = 0.01f;
}
 
Example 3
Source Project: GridPagerSnapHelper   Source File: SnapHelper.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Attaches the {@link android.support.v7.widget.SnapHelper} to the provided RecyclerView, by calling
 * {@link RecyclerView#setOnFlingListener(RecyclerView.OnFlingListener)}.
 * You can call this method with {@code null} to detach it from the current RecyclerView.
 *
 * @param recyclerView The RecyclerView instance to which you want to add this helper or
 *                     {@code null} if you want to remove SnapHelper from the current
 *                     RecyclerView.
 * @throws IllegalArgumentException if there is already a {@link RecyclerView.OnFlingListener}
 *                                  attached to the provided {@link RecyclerView}.
 */
public void attachToRecyclerView(@Nullable RecyclerView recyclerView)
        throws IllegalStateException {
    if (mRecyclerView == recyclerView) {
        return; // nothing to do
    }
    if (mRecyclerView != null) {
        destroyCallbacks();
    }
    mRecyclerView = recyclerView;
    if (mRecyclerView != null) {
        setupCallbacks();
        mGravityScroller = new Scroller(mRecyclerView.getContext(),
                new DecelerateInterpolator());
        snapToTargetExistingView();
    }
}
 
Example 4
Source Project: Dashchan   Source File: ViewDragHelper.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Apps should use ViewDragHelper.create() to get a new instance.
 * This will allow VDH to use internal compatibility implementations for different
 * platform versions.
 *
 * @param context Context to initialize config-dependent params from
 * @param forParent Parent view to monitor
 */
private ViewDragHelper(Context context, ViewGroup forParent, Callback cb) {
	if (forParent == null) {
		throw new IllegalArgumentException("Parent view may not be null");
	}
	if (cb == null) {
		throw new IllegalArgumentException("Callback may not be null");
	}

	mParentView = forParent;
	mCallback = cb;

	final ViewConfiguration vc = ViewConfiguration.get(context);
	final float density = context.getResources().getDisplayMetrics().density;
	mEdgeSize = (int) (EDGE_SIZE * density + 0.5f);

	mTouchSlop = vc.getScaledTouchSlop();
	mMaxVelocity = vc.getScaledMaximumFlingVelocity();
	mMinVelocity = vc.getScaledMinimumFlingVelocity();
	mScroller = new Scroller(context, sInterpolator);
}
 
Example 5
Source Project: AndroidAnimationExercise   Source File: FlipView.java    License: Apache License 2.0 6 votes vote down vote up
private void init() {
    final Context context = getContext();
    final ViewConfiguration configuration = ViewConfiguration.get(context);

    mScroller = new Scroller(context, flipInterpolator);
    mTouchSlop = configuration.getScaledPagingTouchSlop();
    mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();

    mShadowPaint.setColor(Color.BLACK);
    mShadowPaint.setStyle(Style.FILL);
    mShadePaint.setColor(Color.BLACK);
    mShadePaint.setStyle(Style.FILL);
    mShinePaint.setColor(Color.WHITE);
    mShinePaint.setStyle(Style.FILL);
}
 
Example 6
Source Project: NewXmPluginSDK   Source File: NumberPicker.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Move to the final position of a scroller. Ensures to force finish the scroller
 * and if it is not at its final position a scroll of the selector wheel is
 * performed to fast forward to the final position.
 *
 * @param scroller The scroller to whose final position to get.
 * @return True of the a move was performed, i.e. the scroller was not in final position.
 */
private boolean moveToFinalScrollerPosition(Scroller scroller) {
    scroller.forceFinished(true);
    int amountToScroll = scroller.getFinalY() - scroller.getCurrY();
    int futureScrollOffset = (mCurrentScrollOffset + amountToScroll) % mSelectorElementHeight;
    int overshootAdjustment = mInitialScrollOffset - futureScrollOffset;
    if (overshootAdjustment != 0) {
        if (Math.abs(overshootAdjustment) > mSelectorElementHeight / 2) {
            if (overshootAdjustment > 0) {
                overshootAdjustment -= mSelectorElementHeight;
            } else {
                overshootAdjustment += mSelectorElementHeight;
            }
        }
        amountToScroll += overshootAdjustment;
        scrollBy(0, amountToScroll);
        return true;
    }
    return false;
}
 
Example 7
Source Project: timecat   Source File: Utils.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 通过scrollTo方法完成协调布局的滑动,其中主要使用了ViewCompat.postOnAnimation
 *
 * @param parent   协调布局parent
 * @param child    协调布局协调滑动的child
 * @param y        滑动目标位置y轴数值
 * @param duration 滑动执行时间
 * @return void
 */
public static void scrollTo(final CoordinatorLayout parent, final RecyclerView child, final int y, int duration) {
    final Scroller scroller = new Scroller(parent.getContext());
    scroller.startScroll(0, top, 0, y - top, duration);   //设置scroller的滚动偏移量
    ViewCompat.postOnAnimation(child, new Runnable() {
        @Override
        public void run() {
            //返回值为boolean,true说明滚动尚未完成,false说明滚动已经完成。
            // 这是一个很重要的方法,通常放在View.computeScroll()中,用来判断是否滚动是否结束。
            if (scroller.computeScrollOffset()) {
                int delta = scroller.getCurrY() - child.getTop();
                child.offsetTopAndBottom(delta);
                saveTop(child.getTop());
                parent.dispatchDependentViewsChanged(child);
                ViewCompat.postOnAnimation(child, this);
            }
        }
    });
}
 
Example 8
Source Project: DoubleViewPager   Source File: HorizontalViewPager.java    License: Apache License 2.0 6 votes vote down vote up
void initViewPager() {
    setWillNotDraw(false);
    setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
    setFocusable(true);
    final Context context = getContext();
    mScroller = new Scroller(context, sInterpolator);
    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
    mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
    mLeftEdge = new EdgeEffectCompat(context);
    mRightEdge = new EdgeEffectCompat(context);

    final float density = context.getResources().getDisplayMetrics().density;
    mFlingDistance = (int) (MIN_DISTANCE_FOR_FLING * density);
    mCloseEnough = (int) (CLOSE_ENOUGH * density);
    mDefaultGutterSize = (int) (DEFAULT_GUTTER_SIZE * density);

    ViewCompat.setAccessibilityDelegate(this, new MyAccessibilityDelegate());

    if (ViewCompat.getImportantForAccessibility(this)
            == ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
        ViewCompat.setImportantForAccessibility(this,
                ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
    }
}
 
Example 9
Source Project: TelePlus-Android   Source File: SnapHelper.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Attaches the {@link SnapHelper} to the provided RecyclerView, by calling
 * {@link RecyclerView#setOnFlingListener(RecyclerView.OnFlingListener)}.
 * You can call this method with {@code null} to detach it from the current RecyclerView.
 *
 * @param recyclerView The RecyclerView instance to which you want to add this helper or
 *                     {@code null} if you want to remove SnapHelper from the current
 *                     RecyclerView.
 *
 * @throws IllegalArgumentException if there is already a {@link RecyclerView.OnFlingListener}
 * attached to the provided {@link RecyclerView}.
 *
 */
public void attachToRecyclerView(@Nullable RecyclerView recyclerView)
        throws IllegalStateException {
    if (mRecyclerView == recyclerView) {
        return; // nothing to do
    }
    if (mRecyclerView != null) {
        destroyCallbacks();
    }
    mRecyclerView = recyclerView;
    if (mRecyclerView != null) {
        setupCallbacks();
        mGravityScroller = new Scroller(mRecyclerView.getContext(),
                new DecelerateInterpolator());
        snapToTargetExistingView();
    }
}
 
Example 10
Source Project: UltimateAndroid   Source File: FlipView.java    License: Apache License 2.0 6 votes vote down vote up
private void init() {
	final Context context = getContext();
	final ViewConfiguration configuration = ViewConfiguration.get(context);

	mScroller = new Scroller(context, flipInterpolator);
	mTouchSlop = configuration.getScaledPagingTouchSlop();
	mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
	mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();

	mShadowPaint.setColor(Color.BLACK);
	mShadowPaint.setStyle(Style.FILL);
	mShadePaint.setColor(Color.BLACK);
	mShadePaint.setStyle(Style.FILL);
	mShinePaint.setColor(Color.WHITE);
	mShinePaint.setStyle(Style.FILL);
}
 
Example 11
Source Project: MiBandDecompiled   Source File: ViewPager.java    License: Apache License 2.0 6 votes vote down vote up
void a()
{
    setWillNotDraw(false);
    setDescendantFocusability(0x40000);
    setFocusable(true);
    Context context = getContext();
    u = new Scroller(context, l);
    ViewConfiguration viewconfiguration = ViewConfiguration.get(context);
    float f1 = context.getResources().getDisplayMetrics().density;
    N = ViewConfigurationCompat.getScaledPagingTouchSlop(viewconfiguration);
    V = (int)(400F * f1);
    W = viewconfiguration.getScaledMaximumFlingVelocity();
    ae = new EdgeEffectCompat(context);
    af = new EdgeEffectCompat(context);
    Z = (int)(25F * f1);
    aa = (int)(2.0F * f1);
    L = (int)(16F * f1);
    ViewCompat.setAccessibilityDelegate(this, new aD(this));
    if (ViewCompat.getImportantForAccessibility(this) == 0)
    {
        ViewCompat.setImportantForAccessibility(this, 1);
    }
}
 
Example 12
Source Project: SearchListView   Source File: SearchListViewNoText.java    License: MIT License 6 votes vote down vote up
private void init() {
        scroller = new Scroller(getContext(), new DecelerateInterpolator());

        measureView(getHeaderView());
        headHeight = getHeaderView().getMeasuredHeight();
        getHeaderView().setPadding(0, -1 * headHeight, 0, 0);
        getHeaderView().invalidate();

//      this.setBackgroundResource(R.color.stand_default_bg_color);

        //添加头部视图
        super.addHeaderView(getHeaderView(), null, false);

        setOnScrollListener(this);

        super.setOnItemClickListener(this);
        super.setOnItemLongClickListener(this);
        super.setOnItemSelectedListener(this);
    }
 
Example 13
Source Project: JelloToggle   Source File: JelloToggle.java    License: MIT License 6 votes vote down vote up
private void init() {
    mJelloPaint = new Paint();
    mJelloPaint.setAntiAlias(true);
    mCheckedDrawable = getResources().getDrawable(R.drawable.checked);
    mOnCheckDrawable = getResources().getDrawable(R.drawable.check_on);
    mUnCheckedDrawable = getResources().getDrawable(R.drawable.uncheck);
    setJelloState();

    mJelloRect = new Rect();
    mScroller = new Scroller(getContext());
    mJelloPath = new Path();
    mInterpolator = new EaseOutElasticInterpolator();
    mDuration = DEFAULT_DURATION;


}
 
Example 14
Source Project: CoverFlowPager   Source File: VelocityViewPager.java    License: MIT License 6 votes vote down vote up
@Override
public void run() {

    final Scroller scroller = mScroller;
    boolean animationNotFinished = scroller.computeScrollOffset();
    final int x = scroller.getCurrX();
    int delta = x - mLastFlingX;

    trackMotion(delta);

    if (animationNotFinished) {
        mLastFlingX = x;
        post(this);
    } else {
        endFling();
    }

}
 
Example 15
Source Project: YCScrollPager   Source File: DirectionalViewPager.java    License: Apache License 2.0 5 votes vote down vote up
void initViewPager() {
    setWillNotDraw(false);
    mScroller = new Scroller(getContext());
    final ViewConfiguration configuration = ViewConfiguration.get(getContext());
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
    mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
}
 
Example 16
Source Project: easyweather   Source File: ScrollRefreshLayout.java    License: MIT License 5 votes vote down vote up
private void init(Context context) {
    WindowManager wm = (WindowManager) context.getSystemService(
            Context.WINDOW_SERVICE);
    DisplayMetrics dm = new DisplayMetrics();
    wm.getDefaultDisplay().getMetrics(dm);
    mScreenHeight = dm.heightPixels;
    mScroller = new Scroller(context);
}
 
Example 17
Source Project: LiuAGeAndroid   Source File: CustomViewAbove.java    License: MIT License 5 votes vote down vote up
void initCustomViewAbove() {
	setWillNotDraw(false);
	setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
	setFocusable(true);
	final Context context = getContext();
	mScroller = new Scroller(context, sInterpolator);
	final ViewConfiguration configuration = ViewConfiguration.get(context);
	mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
	mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
	mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
	setInternalPageChangeListener(new SimpleOnPageChangeListener() {
		public void onPageSelected(int position) {
			if (mViewBehind != null) {
				switch (position) {
				case 0:
				case 2:
					mViewBehind.setChildrenEnabled(true);
					break;
				case 1:
					mViewBehind.setChildrenEnabled(false);
					break;
				}
			}
		}
	});

	final float density = context.getResources().getDisplayMetrics().density;
	mFlingDistance = (int) (MIN_DISTANCE_FOR_FLING * density);
}
 
Example 18
Source Project: WidgetCase   Source File: HorScrollSelectedView.java    License: Apache License 2.0 5 votes vote down vote up
public HorScrollSelectedView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        mContext = context;
        setWillNotDraw(false);
//        setClickable(true);
        initAttrs(attrs);
        initPaint();
        mScroller = new Scroller(mContext);
    }
 
Example 19
Source Project: bither-android   Source File: WheelScroller.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Constructor
 * @param context the current context
 * @param listener the scrolling listener
 */
public WheelScroller(Context context, ScrollingListener listener) {
    gestureDetector = new GestureDetector(context, gestureListener);
    gestureDetector.setIsLongpressEnabled(false);
    
    scroller = new Scroller(context);

    this.listener = listener;
    this.context = context;
}
 
Example 20
Source Project: zone-sdk   Source File: ScrollerView.java    License: MIT License 5 votes vote down vote up
public ScrollerView(Context context, AttributeSet attrs) {
	super(context, attrs);
	setClickable(true);
	setLongClickable(true);
	mScroller = new Scroller(context);
	mGestureDetector = new GestureDetector(context, new CustomGestureListener());
}
 
Example 21
Source Project: AndroidPicker   Source File: HorizontalListView.java    License: MIT License 5 votes vote down vote up
private synchronized void initView() {
    mLeftViewIndex = -1;
    mRightViewIndex = 0;
    mDisplayOffset = 0;
    mCurrentX = 0;
    mNextX = 0;
    mMaxX = Integer.MAX_VALUE;
    mScroller = new Scroller(getContext());
    mGesture = new GestureDetector(getContext(), mOnGesture);
}
 
Example 22
Source Project: prayer-times-android   Source File: MyScrollView.java    License: Apache License 2.0 5 votes vote down vote up
private void initBounce() {

        // init the bouncy scroller, and make sure the layout is being drawn
        // after the top padding
        mScroller = new Scroller(getContext(), new OvershootInterpolator(OVERSHOOT_TENSION));
        overScrollerSpringbackTask = new Runnable() {
            @Override
            public void run() {
                // scroll till after the padding
                mScroller.computeScrollOffset();
                scrollTo(0, mScroller.getCurrY());

                if (!mScroller.isFinished()) {
                    post(this);
                }
            }
        };
        prevScrollY = getPaddingTop();

        try {
            mScrollXField = View.class.getDeclaredField("mScrollX");
            mScrollYField = View.class.getDeclaredField("mScrollY");

        } catch (Exception e) {
            hasFailedObtainingScrollFields = true;
        }
    }
 
Example 23
Source Project: Huochexing12306   Source File: MsgListView.java    License: Apache License 2.0 5 votes vote down vote up
private void initWithContext(Context context) {
	mScroller = new Scroller(context, new DecelerateInterpolator());
	// XListView need the scroll event, and it will dispatch the event to
	// user's listener (as a proxy).
	super.setOnScrollListener(this);

	// init header view
	mHeaderView = new MsgHeader(context);
	mHeaderViewContent = (RelativeLayout) mHeaderView
			.findViewById(R.id.msg_header_content);
	// mHeaderTimeView = (TextView) mHeaderView
	// .findViewById(R.id.xlistview_header_time);
	addHeaderView(mHeaderView);

	// init footer view
	mFooterView = new XListViewFooter(context);

	// init header height
	mHeaderView.getViewTreeObserver().addOnGlobalLayoutListener(
			new OnGlobalLayoutListener() {
				@Override
				public void onGlobalLayout() {
					mHeaderViewHeight = mHeaderViewContent.getHeight();
					getViewTreeObserver()
							.removeGlobalOnLayoutListener(this);
				}
			});
}
 
Example 24
Source Project: adt-leanback-support   Source File: ViewPager.java    License: Apache License 2.0 5 votes vote down vote up
void initViewPager() {
    setWillNotDraw(false);
    setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
    setFocusable(true);
    final Context context = getContext();
    mScroller = new Scroller(context, sInterpolator);
    final ViewConfiguration configuration = ViewConfiguration.get(context);
    final float density = context.getResources().getDisplayMetrics().density;

    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
    mMinimumVelocity = (int) (MIN_FLING_VELOCITY * density);
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
    mLeftEdge = new EdgeEffectCompat(context);
    mRightEdge = new EdgeEffectCompat(context);

    mFlingDistance = (int) (MIN_DISTANCE_FOR_FLING * density);
    mCloseEnough = (int) (CLOSE_ENOUGH * density);
    mDefaultGutterSize = (int) (DEFAULT_GUTTER_SIZE * density);

    ViewCompat.setAccessibilityDelegate(this, new MyAccessibilityDelegate());

    if (ViewCompat.getImportantForAccessibility(this)
            == ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
        ViewCompat.setImportantForAccessibility(this,
                ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
    }
}
 
Example 25
public GroupedPhotosListView(Context context, int paddingTop) {
    super(context);
    gestureDetector = new GestureDetector(context, this);
    scroll = new Scroller(context);
    itemWidth = AndroidUtilities.dp(42);
    itemHeight = AndroidUtilities.dp(56);
    itemSpacing = AndroidUtilities.dp(1);
    itemY = paddingTop;
    backgroundPaint.setColor(0x7f000000);
}
 
Example 26
Source Project: SmoothRefreshLayout   Source File: SmoothRefreshLayout.java    License: MIT License 5 votes vote down vote up
private Scroller makeOrGetScroller(Interpolator interpolator) {
    if (interpolator == SPRING_INTERPOLATOR) {
        return mCachedScroller[0];
    } else if (interpolator == SPRING_BACK_INTERPOLATOR) {
        return mCachedScroller[1];
    } else if (interpolator == FLING_INTERPOLATOR) {
        return mCachedScroller[2];
    } else {
        return new Scroller(getContext(), interpolator);
    }
}
 
Example 27
void initVerticalViewPager() {
    setWillNotDraw(false);
    setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
    setFocusable(true);
    final Context context = getContext();
    mScroller = new Scroller(context, sInterpolator);
    final ViewConfiguration configuration = ViewConfiguration.get(context);
    final float density = context.getResources().getDisplayMetrics().density;

    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
    mMinimumVelocity = (int) (MIN_FLING_VELOCITY * density);
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
    mTopEdge = new EdgeEffectCompat(context);
    mBottomEdge = new EdgeEffectCompat(context);
    
    mFlingDistance = (int) (MIN_DISTANCE_FOR_FLING * density);
    mCloseEnough = (int) (CLOSE_ENOUGH * density);
    mDefaultGutterSize = (int) (DEFAULT_GUTTER_SIZE * density);

    ViewCompat.setAccessibilityDelegate(this, new MyAccessibilityDelegate());

    if (ViewCompat.getImportantForAccessibility(this)
            == ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
        ViewCompat.setImportantForAccessibility(this,
                ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
    }
}
 
Example 28
Source Project: palmsuda   Source File: MyScrollView.java    License: Apache License 2.0 5 votes vote down vote up
public MyScrollView(Context context, AttributeSet attrs, int defStyle) {

		super(context, attrs, defStyle);
		mWallpaperManager = WallpaperManager.getInstance(context);
		mScroller = new Scroller(context);
		mCurScreen = mDefaultScreen;
		mTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
	}
 
Example 29
public CompatScroller(Context context) {
	if (VERSION.SDK_INT < VERSION_CODES.GINGERBREAD) {
		isPreGingerbread = true;
		scroller = new Scroller(context);
		
	} else {
		isPreGingerbread = false;
		overScroller = new OverScroller(context);
	}
}
 
Example 30
public CompatScroller(Context context) {
	if (VERSION.SDK_INT < VERSION_CODES.GINGERBREAD) {
		isPreGingerbread = true;
		scroller = new Scroller(context);

	} else {
		isPreGingerbread = false;
		overScroller = new OverScroller(context);
	}
}