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 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 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 package im.vector.app.features.home.room.detail.search
import com.airbnb.mvrx.MvRxState import com.airbnb.mvrx.MvRxState
import org.matrix.android.sdk.api.session.search.SearchResult
data class SearchViewState( 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 ) : MvRxState