Created
April 18, 2017 04:30
-
-
Save Firsto/38f735973db60207a939014fc75c1e8c to your computer and use it in GitHub Desktop.
Endless-like loop fast adapter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BuildingImageAdapter extends FastItemAdapter<BuildingImageItem> { | |
@Override | |
public int getAdapterItemCount() { | |
return Integer.MAX_VALUE; | |
} | |
@Override | |
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { | |
position = position % getItemAdapter().getAdapterItems().size(); | |
super.onBindViewHolder(holder, position); | |
} | |
@Override | |
public int getItemViewType(int position) { | |
position = position % getItemAdapter().getAdapterItems().size(); | |
return super.getItemViewType(position); | |
} | |
@Override | |
public long getItemId(int position) { | |
position = position % getItemAdapter().getAdapterItems().size(); | |
return getItem(position).getIdentifier(); | |
} | |
@Override | |
public int getItemCount() { | |
return Integer.MAX_VALUE; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment