Implement search state, action and view events.
This commit is contained in:
parent
6c6d0dbc3d
commit
5e56e7cf82
|
@ -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()
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue