Implement search state, action and view events.

This commit is contained in:
Onuray Sahin 2020-09-24 10:21:26 +03:00 committed by Benoit Marty
parent 6c6d0dbc3d
commit 5e56e7cf82
3 changed files with 17 additions and 3 deletions

View file

@ -18,4 +18,8 @@ package im.vector.app.features.home.room.detail.search
import im.vector.app.core.platform.VectorViewModelAction
sealed class SearchAction : VectorViewModelAction
sealed class SearchAction : VectorViewModelAction {
data class SearchWith(val roomId: String, val searchTerm: String) : SearchAction()
object ScrolledToTop : SearchAction()
object Retry : SearchAction()
}

View file

@ -18,4 +18,7 @@ package im.vector.app.features.home.room.detail.search
import im.vector.app.core.platform.VectorViewEvents
sealed class SearchViewEvents : VectorViewEvents
sealed class SearchViewEvents : VectorViewEvents {
data class Failure(val throwable: Throwable) : SearchViewEvents()
data class Loading(val message: CharSequence? = null) : SearchViewEvents()
}

View file

@ -17,7 +17,14 @@
package im.vector.app.features.home.room.detail.search
import com.airbnb.mvrx.MvRxState
import org.matrix.android.sdk.api.session.search.SearchResult
data class SearchViewState(
val searchTerm: String = ""
// Accumulated search result
val searchResult: SearchResult? = null,
// Last batch result will help RecyclerView to position itself
val lastBatch: SearchResult? = null,
val searchTerm: String? = null,
val roomId: String? = null,
val isNextBatch: Boolean = false
) : MvRxState