Skip to content
This repository has been archived by the owner on Feb 11, 2022. It is now read-only.

Commit

Permalink
Merge pull request #88 from spacecowboy/adapterfixes
Browse files Browse the repository at this point in the history
Add a getItem method to FileItemAdapter
  • Loading branch information
spacecowboy committed Jun 8, 2016
2 parents 34f4768 + 9479728 commit 2dff306
Showing 1 changed file with 15 additions and 2 deletions.
Expand Up @@ -18,8 +18,8 @@
*/
public class FileItemAdapter<T> extends RecyclerView.Adapter<RecyclerView.ViewHolder> {

private final LogicHandler<T> mLogic;
private SortedList<T> mList = null;
protected final LogicHandler<T> mLogic;
protected SortedList<T> mList = null;

public FileItemAdapter(@NonNull LogicHandler<T> logic) {
this.mLogic = logic;
Expand Down Expand Up @@ -65,4 +65,17 @@ public int getItemCount() {
// header + count
return 1 + mList.size();
}

/**
* Get the item at the designated position in the adapter.
*
* @param position of item in adapter
* @return null if position is zero (that means it's the ".." header), the item otherwise.
*/
protected @Nullable T getItem(int position) {
if (position == 0) {
return null;
}
return mList.get(position - 1);
}
}

0 comments on commit 2dff306

Please sign in to comment.