Java Code Examples for android.support.v7.widget.RecyclerView#ViewHolder
The following examples show how to use
android.support.v7.widget.RecyclerView#ViewHolder .
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: TaskListAdapter.java From AssistantBySDK with Apache License 2.0 | 6 votes |
@Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { RecyclerView.ViewHolder holder; View item; if (viewType == HEADER_VIEW) { item = mInflater.inflate(R.layout.item_list_header, parent, false); holder = new headerHolder(item); } else { TaskCard taskCard = mdatas.get(0); if (taskCard.t instanceof Remind) { item = mInflater.inflate(R.layout.item_remindlist_view, null, false); holder = new RemindListHolder(item); } else if (taskCard.t instanceof AlarmClock) { item = mInflater.inflate(R.layout.item_alarmlist_view, null, false); holder = new AlarmListHolder(item); } else if (taskCard.t instanceof Memo) { item = mInflater.inflate(R.layout.item_memolist_view, null, false); holder = new MemoListHolder(item); } else { item = mInflater.inflate(R.layout.item_accountlist_view, null, false); holder = new AccountListHolder(item); } } return holder; }
Example 2
Source File: HeaderAndFooterWrapper.java From styT with Apache License 2.0 | 5 votes |
@Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { if (isHeaderType(viewType)) { return onCreateHeaderViewHolder(parent, viewType); } else if (isFooterType(viewType)) { return onCreateFooterViewHolder(parent, viewType); } return onCreateGeneralViewHolder(parent, viewType); }
Example 3
Source File: DefaultItemAnimator.java From PowerRecyclerView with Apache License 2.0 | 5 votes |
MoveInfo(RecyclerView.ViewHolder holder, int fromX, int fromY, int toX, int toY) { this.holder = holder; this.fromX = fromX; this.fromY = fromY; this.toX = toX; this.toY = toY; }
Example 4
Source File: TreeViewAdapter.java From RecyclerTreeView with Apache License 2.0 | 5 votes |
@Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View v = LayoutInflater.from(parent.getContext()) .inflate(viewType, parent, false); if (viewBinders.size() == 1) return viewBinders.get(0).provideViewHolder(v); for (TreeViewBinder viewBinder : viewBinders) { if (viewBinder.getLayoutId() == viewType) return viewBinder.provideViewHolder(v); } return viewBinders.get(0).provideViewHolder(v); }
Example 5
Source File: StickyHeadersItemDecoration.java From UltimateAndroid with Apache License 2.0 | 5 votes |
@Override public void onItemRangeInserted(int positionStart, int itemCount) { RecyclerView.ViewHolder holder = parent.findViewHolderForPosition(positionStart); if (holder != null) { headers.put(holder.getItemId(), null); } else { cleanOffScreenItemsIds(); } }
Example 6
Source File: AppDetailsAdapterTest.java From fdroidclient with GNU General Public License v3.0 | 5 votes |
/** * Ensures that every single item in the adapter gets its view holder created and bound. * Doesn't care about what type of holder it should be, the adapter is able to figure all that * out for us . */ private void populateViewHolders(RecyclerView.Adapter<RecyclerView.ViewHolder> adapter) { ViewGroup parent = (ViewGroup) LayoutInflater.from(context).inflate(R.layout.app_details2_links, null); for (int i = 0; i < adapter.getItemCount(); i++) { RecyclerView.ViewHolder viewHolder = adapter.createViewHolder(parent, adapter.getItemViewType(i)); adapter.bindViewHolder(viewHolder, i); } }
Example 7
Source File: DragonBallAdapter.java From HeaderRecyclerView with Apache License 2.0 | 4 votes |
@Override protected void onHeaderViewRecycled(RecyclerView.ViewHolder holder) { Log.v(LOG_TAG, "onHeaderViewRecycled(RecyclerView.ViewHolder holder)"); }
Example 8
Source File: SwipeToDismissHelper.java From SimpleRecyclerView with Apache License 2.0 | 4 votes |
@Override public void onStartDrag(RecyclerView.ViewHolder viewHolder) { startDrag(viewHolder); }
Example 9
Source File: SimpleItemTouchHelperCallback.java From ankihelper with GNU General Public License v3.0 | 4 votes |
@Override public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder source, RecyclerView.ViewHolder target) { mAdapter.onItemMove(source.getAdapterPosition(), target.getAdapterPosition()); return true; }
Example 10
Source File: SwipeToDismissItemCallback.java From SimpleRecyclerView with Apache License 2.0 | 4 votes |
@Override public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder target) { // no-op return false; }
Example 11
Source File: MyAdapter.java From HeaderFooterRecyclerView with Apache License 2.0 | 4 votes |
@Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View v = View.inflate(parent.getContext(), R.layout.adapter_list_item, null); return new HomeFragmentViewHolder(v); }
Example 12
Source File: ReplyCheckerAdapter.java From Ouroboros with GNU General Public License v3.0 | 4 votes |
@Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { return new ReplyCheckerViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.reply_checker_list_item, parent, false)); }
Example 13
Source File: SuperSelectableAdapter.java From FancyAdapters with MIT License | 4 votes |
@Override public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { return makeMovementFlags(dragFlags, swipeFlags); }
Example 14
Source File: EndlessAdapter.java From Expert-Android-Programming with MIT License | 4 votes |
@Override public RecyclerView.ViewHolder onCreateFooterViewHolder(LayoutInflater inflater, ViewGroup parent, int index) { return onCreateEndlessLoadingViewHolder(inflater, parent); }
Example 15
Source File: MainActivity.java From FloatingSearchView with Apache License 2.0 | 4 votes |
@Override public boolean animateMove(RecyclerView.ViewHolder holder, int fromX, int fromY, int toX, int toY) { dispatchMoveFinished(holder); return false; }
Example 16
Source File: MyAnimationUtils.java From Airbnb-Android-Google-Map-View with MIT License | 3 votes |
private static void slidingWithBounce(RecyclerView.ViewHolder holder, boolean goesDown){ AnimatorSet animatorSet = new AnimatorSet(); ObjectAnimator animatorTranslateY = ObjectAnimator.ofFloat(holder.itemView, "translationY", goesDown? 200 : -200, 0); ObjectAnimator animatorTranslateX = ObjectAnimator.ofFloat(holder.itemView,"translationX",-30,30,-20,20,-5,5,0); animatorTranslateX.setDuration(1000); animatorTranslateY.setDuration(1000); animatorSet.playTogether ( animatorTranslateX, animatorTranslateY); animatorSet.start(); }
Example 17
Source File: CollectionViewCallbacks.java From timecat with Apache License 2.0 | 2 votes |
/** * Binds the given data with the given collection item View. */ void bindCollectionItemView(Context context, RecyclerView.ViewHolder holder, int groupOrdinal, T2 item);
Example 18
Source File: KeyboardAdapter.java From AndroidFrame with Apache License 2.0 | votes |
void onKeyClick(View view, RecyclerView.ViewHolder holder, int position);
Example 19
Source File: RecyclerViewAdapter.java From FileManager with Apache License 2.0 | votes |
void onItemClick(View view, RecyclerView.ViewHolder viewHolder , int position);
Example 20
Source File: BaseItemAnimator.java From UltimateAndroid with Apache License 2.0 | votes |
protected abstract void prepareAnimateAdd(final RecyclerView.ViewHolder holder);