Last active
August 29, 2017 20:22
-
-
Save jifferon/3fce9b376359cc9787f0162c7bf0d195 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
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseHolder { | |
val inflater = LayoutInflater.from(parent.context) | |
val itemView: View | |
val dataHolder: BaseHolder = when(viewType) { | |
Type.NORMAL.value -> { | |
itemView = inflater.inflate(normalCellLayout, parent, false) | |
NormalGoodHolder(itemView, callback) | |
} | |
Type.SALE.value -> { | |
itemView = inflater.inflate(saleCellLayout, parent, false) | |
SaleGoodHolder(itemView, callback) | |
} | |
else -> { | |
throw IllegalStateException("Something went horribly wrong") | |
} | |
} | |
return dataHolder | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment