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


Java RecyclerView.Adapter方法代碼示例

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


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

示例1: onAdapterChanged

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public void onAdapterChanged(RecyclerView.Adapter oldAdapter,
                             RecyclerView.Adapter newAdapter) {
    if (oldAdapter != null && measureSupporter.isRegistered()) {
        try {
            measureSupporter.setRegistered(false);
            oldAdapter.unregisterAdapterDataObserver((RecyclerView.AdapterDataObserver) measureSupporter);
        } catch (IllegalStateException e) {
            //skip unregister errors
        }
    }
    if (newAdapter != null) {
        measureSupporter.setRegistered(true);
        newAdapter.registerAdapterDataObserver((RecyclerView.AdapterDataObserver) measureSupporter);
    }
    //Completely scrap the existing layout
    removeAllViews();
}
 
開發者ID:sathishmscict,項目名稱:ChipsLayoutManager,代碼行數:22,代碼來源:ChipsLayoutManager.java

示例2: onScrolled

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
    final int childCount = recyclerView.getChildCount();
    if (childCount > 0) {
        View lastChild = recyclerView.getChildAt(childCount - 1);
        RecyclerView.Adapter outerAdapter = recyclerView.getAdapter();
        int lastVisible = recyclerView.getChildAdapterPosition(lastChild);
        if (lastVisible == outerAdapter.getItemCount() - 1 && hasNextPage() && canLoadNextPage()) {
            onLoadNextPage();
        }
    }
}
 
開發者ID:devzwy,項目名稱:NeiHanDuanZiTV,代碼行數:13,代碼來源:BoxingBottomSheetFragment.java

示例3: HeaderViewRecyclerAdapter

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
public HeaderViewRecyclerAdapter(RecyclerView.Adapter adapter) {

        mHeaderViews = new ArrayList<>();
        mFooterViews = new ArrayList<>();
        mItemTypesOffset = new HashMap<>();
        setWrappedAdapter(adapter);
    }
 
開發者ID:HotBitmapGG,項目名稱:Acg,代碼行數:8,代碼來源:HeaderViewRecyclerAdapter.java

示例4: initRecyclerViewH

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
/**
 * 配置水平列表RecyclerView
 * @param view
 */
public static void initRecyclerViewH(Context context, RecyclerView view, boolean isDivided,
                                     RecyclerView.Adapter adapter) {
    LinearLayoutManager layoutManager = new LinearLayoutManager(context);
    layoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
    view.setLayoutManager(layoutManager);
    view.setItemAnimator(new DefaultItemAnimator());
    if (isDivided) {
        view.addItemDecoration(new DividerItemDecoration(context, DividerItemDecoration.HORIZONTAL_LIST));
    }
    view.setAdapter(adapter);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:16,代碼來源:RecyclerViewHelper.java

示例5: dispatchUpdateTo

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
public void dispatchUpdateTo(@NonNull RecyclerView.Adapter adapter) {
	if(mType == Type.ADDED)
		adapter.notifyItemInserted(mNewPosition);
	if(mType == Type.MOVED)
		adapter.notifyItemMoved(mOldPosition, mNewPosition);
	if(mType == Type.NEW_LIST || mType == Type.NEW_LIST_FROM_CACHE)
		adapter.notifyDataSetChanged();
	if(mType == Type.REMOVED)
		adapter.notifyItemRemoved(mOldPosition);
	if(mType == Type.UPDATED)
		adapter.notifyItemChanged(mOldPosition);
}
 
開發者ID:rapid-io,項目名稱:rapid-io-android,代碼行數:13,代碼來源:ListUpdate.java

示例6: test_findFirstCompletelyVisibleItem

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Test
public void test_findFirstCompletelyVisibleItem() {
    RecyclerView.Adapter adapter = AdapterBuilder.newBuilder(mActivity).build();
    // Utils.setupLayoutTest(null, adapter, mLayoutManager, mRecyclerView);

    Assert.assertEquals(0, mLayoutManager.findFirstCompletelyVisibleItemPosition());
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:8,代碼來源:LinearLayoutHelperTest.java

示例7: setAdapter

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
public void setAdapter(RecyclerView.Adapter adapter) {

    if (mWrappedAdapter != null && mWrappedAdapter.getItemCount() > 0) {
      notifyItemRangeRemoved(getHeaderCount(), mWrappedAdapter.getItemCount());
    }
    setWrappedAdapter(adapter);
    notifyItemRangeInserted(getHeaderCount(), mWrappedAdapter.getItemCount());
  }
 
開發者ID:MUFCRyan,項目名稱:BilibiliClient,代碼行數:9,代碼來源:HeaderViewRecyclerAdapter.java

示例8: build

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
public RecyclerView.Adapter build() {
    return null;
}
 
開發者ID:alibaba,項目名稱:vlayout,代碼行數:4,代碼來源:AdapterBuilder.java

示例9: getOriginalAdapter

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
public RecyclerView.Adapter getOriginalAdapter() {
    return this.adapter;
}
 
開發者ID:Mrqinlei,項目名稱:ImitateZHRB,代碼行數:4,代碼來源:XRecyclerView.java

示例10: getAdapter

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
public RecyclerView.Adapter getAdapter() {
    return mAdapter;
}
 
開發者ID:mirrajabi,項目名稱:search-dialog,代碼行數:4,代碼來源:BaseSearchDialogCompat.java

示例11: getWrappedAdapter

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
public RecyclerView.Adapter getWrappedAdapter() {
    return wrapped;
}
 
開發者ID:7763sea,項目名稱:VirtualHook,代碼行數:4,代碼來源:RecyclerViewAdapterWrapper.java

示例12: getAdapter

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
protected RecyclerView.Adapter getAdapter() {
    mAdapter = new EventAdapter();
    return mAdapter;
}
 
開發者ID:CactusSoft,項目名稱:zabbkit-android,代碼行數:6,代碼來源:EventFragment.java

示例13: addAdapter

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
public void addAdapter(RecyclerView.Adapter adapter) {
  addAdapter(adapter, true);
}
 
開發者ID:PacktPublishing,項目名稱:Expert-Android-Programming,代碼行數:4,代碼來源:MergeAdapter.java

示例14: setAdapterData

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
void setAdapterData(RecyclerView.Adapter adapter, List<Video> data) {
    ((VideosAdapter)adapter).setData(data);
}
 
開發者ID:PhoenixDevTeam,項目名稱:Phoenix-for-VK,代碼行數:5,代碼來源:VideoSearchFragment.java

示例15: LoadMoreWrapper

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
public LoadMoreWrapper(RecyclerView.Adapter adapter)
{
    mInnerAdapter = adapter;
}
 
開發者ID:codeccc,項目名稱:baselibrary-master,代碼行數:5,代碼來源:LoadMoreWrapper.java


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