本文整理匯總了Java中android.widget.AbsListView.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL屬性的典型用法代碼示例。如果您正苦於以下問題:Java OnScrollListener.SCROLL_STATE_TOUCH_SCROLL屬性的具體用法?Java OnScrollListener.SCROLL_STATE_TOUCH_SCROLL怎麽用?Java OnScrollListener.SCROLL_STATE_TOUCH_SCROLL使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類android.widget.AbsListView.OnScrollListener
的用法示例。
在下文中一共展示了OnScrollListener.SCROLL_STATE_TOUCH_SCROLL屬性的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onScrollStateChanged
@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: onScrollStateChanged
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
switch (scrollState) {
case OnScrollListener.SCROLL_STATE_IDLE:
bitmapUtils.resumeTasks();
LogUtils.i("當前ListView停止滾動,加載圖片開始......................");
break;
case OnScrollListener.SCROLL_STATE_TOUCH_SCROLL:
if (pauseOnScroll) {
bitmapUtils.pauseTasks();
LogUtils.i("當前ListView被觸摸滾動,暫停加載......................");
}
break;
case OnScrollListener.SCROLL_STATE_FLING:
if (pauseOnFling) {
bitmapUtils.pauseTasks();
LogUtils.i("當前ListView被手勢離開滾動,暫停加載......................");
}
break;
}
if (externalListener != null) {
externalListener.onScrollStateChanged(view, scrollState);
}
}
示例3: onScrollStateChanged
@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;
}
}
示例4: onScrollStateChanged
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
switch (scrollState) {
case OnScrollListener.SCROLL_STATE_IDLE:
magic.magicEngine.resume();
break;
case OnScrollListener.SCROLL_STATE_TOUCH_SCROLL:
if (pauseOnScroll) {
magic.magicEngine.pause();
}
break;
case OnScrollListener.SCROLL_STATE_FLING:
if (pauseOnFling) {
magic.magicEngine.pause();
}
break;
}
if (externalListener != null) {
externalListener.onScrollStateChanged(view, scrollState);
}
}
示例5: getScrollStateString
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;
}
示例6: onScrollStateChanged
@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);
}
}
示例7: run
@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;
}
}
示例8: shouldDelay
public static boolean shouldDelay(int groupPosition, int childPosition, View convertView, ViewGroup parent, String url)
{
if (url == null || BitmapAjaxCallback.isMemoryCached(url))
{
return false;
}
AbsListView lv = (AbsListView) parent;
OnScrollListener sl = (OnScrollListener) parent.getTag(AQuery.TAG_SCROLL_LISTENER);
if (sl == null)
{
sl = new Common();
lv.setOnScrollListener(sl);
parent.setTag(AQuery.TAG_SCROLL_LISTENER, sl);
}
Integer scrollState = (Integer) lv.getTag(AQuery.TAG_NUM);
if (scrollState == null || scrollState == OnScrollListener.SCROLL_STATE_IDLE || scrollState == OnScrollListener.SCROLL_STATE_TOUCH_SCROLL)
{
return false;
}
long packed = childPosition;
if (parent instanceof ExpandableListView)
{
packed = ExpandableListView.getPackedPositionForChild(groupPosition, childPosition);
}
convertView.setTag(AQuery.TAG_NUM, packed);
//TODO add draw count and skip drawing list if possible
return true;
}