Created
September 21, 2018 06:37
-
-
Save keinix/8a9201d1ec7d5fafd6d22fde049afd5c to your computer and use it in GitHub Desktop.
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
@NonNull | |
@Override | |
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { | |
View itemView; | |
switch (viewType) { | |
case Literature.TYPE_BOOK: | |
itemView = LayoutInflater.from(parent.getContext()) | |
.inflate(R.layout.your_layout, parent, false); | |
return new BookViewHolder(itemView); | |
case Literature.TYPE_MAGAZINE: | |
itemView = LayoutInflater.from(parent.getContext()) | |
.inflate(R.layout.your_layout, parent, false); | |
return new MagazineViewHolder(itemView); | |
default: // TYPE_NEWSPAPER | |
itemView = LayoutInflater.from(parent.getContext()) | |
.inflate(R.layout.your_layout, parent, false); | |
return new NewspaperViewHolder(itemView); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment