Java Code Examples for android.widget.Scroller#isFinished()
The following examples show how to use
android.widget.Scroller#isFinished() .
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 File: NumberPicker.java From iGap-Android with GNU Affero General Public License v3.0 | 6 votes |
@Override public void computeScroll() { Scroller scroller = mFlingScroller; if (scroller.isFinished()) { scroller = mAdjustScroller; if (scroller.isFinished()) { return; } } scroller.computeScrollOffset(); int currentScrollerY = scroller.getCurrY(); if (mPreviousScrollerY == 0) { mPreviousScrollerY = scroller.getStartY(); } scrollBy(0, currentScrollerY - mPreviousScrollerY); mPreviousScrollerY = currentScrollerY; if (scroller.isFinished()) { onScrollerFinished(scroller); } else { invalidate(); } }
Example 2
Source File: NumberPicker.java From DateTimePicker with Apache License 2.0 | 6 votes |
@Override public void computeScroll() { Scroller scroller = mFlingScroller; if (scroller.isFinished()) { scroller = mAdjustScroller; if (scroller.isFinished()) { return; } } scroller.computeScrollOffset(); int currentScrollerY = scroller.getCurrY(); if (mPreviousScrollerY == 0) { mPreviousScrollerY = scroller.getStartY(); } scrollBy(0, currentScrollerY - mPreviousScrollerY); mPreviousScrollerY = currentScrollerY; if (scroller.isFinished()) { onScrollerFinished(scroller); } else { invalidate(); } }
Example 3
Source File: NumberPicker.java From ticdesign with Apache License 2.0 | 6 votes |
@Override public void computeScroll() { Scroller scroller = mFlingScroller; if (scroller.isFinished()) { scroller = mAdjustScroller; if (scroller.isFinished()) { return; } } scroller.computeScrollOffset(); int currentScrollerY = scroller.getCurrY(); if (mPreviousScrollerY == 0) { mPreviousScrollerY = scroller.getStartY(); } scrollBy(0, currentScrollerY - mPreviousScrollerY); mPreviousScrollerY = currentScrollerY; if (scroller.isFinished()) { onScrollerFinished(scroller); } else { invalidate(); } }
Example 4
Source File: NumberPicker.java From NewXmPluginSDK with Apache License 2.0 | 6 votes |
@Override public void computeScroll() { Scroller scroller = mFlingScroller; if (scroller.isFinished()) { scroller = mAdjustScroller; if (scroller.isFinished()) { return; } } scroller.computeScrollOffset(); int currentScrollerY = scroller.getCurrY(); if (mPreviousScrollerY == 0) { mPreviousScrollerY = scroller.getStartY(); } scrollBy(0, currentScrollerY - mPreviousScrollerY); mPreviousScrollerY = currentScrollerY; if (scroller.isFinished()) { onScrollerFinished(scroller); } else { invalidate(); } }
Example 5
Source File: NumberPicker.java From DatePicker with Apache License 2.0 | 6 votes |
@Override public void computeScroll() { Scroller scroller = mFlingScroller; if (scroller.isFinished()) { onScrollStateChange(OnScrollListener.SCROLL_STATE_IDLE); scroller = mAdjustScroller; if (scroller.isFinished()) { return; } } scroller.computeScrollOffset(); mCurrY = scroller.getCurrY(); mOffectY = mCurrY - mStartY; computeYPos(mOffectY); invalidate(); mStartY = mCurrY; }
Example 6
Source File: MeterNumberPicker.java From meter-number-picker with Apache License 2.0 | 5 votes |
@Override public void computeScroll() { Scroller scroller = flingScroller; if (scroller.isFinished()) { scroller = adjustScroller; if (scroller.isFinished()) { return; } } scroller.computeScrollOffset(); int currentScrollerY = scroller.getCurrY(); int diffScrollY = scrollerLastY - currentScrollerY; currentScrollOffset -= diffScrollY; scrollerLastY = currentScrollerY; if (adjustScroller.isFinished()) { if (flingScroller.isFinished()) { if (currentScrollOffset != 0) { int measuredHeight = getMeasuredHeight(); int adjustedValueOffset = calculateAdjustedValueOffset(measuredHeight); value = getValue(adjustedValueOffset); adjust(measuredHeight, adjustedValueOffset); } } else { int newScrollOffset = currentScrollOffset % getMeasuredHeight(); if (newScrollOffset != currentScrollOffset) { int numberOfValuesScrolled = (currentScrollOffset - newScrollOffset) / getMeasuredHeight(); currentValueOffset += numberOfValuesScrolled; currentScrollOffset = newScrollOffset; } } } invalidate(); }
Example 7
Source File: MyScrollView.java From prayer-times-android with Apache License 2.0 | 5 votes |
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 8
Source File: MyScrollView.java From prayer-times-android with Apache License 2.0 | 5 votes |
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; } }