Java Code Examples for android.widget.AbsListView.OnScrollListener#SCROLL_STATE_IDLE
The following examples show how to use
android.widget.AbsListView.OnScrollListener#SCROLL_STATE_IDLE .
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: PauseOnScrollListener.java From android-open-project-demo with Apache License 2.0 | 6 votes |
@Override public void onScrollStateChanged(AbsListView view, int scrollState) { switch (scrollState) { case OnScrollListener.SCROLL_STATE_IDLE: taskHandler.resume(); break; case OnScrollListener.SCROLL_STATE_TOUCH_SCROLL: if (pauseOnScroll) { taskHandler.pause(); } break; case OnScrollListener.SCROLL_STATE_FLING: if (pauseOnFling) { taskHandler.pause(); } break; } if (externalListener != null) { externalListener.onScrollStateChanged(view, scrollState); } }
Example 2
Source File: PauseOnScrollListener.java From BigApp_WordPress_Android with Apache License 2.0 | 6 votes |
@Override public void onScrollStateChanged(AbsListView view, int scrollState) { switch (scrollState) { case OnScrollListener.SCROLL_STATE_IDLE: imageLoader.resume(); break; case OnScrollListener.SCROLL_STATE_TOUCH_SCROLL: if (pauseOnScroll) { imageLoader.pause(); } break; case OnScrollListener.SCROLL_STATE_FLING: if (pauseOnFling) { imageLoader.pause(); } break; } if (externalListener != null) { externalListener.onScrollStateChanged(view, scrollState); } }
Example 3
Source File: PauseOnScrollListener.java From mobile-manager-tool with MIT License | 6 votes |
@Override public void onScrollStateChanged(AbsListView view, int scrollState) { switch (scrollState) { case OnScrollListener.SCROLL_STATE_IDLE: imageLoader.resume(); break; case OnScrollListener.SCROLL_STATE_TOUCH_SCROLL: if (pauseOnScroll) { imageLoader.pause(); } break; case OnScrollListener.SCROLL_STATE_FLING: if (pauseOnFling) { imageLoader.pause(); } break; } if (externalListener != null) { externalListener.onScrollStateChanged(view, scrollState); } }
Example 4
Source File: PullToRefreshAdapterViewBase.java From BigApp_WordPress_Android with Apache License 2.0 | 6 votes |
public final void onScrollStateChanged(final AbsListView view, final int state) { /** * Check that the scrolling has stopped, and that the last item is * visible. */ if (state == OnScrollListener.SCROLL_STATE_IDLE && null != mOnLastItemVisibleListener && mLastItemVisible) { mOnLastItemVisibleListener.onLastItemVisible(); } if (null != mOnScrollListener) { mOnScrollListener.onScrollStateChanged(view, state); } }
Example 5
Source File: TopAnimHandler.java From bither-bitmap-sample with Apache License 2.0 | 6 votes |
@Override public void run() { if (cells.size() == 0) { return; } // for (CellHolder cell : cells) { // if (cell.isToAnimate() && !animCells.contains(cell)) { // animCells.add(cell); // } // if (!cell.isToAnimate() && animCells.contains(cell)) { // animCells.remove(cell); // } // if (!cell.isReadyForAnimation()) { // return; // } // } if (scrollState == OnScrollListener.SCROLL_STATE_IDLE) { startAnimQueue(); } }
Example 6
Source File: BaseCommonAdapter.java From BaseProject with Apache License 2.0 | 5 votes |
@Override public void onScrollStateChanged(AbsListView view, int scrollState) { if(OnScrollListener.SCROLL_STATE_IDLE == scrollState){ isScrolling = false; notifyDataSetChanged(); } else{ isScrolling = true; } if(outScrollListener != null){ outScrollListener.onScrollStateChanged(view, scrollState); } }
Example 7
Source File: VideoOnlineListActivity.java From mobile-manager-tool with MIT License | 5 votes |
@Override public void onScrollStateChanged(AbsListView view, int scrollState) { // 滑到底部后自动加载,判断listview已经停止滚动并且最后可视的条目等于adapter的条目 if (scrollState == OnScrollListener.SCROLL_STATE_IDLE && lastVisibleIndex >= videoListAdapter.getCount()) { progressBar.setVisibility(View.VISIBLE); loadingTip.setVisibility(View.VISIBLE); loadVideo(); } }
Example 8
Source File: PullToRefreshAdapterViewBase.java From android-project-wo2b with Apache License 2.0 | 5 votes |
public final void onScrollStateChanged(final AbsListView view, final int state) { /** * Check that the scrolling has stopped, and that the last item is * visible. */ if (state == OnScrollListener.SCROLL_STATE_IDLE && null != mOnLastItemVisibleListener && mLastItemVisible) { mOnLastItemVisibleListener.onLastItemVisible(); } if (null != mOnScrollListener) { mOnScrollListener.onScrollStateChanged(view, state); } }
Example 9
Source File: PullToRefreshAdapterViewBase.java From LbaizxfPulltoRefresh with Apache License 2.0 | 5 votes |
public final void onScrollStateChanged(final AbsListView view, final int state) { /** * Check that the scrolling has stopped, and that the last item is * visible. */ if (state == OnScrollListener.SCROLL_STATE_IDLE && null != mOnLastItemVisibleListener && mLastItemVisible) { mOnLastItemVisibleListener.onLastItemVisible(); } if (null != mOnScrollListener) { mOnScrollListener.onScrollStateChanged(view, state); } }
Example 10
Source File: DayPickerView.java From AlarmOn with Apache License 2.0 | 5 votes |
@Override public void run() { mCurrentScrollState = mNewState; if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "new scroll state: " + mNewState + " old state: " + mPreviousScrollState); } // Fix the position after a scroll or a fling ends if (mNewState == OnScrollListener.SCROLL_STATE_IDLE && mPreviousScrollState != OnScrollListener.SCROLL_STATE_IDLE && mPreviousScrollState != OnScrollListener.SCROLL_STATE_TOUCH_SCROLL) { mPreviousScrollState = mNewState; int i = 0; View child = getChildAt(i); while (child != null && child.getBottom() <= 0) { child = getChildAt(++i); } if (child == null) { // The view is no longer visible, just return return; } int firstPosition = getFirstVisiblePosition(); int lastPosition = getLastVisiblePosition(); boolean scroll = firstPosition != 0 && lastPosition != getCount() - 1; final int top = child.getTop(); final int bottom = child.getBottom(); final int midpoint = getHeight() / 2; if (scroll && top < LIST_TOP_OFFSET) { if (bottom > midpoint) { smoothScrollBy(top, GOTO_SCROLL_DURATION); } else { smoothScrollBy(bottom, GOTO_SCROLL_DURATION); } } } else { mPreviousScrollState = mNewState; } }
Example 11
Source File: PullToRefreshAdapterViewBase.java From FanXin-based-HuanXin with GNU General Public License v2.0 | 5 votes |
public final void onScrollStateChanged(final AbsListView view, final int state) { /** * Check that the scrolling has stopped, and that the last item is * visible. */ if (state == OnScrollListener.SCROLL_STATE_IDLE && null != mOnLastItemVisibleListener && mLastItemVisible) { mOnLastItemVisibleListener.onLastItemVisible(); } if (null != mOnScrollListener) { mOnScrollListener.onScrollStateChanged(view, state); } }
Example 12
Source File: PullToRefreshAdapterViewBase.java From MagicHeaderViewPager with Apache License 2.0 | 5 votes |
public final void onScrollStateChanged(final AbsListView view, final int state) { /** * Check that the scrolling has stopped, and that the last item is visible. */ if(state == OnScrollListener.SCROLL_STATE_IDLE && null != mOnLastItemVisibleListener && mLastItemVisible) { mOnLastItemVisibleListener.onLastItemVisible(); } if(null != mOnScrollListener) { mOnScrollListener.onScrollStateChanged(view, state); } canInvoke = true; }
Example 13
Source File: PullToRefreshAdapterViewBase.java From PullToRefreshLibrary with Apache License 2.0 | 5 votes |
public final void onScrollStateChanged(final AbsListView view, final int state) { /** * Check that the scrolling has stopped, and that the last item is * visible. */ if (state == OnScrollListener.SCROLL_STATE_IDLE && null != mOnLastItemVisibleListener && mLastItemVisible) { mOnLastItemVisibleListener.onLastItemVisible(); } if (null != mOnScrollListener) { mOnScrollListener.onScrollStateChanged(view, state); } }
Example 14
Source File: PullToRefreshAdapterViewBase.java From RefreashTabView with Apache License 2.0 | 5 votes |
public final void onScrollStateChanged(final AbsListView view, final int state) { /** * Check that the scrolling has stopped, and that the last item is * visible. */ if (state == OnScrollListener.SCROLL_STATE_IDLE && null != mOnLastItemVisibleListener && mLastItemVisible) { mOnLastItemVisibleListener.onLastItemVisible(); } if (null != mOnScrollListener) { mOnScrollListener.onScrollStateChanged(view, state); } }
Example 15
Source File: PullToRefreshAdapterViewBase.java From Social with Apache License 2.0 | 5 votes |
public final void onScrollStateChanged(final AbsListView view, final int state) { /** * Check that the scrolling has stopped, and that the last item is * visible. */ if (state == OnScrollListener.SCROLL_STATE_IDLE && null != mOnLastItemVisibleListener && mLastItemVisible) { mOnLastItemVisibleListener.onLastItemVisible(); } if (null != mOnScrollListener) { mOnScrollListener.onScrollStateChanged(view, state); } }
Example 16
Source File: DayPickerView.java From StyleableDateTimePicker with MIT License | 5 votes |
@Override public void run() { mCurrentScrollState = mNewState; if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "new scroll state: " + mNewState + " old state: " + mPreviousScrollState); } // Fix the position after a scroll or a fling ends if (mNewState == OnScrollListener.SCROLL_STATE_IDLE && mPreviousScrollState != OnScrollListener.SCROLL_STATE_IDLE && mPreviousScrollState != OnScrollListener.SCROLL_STATE_TOUCH_SCROLL) { mPreviousScrollState = mNewState; int i = 0; View child = getChildAt(i); while (child != null && child.getBottom() <= 0) { child = getChildAt(++i); } if (child == null) { // The view is no longer visible, just return return; } int firstPosition = getFirstVisiblePosition(); int lastPosition = getLastVisiblePosition(); boolean scroll = firstPosition != 0 && lastPosition != getCount() - 1; final int top = child.getTop(); final int bottom = child.getBottom(); final int midpoint = getHeight() / 2; if (scroll && top < LIST_TOP_OFFSET) { if (bottom > midpoint) { smoothScrollBy(top, GOTO_SCROLL_DURATION); } else { smoothScrollBy(bottom, GOTO_SCROLL_DURATION); } } } else { mPreviousScrollState = mNewState; } }
Example 17
Source File: TopAnimHandler.java From bither-bitmap-sample with Apache License 2.0 | 5 votes |
private void check() { if (scrollState != OnScrollListener.SCROLL_STATE_IDLE) { return; } removeCallbacks(reset); removeCallbacks(check); postDelayed(check, AnimDelay); }
Example 18
Source File: DayPickerView.java From PersianDateRangePicker with Apache License 2.0 | 5 votes |
@Override public void run() { mCurrentScrollState = mNewState; if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "new scroll state: " + mNewState + " old state: " + mPreviousScrollState); } // Fix the position after a scroll or a fling ends if (mNewState == OnScrollListener.SCROLL_STATE_IDLE && mPreviousScrollState != OnScrollListener.SCROLL_STATE_IDLE && mPreviousScrollState != OnScrollListener.SCROLL_STATE_TOUCH_SCROLL) { mPreviousScrollState = mNewState; int i = 0; View child = getChildAt(i); while (child != null && child.getBottom() <= 0) { child = getChildAt(++i); } if (child == null) { // The view is no longer visible, just return return; } int firstPosition = getFirstVisiblePosition(); int lastPosition = getLastVisiblePosition(); boolean scroll = firstPosition != 0 && lastPosition != getCount() - 1; final int top = child.getTop(); final int bottom = child.getBottom(); final int midpoint = getHeight() / 2; if (scroll && top < LIST_TOP_OFFSET) { if (bottom > midpoint) { smoothScrollBy(top, GOTO_SCROLL_DURATION); } else { smoothScrollBy(bottom, GOTO_SCROLL_DURATION); } } } else { mPreviousScrollState = mNewState; } }
Example 19
Source File: DayPickerView.java From narrate-android with Apache License 2.0 | 4 votes |
@Override public void run() { mCurrentScrollState = mNewState; if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "new scroll state: " + mNewState + " old state: " + mPreviousScrollState); } if (mHideTitles) { mHandler.removeCallbacks(mTitleAlphaRunnable); mHandler.postDelayed(mTitleAlphaRunnable, 50); } // Fix the position after a scroll or a fling ends if (mNewState == OnScrollListener.SCROLL_STATE_IDLE) { if (mPreviousScrollState != OnScrollListener.SCROLL_STATE_IDLE) { mPreviousScrollState = mNewState; mHandler.removeCallbacks(mSelectionUpdateRunnable); int i = 0; MonthView child = (MonthView) getChildAt(i); while (child != null && child.getBottom() <= 0) { child = (MonthView) getChildAt(++i); } if (child == null) { // The view is no longer visible, just return return; } int firstPosition = getFirstVisiblePosition(); int lastPosition = getLastVisiblePosition(); boolean scroll = firstPosition != 0 && lastPosition != getCount() - 1; final int top = child.getTop(); final int bottom = child.getBottom(); final int midpoint = getHeight() / 2; if (scroll) { if ((top < LIST_TOP_OFFSET && child.getNumRows() < 6) || (child.getNumRows() == 6 && (top + child.getRowHeight() / 2) < LIST_TOP_OFFSET)) { if (bottom > midpoint) { if (mHideTitles && child.getNumRows() == 6) { smoothScrollBy(top + child.getRowHeight() / 2, GOTO_SCROLL_DURATION); } else { smoothScrollBy(top, GOTO_SCROLL_DURATION); } } else { if (mHideTitles && ((MonthView) getChildAt(i + 1)).getNumRows() == 6) { smoothScrollBy(bottom + child.getRowHeight() / 2, GOTO_SCROLL_DURATION); } else { smoothScrollBy(bottom, GOTO_SCROLL_DURATION); } } } if (mListener != null || mStickySelectedDate) { MonthView newChild = child; if ( bottom < midpoint ) { newChild = (MonthView) getChildAt(i + 1); } if (newChild.getMonth() != mSelectedDay.month || newChild.getYear() != mSelectedDay.year) { final CalendarDay day = new CalendarDay(newChild.getYear(), newChild.getMonth(), 1); mSelectionUpdateRunnable.processChange(day); } } } } } else { mPreviousScrollState = mNewState; } }
Example 20
Source File: KlyphFragment2.java From Klyph with MIT License | 4 votes |
public void onScrollStateChanged(AbsListView view, int scrollState) { userScroll = scrollState != OnScrollListener.SCROLL_STATE_IDLE; }