Java Code Examples for androidx.recyclerview.widget.RecyclerView#findViewHolderForLayoutPosition()
The following examples show how to use
androidx.recyclerview.widget.RecyclerView#findViewHolderForLayoutPosition() .
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: DownloadCardsTutorial.java From Aria2App with GNU General Public License v3.0 | 7 votes |
public boolean buildSequence(@NonNull RecyclerView list) { LinearLayoutManager llm = (LinearLayoutManager) list.getLayoutManager(); if (llm == null) return false; int pos = llm.findFirstCompletelyVisibleItemPosition(); if (pos == -1) pos = 0; DownloadCardsAdapter.ViewHolder holder = (DownloadCardsAdapter.ViewHolder) list.findViewHolderForLayoutPosition(pos); if (holder != null) { list.scrollToPosition(pos); add(forView(holder.donutProgress, R.string.tutorial_moreDetails) .fitSystemWindows(true) .focusShape(FocusShape.CIRCLE) .enableAutoTextPosition()); add(forView(holder.more, R.string.tutorial_evenMoreDetails) .fitSystemWindows(true) .focusShape(FocusShape.ROUNDED_RECTANGLE) .roundRectRadius(8) .enableAutoTextPosition()); return true; } return false; }
Example 2
Source File: PeersServersTutorial.java From Aria2App with GNU General Public License v3.0 | 5 votes |
public final boolean buildForServers(@NonNull RecyclerView list) { RecyclerView.ViewHolder holder = list.findViewHolderForLayoutPosition(0); if (holder != null) { list.scrollToPosition(0); add(forView(holder.itemView, R.string.tutorial_serverDetails) .enableAutoTextPosition() .roundRectRadius(8) .focusShape(FocusShape.ROUNDED_RECTANGLE)); return true; } return false; }
Example 3
Source File: PeersServersTutorial.java From Aria2App with GNU General Public License v3.0 | 5 votes |
public final boolean buildForPeers(@NonNull RecyclerView list) { RecyclerView.ViewHolder holder = list.findViewHolderForLayoutPosition(0); if (holder != null) { list.scrollToPosition(0); add(forView(holder.itemView, R.string.tutorial_peerDetails) .enableAutoTextPosition() .roundRectRadius(8) .focusShape(FocusShape.ROUNDED_RECTANGLE)); return true; } return false; }
Example 4
Source File: FilesTutorial.java From Aria2App with GNU General Public License v3.0 | 5 votes |
public final boolean buildSequence(@NonNull RecyclerView list, @Nullable AriaDirectory dir) { int firstFile = dir == null ? 0 : dir.dirs.size(); RecyclerView.ViewHolder holder = list.findViewHolderForLayoutPosition(firstFile); if (holder != null) { list.scrollToPosition(firstFile); add(forView(holder.itemView, R.string.tutorial_fileDetails) .enableAutoTextPosition() .roundRectRadius(8) .focusShape(FocusShape.ROUNDED_RECTANGLE)); return true; } return false; }
Example 5
Source File: FoldersTutorial.java From Aria2App with GNU General Public License v3.0 | 5 votes |
public final boolean buildSequence(@NonNull RecyclerView list) { RecyclerView.ViewHolder holder = list.findViewHolderForLayoutPosition(0); if (holder != null) { list.scrollToPosition(0); add(forView(holder.itemView, R.string.tutorial_folderDetails) .enableAutoTextPosition() .roundRectRadius(8) .focusShape(FocusShape.ROUNDED_RECTANGLE)); return true; } return false; }
Example 6
Source File: GamesTutorial.java From PretendYoureXyzzyAndroid with GNU General Public License v3.0 | 5 votes |
public final boolean buildSequence(@NonNull View createGame, @NonNull RecyclerView list) { LinearLayoutManager llm = (LinearLayoutManager) list.getLayoutManager(); if (llm == null) return false; int pos = llm.findFirstVisibleItemPosition(); if (pos == -1) return false; GamesAdapter.ViewHolder holder = (GamesAdapter.ViewHolder) list.findViewHolderForLayoutPosition(pos); if (holder != null) { add(forView(holder.status, R.string.tutorial_gameStatus) .focusShape(FocusShape.CIRCLE) .enableAutoTextPosition() .fitSystemWindows(true)); add(forView(holder.locked, R.string.tutorial_gameLocked) .focusShape(FocusShape.CIRCLE) .enableAutoTextPosition() .fitSystemWindows(true)); add(forView(holder.spectate, R.string.tutorial_spectateGame) .focusShape(FocusShape.ROUNDED_RECTANGLE) .roundRectRadius(8) .enableAutoTextPosition() .fitSystemWindows(true)); add(forView(holder.join, R.string.tutorial_joinGame) .focusShape(FocusShape.ROUNDED_RECTANGLE) .roundRectRadius(8) .enableAutoTextPosition() .fitSystemWindows(true)); add(forView(createGame, R.string.tutorial_createGame) .focusShape(FocusShape.CIRCLE) .enableAutoTextPosition() .fitSystemWindows(true)); return true; } return false; }
Example 7
Source File: BaseQuickAdapter.java From BaseProject with Apache License 2.0 | 5 votes |
@Nullable public View getViewByPosition(RecyclerView recyclerView, int position, @IdRes int viewId) { if (recyclerView == null) { return null; } BaseViewHolder viewHolder = (BaseViewHolder) recyclerView.findViewHolderForLayoutPosition(position); if (viewHolder == null) { return null; } return viewHolder.getView(viewId); }
Example 8
Source File: FromRecyclerViewListener.java From GestureViews with Apache License 2.0 | 4 votes |
@Override boolean isShownInList(RecyclerView list, int pos) { return list.findViewHolderForLayoutPosition(pos) != null; }