Channel members are able to search for messages with keywords using
MessageSearchFragment. When the user taps Search in the group channel settings screen, the message search screen appears. Once the user enters a keyword into the search bar, a list of messages that contains the search query is retrieved.
Message search screen
A message search screen is composed of three components: header, message search list, and search status.
The view of the header component is created and customized in the
MessageSearchHeaderComponent of the
MessageSearchHeaderComponent refers to the search bar.
Message search list
The message search list component shows a list of messages that contains the keyword from all group channels joined by the current user. The view of the message search list is created and customized in the
MessageSearchListComponent of the
MessageSearchModule. You can also customize each item in the list view using using
The search status component shows the result of the data request for a message search list. The
StatusComponent exists in the
MessageSearchModule and lets the user know if the list is loading or if the list could not be called.
UIKit for Android provides both activity and fragment to create a message search screen. You can choose which one to build your app with and you may solely use activity instead of fragment if you wish to. You can build a message search screen through
MessageSearchActivity, which uses
UIKitFragmentFactory to create views.
Start an activity
You can start an activity by using
intent to move from one activity to
MessageSearchActivity as shown below:
Create a fragment
MessageSearchActivity allows you to create a basic
UIKitFragmentFactory has a set of methods that build each fragment, whereas the builder class provides APIs to customize the UI of the data and event handlers used in
MessageSearchFragment. To see all APIs of
MessageSearchFragment.Builder, refer to the API reference page.
Note: To use UIKit's fragments as a nested fragment, refer to the Android Developer Documentation's Nested Fragments.
In the search messages key function, you can customize
MessageSearchFragment to change different parts of the screen. The
MessageSearchFragment.Builder class allows you to create and customize the basic
MessageSearchFragment that UIKit provides but you can only change its own APIs, such as setting a layout. If you wish to customize the fragment beyond using the APIs provided in the builder, you must inherit new customization methods.
The following table shows the main classes used in
MessageSearchFragment to display and customize the message search screen.
Depending on the UI or the feature you wish to customize in the fragment, you can change the classes mentioned in the table. To learn how to customize the fragment, follow the links to Customization listed below:
- Customize the layout of the view
- Customize style of the view
- Bind event handlers to the view
- Add new APIs to the fragment
- Update or change an item in a list
Note: The links to the above customization pages provide an example of how to customize classes related to
ChannelFragment. In order to make changes to the message search screen, you must use the correct classes.