I have 2 recycler views and one text view. What I am trying to do is when I click from top recyclerview(recyclerViewNotClickedItems) the items, they will disappear and they will appear in the bottom recyclerview(recyclerViewClickedItems).
My problem is that the TextView I have, I want it to go more up and up as I am clicking items from first recyclerview and they dissapear , and in the end since there are no items, the text view should be on the top of the screen.
Here is my code:
<RecyclerView
android:id="@+id/recyclerViewNotClickedItems"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toTopOf="@+id/settingsYouAlreadySeeTxt" />
<TextView
android:id="@+id/settingsYouAlreadySeeTxt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/settings_you_already_seen"
android:textSize="40sp"
android:visibility="invisible"
app:layout_constraintStart_toStartOf="@+id/recyclerViewNotClickedItems"
app:layout_constraintTop_toBottomOf="@+id/recyclerViewNotClickedItems">
</TextView>
<RecyclerView
android:id="@+id/recyclerViewClickedItems"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintTop_toBottomOf="@+id/settingsYouAlreadySeeTxt"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent" />
And here is the implemented logic
adapterCheckedList = RecyclerViewListAdapter()
adapterNotCheckedList = RecyclerViewListAdapter(clickListener = { view: View, listItem: Any, position: Int ->
binding.settingsYouAlreadySeeTxt.visibility = View.VISIBLE //Here, besides visibility i want to move it to the top everytime unCheckedList gets smaller.
val removedItem =unCheckedList.removeAt(position)
checkedList.add(removedItem)
adapterNotCheckedList.submitList(unCheckedList)
adapterCheckedList.submitList(removedItem)
})