當前位置: 首頁>>代碼示例>>Java>>正文


Java RecyclerView.SCROLL_STATE_DRAGGING屬性代碼示例

本文整理匯總了Java中android.support.v7.widget.RecyclerView.SCROLL_STATE_DRAGGING屬性的典型用法代碼示例。如果您正苦於以下問題:Java RecyclerView.SCROLL_STATE_DRAGGING屬性的具體用法?Java RecyclerView.SCROLL_STATE_DRAGGING怎麽用?Java RecyclerView.SCROLL_STATE_DRAGGING使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在android.support.v7.widget.RecyclerView的用法示例。


在下文中一共展示了RecyclerView.SCROLL_STATE_DRAGGING屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onScrollStateChanged

@Override
public void onScrollStateChanged(int state) {
    if (currentScrollState == RecyclerView.SCROLL_STATE_IDLE && currentScrollState != state) {
        scrollStateListener.onScrollStart();
    }

    if (state == RecyclerView.SCROLL_STATE_IDLE) {
        //Scroll is not finished until current view is centered
        boolean isScrollEnded = onScrollEnd();
        if (isScrollEnded) {
            scrollStateListener.onScrollEnd();
        } else {
            //Scroll continues and we don't want to set currentScrollState to STATE_IDLE,
            //because this will then trigger .scrollStateListener.onScrollStart()
            return;
        }
    } else if (state == RecyclerView.SCROLL_STATE_DRAGGING) {
        onDragStart();
    }
    currentScrollState = state;
}
 
開發者ID:xieyangxuejun,項目名稱:Views,代碼行數:21,代碼來源:DiscreteScrollLayoutManager.java

示例2: onScrollStateChanged

@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
  int listViewState;
  switch (newState) {
    case RecyclerView.SCROLL_STATE_DRAGGING:
      listViewState = ListView.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL;
      break;
    case RecyclerView.SCROLL_STATE_IDLE:
      listViewState = ListView.OnScrollListener.SCROLL_STATE_IDLE;
      break;
    case RecyclerView.SCROLL_STATE_SETTLING:
      listViewState = ListView.OnScrollListener.SCROLL_STATE_FLING;
      break;
    default:
      listViewState = UNKNOWN_SCROLL_STATE;
  }

  scrollListener.onScrollStateChanged(null /*view*/, listViewState);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:19,代碼來源:RecyclerToListViewScrollListener.java

示例3: onScrollStateChanged

@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
    super.onScrollStateChanged(recyclerView, newState);
    final RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager();
    if(!(layoutManager instanceof CustomLayoutManager)){
        mAutoSet = true;
        return;
    }

    if(!mAutoSet){
        if(newState == RecyclerView.SCROLL_STATE_IDLE){
            final int dx;
            dx = ((CustomLayoutManager)layoutManager).getOffsetCenterView();
            //Log.e(TAG, "getOffsetCenterView: " + String.valueOf(dx));
            recyclerView.smoothScrollBy(dx,0);
        }
        mAutoSet = true;
    }
    if(newState == RecyclerView.SCROLL_STATE_DRAGGING || newState == RecyclerView.SCROLL_STATE_SETTLING){
        mAutoSet = false;
    }
}
 
開發者ID:SimonCherryGZ,項目名稱:JewelryUI,代碼行數:22,代碼來源:CenterScrollListener.java

示例4: onScrollStateChanged

@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
    //Fix for bug with bottom selection bar and different month item height in horizontal mode (different count of weeks)
    View view = rvMonths.getLayoutManager().findViewByPosition(getFirstVisiblePosition(rvMonths.getLayoutManager()));
    if (view != null) {
        view.requestLayout();
    }

    if (getCalendarOrientation() == OrientationHelper.HORIZONTAL) {
        multipleSelectionBarAdapter.notifyDataSetChanged();

        //Hide navigation buttons
        boolean show = newState != RecyclerView.SCROLL_STATE_DRAGGING;
        ivPrevious.setVisibility(show ? View.VISIBLE : View.GONE);
        ivNext.setVisibility(show ? View.VISIBLE : View.GONE);
    }

    super.onScrollStateChanged(recyclerView, newState);
}
 
開發者ID:ApplikeySolutions,項目名稱:CosmoCalendar,代碼行數:19,代碼來源:CalendarView.java

示例5: onScrollStateChanged

@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
    int listViewState;
    switch (newState) {
        case RecyclerView.SCROLL_STATE_DRAGGING:
            listViewState = ListView.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL;
            break;
        case RecyclerView.SCROLL_STATE_IDLE:
            listViewState = ListView.OnScrollListener.SCROLL_STATE_IDLE;
            break;
        case RecyclerView.SCROLL_STATE_SETTLING:
            listViewState = ListView.OnScrollListener.SCROLL_STATE_FLING;
            break;
        default:
            listViewState = UNKNOWN_SCROLL_STATE;
    }
    scrollListener.onScrollStateChanged(null /*view*/, listViewState);
}
 
開發者ID:hushengjun,項目名稱:FastAndroid,代碼行數:18,代碼來源:RecyclerToListViewScrollListener.java

示例6: onScrollStateChanged

@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
    if (!disable) {
        if (newState == RecyclerView.SCROLL_STATE_DRAGGING) {
            if (isAutoDetectIdle) {
                ((Application) recyclerView.getContext().getApplicationContext())
                    .registerActivityLifecycleCallbacks(mLifecycleCallbacks);
                startDetectPage();
            }
            isDetectingFastScroll = true;
            disable = true;
        }
    }
    if (newState == RecyclerView.SCROLL_STATE_IDLE) {
        onScrollStateIdle();
    }
}
 
開發者ID:alibaba,項目名稱:Tangram-Android,代碼行數:17,代碼來源:PageDetectorSupport.java

示例7: onScrollStateChanged

@Override
public void onScrollStateChanged(int state) {
    super.onScrollStateChanged(state);
    switch (state){
        case RecyclerView.SCROLL_STATE_IDLE:
            //滾動停止時
            fixOffsetWhenFinishScroll();
            break;
        case RecyclerView.SCROLL_STATE_DRAGGING:
            //拖拽滾動時
            break;
        case RecyclerView.SCROLL_STATE_SETTLING:
            //動畫滾動時
            break;
    }
}
 
開發者ID:ChenLittlePing,項目名稱:RecyclerCoverFlow,代碼行數:16,代碼來源:CoverFlowLayoutManger.java

示例8: onScrollStateChanged

@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
    if (newState == RecyclerView.SCROLL_STATE_IDLE || newState == RecyclerView.SCROLL_STATE_DRAGGING) {
        PicassoInstance.with().resumeTag(tag);
    } else {
        PicassoInstance.with().pauseTag(tag);
    }
}
 
開發者ID:PhoenixDevTeam,項目名稱:Phoenix-for-VK,代碼行數:8,代碼來源:PicassoPauseOnScrollListener.java

示例9: onScrollStateChanged

@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
  if (newState == RecyclerView.SCROLL_STATE_DRAGGING) {
    conversationDateHeader.show();
  } else if (newState == RecyclerView.SCROLL_STATE_IDLE) {
    conversationDateHeader.hide();
  }
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:8,代碼來源:ConversationFragment.java

示例10: onScrollStateChanged

@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
    super.onScrollStateChanged(recyclerView, newState);
    if (newState == RecyclerView.SCROLL_STATE_IDLE)
    {
        mPullLoadMoreRecyclerView.onScroll(0);
    }else if(newState == RecyclerView.SCROLL_STATE_DRAGGING)
    {
        mPullLoadMoreRecyclerView.onScroll(1);
    }


}
 
開發者ID:dufangyu1990,項目名稱:JKApp,代碼行數:13,代碼來源:RecyclerViewOnScroll.java

示例11: onScrollStateChanged

@Override
public void onScrollStateChanged(int state) {
    if (state == RecyclerView.SCROLL_STATE_DRAGGING) {
        needSnap = true;
    }
    super.onScrollStateChanged(state);
}
 
開發者ID:goutham106,項目名稱:GmArchMvvm,代碼行數:7,代碼來源:VegaLayoutManager.java

示例12: onScrollStateChanged

/**
 * Hadle recyclerView scroll status
 * just to show FAB
 *
 * @param newState the new state of the recyclerView
 */
@Override
public void onScrollStateChanged(int newState) {
    if (newState != RecyclerView.SCROLL_STATE_IDLE &&
            newState != RecyclerView.SCROLL_STATE_DRAGGING) {
        view.setFABVisibility(false);
    } else {
        view.setFABVisibility(true);
    }
}
 
開發者ID:pedromassango,項目名稱:Programmers,代碼行數:15,代碼來源:MainPresenter.java

示例13: onScrollStateChanged

@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
    if (newState == RecyclerView.SCROLL_STATE_DRAGGING) {
        //開始滾動
    } else if (newState == RecyclerView.SCROLL_STATE_IDLE) {
        //結束滾動
    } else if (newState == RecyclerView.SCROLL_STATE_SETTLING) {
        //滑行中
    }
}
 
開發者ID:angcyo,項目名稱:RLibrary,代碼行數:10,代碼來源:RPagerSnapHelper.java

示例14: onScrollStateChanged

@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
    super.onScrollStateChanged(recyclerView, newState);
    scrollState = newState;
    L.w("scroll state : " + newState);

    if (newState == RecyclerView.SCROLL_STATE_IDLE) {
        onScrollEnd();
    } else if (newState == RecyclerView.SCROLL_STATE_DRAGGING) {
        isFling = false;
    } else if (newState == RecyclerView.SCROLL_STATE_SETTLING) {

    }
}
 
開發者ID:angcyo,項目名稱:RLibrary,代碼行數:14,代碼來源:ViewPagerSnapHelper.java

示例15: onScrollStateChanged

@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
    switch (newState) {
        case RecyclerView.SCROLL_STATE_DRAGGING:
            // distinct drag to improve accuracy, init mDraggingStart and mDraggingEnd here
            mDragging = true;
            final int[] range = AbstractLayoutManagerUtils.getVisibleRange(recyclerView);
            mDraggingStart = range[0];
            mDraggingEnd = range[1];
            break;
        case RecyclerView.SCROLL_STATE_SETTLING:
            mDragging = false;
            break;
        case RecyclerView.SCROLL_STATE_IDLE:
            mDragging = false;

            // perform final update on the range we have ever visited
            updateVisibleRange(recyclerView);
            AbstractLogUtils.e(this, "==>  visible range: [" + mDraggingStart + ", " + mDraggingEnd + "]");
            MeasurableRecyclerViewHelper.notifyMeasurableViewHolderDataRangeChanged(recyclerView, mDraggingStart, mDraggingEnd);

            // reset mDraggingStart and mDraggingEnd here
            mDraggingStart = RecyclerView.NO_POSITION;
            mDraggingEnd = RecyclerView.NO_POSITION;

            final boolean rtl = AbstractUIUtils.isRightToLeft(getRef());
            if (mRtl ^ rtl) {
                /*
                 * [ANDROID-1778]
                 *
                 * immediately flush the statistics if user change between a ltr and rtl language
                 * on the fly; do the check in here for better performance
                 */
                final List<IMeasurableViewHolder> holders =
                        MeasurableRecyclerViewHelper.getViewHolders(recyclerView, IMeasurableViewHolder.class);
                for (IMeasurableViewHolder holder : holders) {
                    holder.flush();
                }

                if (AbstractLayoutManagerUtils.getOrientation(recyclerView.getLayoutManager())
                        == OrientationHelper.HORIZONTAL) {
                    AbstractLayoutManagerUtils.setReverseLayout(recyclerView.getLayoutManager(), mRtl);
                }
            }
            break;
        default:
            break;
    }
}
 
開發者ID:Tenor-Inc,項目名稱:tenor-android-core,代碼行數:49,代碼來源:MeasurableOnScrollListener.java


注:本文中的android.support.v7.widget.RecyclerView.SCROLL_STATE_DRAGGING屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。