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

Commit

Permalink
Add a getItem method to FileItemAdapter
Browse files Browse the repository at this point in the history
And make its field protected.
  • Loading branch information
spacecowboy committed Jun 8, 2016
1 parent 34f4768 commit 9479728
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
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 9479728

Please sign in to comment.