I want the RecyclerView to dynamically change when the list is altered.
The view is recomposed based on the AndroidView.update expression. However nothing I have tried works. I am not familiar with RecyclerViews and I think that is the issue.
Any ideas?
AndroidView(
factory = {
// Logic for inflating a RecyclerView in a normal Android View System
val view = LayoutInflater.from(it)
.inflate(R.layout.edit_list_xml_screen_layout, null, false)
val recyclerView = view.findViewById<RecyclerView>(R.id.taskListRV)
recyclerView.layoutManager = LinearLayoutManager(it)
val adapter = TaskRecyclerViewAdaptor(it, taskList)
// adapter.setClickListener()
recyclerView.adapter = adapter
recyclerView.addItemDecoration(
DividerItemDecoration(
it,
DividerItemDecoration.VERTICAL
)
)
recyclerView // Return recyclerView
},
update = {
/* TODO dynamically update recycler view */
}
Bonus points if someone can tell me what argument to add to adapter.setClickListener()