Java Code Examples for android.widget.AbsListView.OnScrollListener#SCROLL_STATE_TOUCH_SCROLL
The following examples show how to use
android.widget.AbsListView.OnScrollListener#SCROLL_STATE_TOUCH_SCROLL .
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 candybar 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 2
Source File: TodoTxtTouch.java From endpoints-codelab-android with GNU General Public License v3.0 | 6 votes |
@Override public void onScrollStateChanged(AbsListView view, int scrollState) { // Store the scrolling state of the listview Log.v(TAG, "Scrolling state: " + scrollState); switch (scrollState) { case OnScrollListener.SCROLL_STATE_IDLE: mListScrolling = false; break; case OnScrollListener.SCROLL_STATE_TOUCH_SCROLL: // List is scrolling under the direct touch of the user mListScrolling = true; break; case OnScrollListener.SCROLL_STATE_FLING: // The user did a 'fling' on the list and it's still // scrolling mListScrolling = true; break; } }
Example 3
Source File: ImageGridActivity.java From sctalk with Apache License 2.0 | 6 votes |
@Override public void onScrollStateChanged(AbsListView view, int scrollState) { switch (scrollState) { case OnScrollListener.SCROLL_STATE_FLING: adapter.lock(); break; case OnScrollListener.SCROLL_STATE_IDLE: adapter.unlock(); break; case OnScrollListener.SCROLL_STATE_TOUCH_SCROLL: adapter.lock(); break; default: break; } }
Example 4
Source File: PauseOnScrollListener.java From Android-Application-ZJB 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 5
Source File: ReboundListView1.java From BigApp_Discuz_Android with Apache License 2.0 | 6 votes |
private String getScrollStateString(int flag) { String str = ""; switch (flag) { case OnScrollListener.SCROLL_STATE_IDLE: str = "SCROLL_STATE_IDLE"; break; case OnScrollListener.SCROLL_STATE_TOUCH_SCROLL: str = "SCROLL_STATE_TOUCH_SCROLL"; break; case OnScrollListener.SCROLL_STATE_FLING: str = "SCROLL_STATE_FLING"; break; default: str = "wrong state"; } return str; }
Example 6
Source File: PauseOnScrollListener.java From BigApp_Discuz_Android 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 7
Source File: PauseOnScrollListener.java From volley with Apache License 2.0 | 6 votes |
@Override public void onScrollStateChanged(AbsListView view, int scrollState) { switch (scrollState) { case OnScrollListener.SCROLL_STATE_IDLE: bitmapTools.resume(); break; case OnScrollListener.SCROLL_STATE_TOUCH_SCROLL: if (pauseOnScroll) { bitmapTools.pause(); } break; case OnScrollListener.SCROLL_STATE_FLING: if (pauseOnFling) { bitmapTools.pause(); } break; } if (externalListener != null) { externalListener.onScrollStateChanged(view, scrollState); } }
Example 8
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 9
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: 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 10
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 11
Source File: PauseOnScrollListener.java From android-project-wo2b 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 12
Source File: IPauseOnScroll.java From android-Stupid-Adapter with Apache License 2.0 | 6 votes |
@Override public void onScrollStateChanged(AbsListView view, int scrollState) { switch (scrollState) { case OnScrollListener.SCROLL_STATE_IDLE: adapter.onResume(); break; case OnScrollListener.SCROLL_STATE_TOUCH_SCROLL: // adapter.pause(); adapter.onResume(); break; case OnScrollListener.SCROLL_STATE_FLING: adapter.onPause(); break; } if (listener != null) listener.onScrollStateChanged(view, scrollState); }
Example 13
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 14
Source File: DayPickerView.java From MaterialDateRangePicker 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 15
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 16
Source File: PullRefreshListView.java From Android-BluetoothKit with Apache License 2.0 | 5 votes |
@Override public void onScrollStateChanged(AbsListView view, int scrollState) { switch (scrollState) { case OnScrollListener.SCROLL_STATE_IDLE: isBusy = false; int first = getFirstVisiblePosition(); int count = getChildCount(); int nHeadCount = getHeaderViewsCount(); int currPosition; for (int i = 0; i < count; i++) { currPosition = first - nHeadCount + i; if (currPosition == -nHeadCount) { continue;// 下拉刷新标题栏 } if (currPosition >= getCount()) {// 加载更多布局显示的时候 return; } if (mListener != null) { mListener.serListViewBusy(currPosition, i); } } break; case OnScrollListener.SCROLL_STATE_FLING: isBusy = true; break; case OnScrollListener.SCROLL_STATE_TOUCH_SCROLL: isBusy = true; break; default: break; } if (mScrollPositionListener != null) { mScrollPositionListener.onScrollStateChanged(view, scrollState); } }
Example 17
Source File: WifiapActivity.java From WifiChat with GNU General Public License v2.0 | 5 votes |
@Override public void onScrollStateChanged(AbsListView view, int scrollState) { switch (scrollState) { case OnScrollListener.SCROLL_STATE_IDLE: mHandler.setRespondFlag(true); break; case OnScrollListener.SCROLL_STATE_FLING: mHandler.setRespondFlag(false); // 滚动时不刷新列表 break; case OnScrollListener.SCROLL_STATE_TOUCH_SCROLL: mHandler.setRespondFlag(false); // 滚动时不刷新列表 break; } }
Example 18
Source File: DayPickerView.java From BottomSheetPickers 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 AssistantBySDK 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 20
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; } }