Created
May 1, 2020 13:03
-
-
Save baggednismo/9bed0d2167e336fb024e1c2528a1b588 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
class ParentItemsViewHolder(inflater: LayoutInflater, parent: ViewGroup, itemListener: ItemListener) : | |
RecyclerView.ViewHolder(inflater.inflate(R.layout.card_parent_item, parent, false)) { | |
private var itemListener: ItemListener? = null | |
private var cardTitle: TextView? = null | |
private var recyclerItem: RecyclerView? = null | |
init { | |
cardTitle = itemView.findViewById(R.id.app_title) | |
recyclerItem = itemView.findViewById(R.id.id_card_child_items) | |
this.itemListener = itemListener | |
} | |
fun bind(card: ParentItemModel) { | |
cardTitle?.setText("App: ${card.app_package}") | |
recyclerItem?.apply { | |
layoutManager = LinearLayoutManager(context) | |
val itemDecoration = DividerItemDecoration(context, LinearLayoutManager.VERTICAL) | |
itemDecoration.setDrawable(context.getDrawable(R.drawable.divider_thin)!!) | |
addItemDecoration(itemDecoration) | |
adapter = ChildItemsAdapter(card.errors, itemListener!!) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment