android.widget.AbsListView.OnScrollListener#SCROLL_STATE_TOUCH_SCROLL源码实例Demo

下面列出了android.widget.AbsListView.OnScrollListener#SCROLL_STATE_TOUCH_SCROLL 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: candybar   文件: PauseOnScrollListener.java
@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);
    }
}
 
源代码2 项目: sctalk   文件: ImageGridActivity.java
@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;
    }
}
 
@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);
	}
}
 
源代码4 项目: BigApp_Discuz_Android   文件: ReboundListView1.java
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;
}
 
@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);
    }
}
 
@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);
	}
}
 
@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);
	}
}
 
@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);
	}
}
 
源代码9 项目: android-Stupid-Adapter   文件: IPauseOnScroll.java
@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);
}
 
@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);
    }
}
 
源代码11 项目: volley   文件: PauseOnScrollListener.java
@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);
    }
}
 
源代码12 项目: endpoints-codelab-android   文件: TodoTxtTouch.java
@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;
	}
}
 
源代码13 项目: PersianDateRangePicker   文件: DayPickerView.java
@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;
  }
}
 
源代码14 项目: AssistantBySDK   文件: DayPickerView.java
@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;
    }
}
 
源代码15 项目: BottomSheetPickers   文件: DayPickerView.java
@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;
    }
}
 
源代码16 项目: WifiChat   文件: WifiapActivity.java
@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;
    }
}
 
源代码17 项目: Android-BluetoothKit   文件: PullRefreshListView.java
@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);
	}
}
 
源代码18 项目: AlarmOn   文件: DayPickerView.java
@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;
    }
}
 
源代码19 项目: MaterialDateRangePicker   文件: DayPickerView.java
@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;
    }
}
 
源代码20 项目: StyleableDateTimePicker   文件: DayPickerView.java
@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;
    }
}