Class SearchViewModel

  • All Implemented Interfaces:

    
    public final class SearchViewModel
    extends ViewModel
                        

    ViewModel responsible for searching for messages that match a particular search query.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      public final class SearchViewModel.State

      Represents the search screen state, used to render the required UI.

    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final LiveData<SearchViewModel.State> getState() The current state of the search screen.
      final LiveData<Event<Unit>> getErrorEvents() One shot error events when search fails.
      final Unit setQuery(String query) Changes the current query state.
      final Unit loadMore() Loads more data when the user reaches the end of the found message list.
      • Methods inherited from class androidx.lifecycle.ViewModel

        addCloseable
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SearchViewModel

        SearchViewModel()
    • Method Detail

      • setQuery

         final Unit setQuery(String query)

        Changes the current query state. An empty search query

      • loadMore

         final Unit loadMore()

        Loads more data when the user reaches the end of the found message list.

        Does nothing of the end of the search result list has already been reached or loading is already in progress.