Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,25 @@ public SeparatedRecyclerViewAdapter(int textViewId) {
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
if(viewType == HEADER){
// For headers, we can create a simple text holder.
TextView view = (TextView) LayoutInflater.from(viewGroup.getContext())
.inflate(textViewId, viewGroup, false);
return new SimpleTextViewHolder(view);
} else {
RecyclerView.ViewHolder result = null;
while(result == null){
for(RecyclerView.Adapter sectionAdapter : sections.values()){
try {
result = sectionAdapter.onCreateViewHolder(viewGroup, viewType);
} catch(Exception e){
e.printStackTrace();
}
// For puzzle views, any sectionAdapter can be used to create the view holder, so find
// the first one that gives us a result.
for(RecyclerView.Adapter sectionAdapter : sections.values()){
RecyclerView.ViewHolder result = null;
try {
result = sectionAdapter.onCreateViewHolder(viewGroup, viewType);
} catch(Exception e){
e.printStackTrace();
}
if (result != null) {
return result;
}
}
return result;
return null;
}
}

Expand Down