Fix concat adapter stable Ids

This commit is contained in:
valere 2023-01-31 14:57:33 +01:00
parent 98f1c6d87f
commit b10a27d4dd

View file

@ -23,6 +23,7 @@ import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.ConcatAdapter import androidx.recyclerview.widget.ConcatAdapter
import androidx.recyclerview.widget.ConcatAdapter.Config.StableIdMode
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import com.airbnb.epoxy.OnModelBuildFinishedListener import com.airbnb.epoxy.OnModelBuildFinishedListener
import com.airbnb.mvrx.fragmentViewModel import com.airbnb.mvrx.fragmentViewModel
@ -64,7 +65,12 @@ class HomeRoomListFragment :
private val roomListViewModel: HomeRoomListViewModel by fragmentViewModel() private val roomListViewModel: HomeRoomListViewModel by fragmentViewModel()
private lateinit var sharedQuickActionsViewModel: RoomListQuickActionsSharedActionViewModel private lateinit var sharedQuickActionsViewModel: RoomListQuickActionsSharedActionViewModel
private var concatAdapter = ConcatAdapter() private var concatAdapter = ConcatAdapter(
ConcatAdapter.Config.Builder()
.setIsolateViewTypes(true)
.setStableIdMode(StableIdMode.ISOLATED_STABLE_IDS).build(),
emptyList()
)
private lateinit var firstItemObserver: FirstItemUpdatedObserver private lateinit var firstItemObserver: FirstItemUpdatedObserver
private var modelBuildListener: OnModelBuildFinishedListener? = null private var modelBuildListener: OnModelBuildFinishedListener? = null