diff --git a/vector/src/main/java/im/vector/riotx/features/autocomplete/EpoxyAutocompletePresenter.kt b/vector/src/main/java/im/vector/riotx/features/autocomplete/EpoxyAutocompletePresenter.kt index 227f1b2f9c..0862fc059f 100644 --- a/vector/src/main/java/im/vector/riotx/features/autocomplete/EpoxyAutocompletePresenter.kt +++ b/vector/src/main/java/im/vector/riotx/features/autocomplete/EpoxyAutocompletePresenter.kt @@ -19,18 +19,18 @@ package im.vector.riotx.features.autocomplete import android.content.Context import android.database.DataSetObserver import android.view.ViewGroup +import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import com.airbnb.epoxy.EpoxyController -import com.airbnb.epoxy.EpoxyRecyclerView import com.otaliastudios.autocomplete.AutocompletePresenter abstract class EpoxyAutocompletePresenter(context: Context) : AutocompletePresenter(context), AutocompleteClickListener { - private var recyclerView: EpoxyRecyclerView? = null - private var clicks: AutocompletePresenter.ClickProvider? = null + private var recyclerView: RecyclerView? = null + private var clicks: ClickProvider? = null private var observer: Observer? = null - override fun registerClickProvider(provider: AutocompletePresenter.ClickProvider) { + override fun registerClickProvider(provider: ClickProvider) { this.clicks = provider } @@ -39,8 +39,10 @@ abstract class EpoxyAutocompletePresenter(context: Context) : AutocompletePre } override fun getView(): ViewGroup? { - recyclerView = EpoxyRecyclerView(context).apply { - setController(providesController()) + recyclerView = RecyclerView(context).apply { + layoutManager = LinearLayoutManager(context) + setHasFixedSize(false) + adapter = providesController().adapter observer?.let { adapter?.registerAdapterDataObserver(it) } @@ -52,6 +54,7 @@ abstract class EpoxyAutocompletePresenter(context: Context) : AutocompletePre override fun onViewShown() {} override fun onViewHidden() { + recyclerView?.adapter = null recyclerView = null observer = null }