Customize a user's channel list view to suit your service's needs. You can customize the channel list screen by adding or removing buttons, changing the layout, or modifying the UI components.
This guide demonstrates how to customize the header of the channel list screen. The header consists of a title and two buttons on the left and right sides. You can customize the header by showing or hiding the buttons, changing the button icons, changing the button text, and changing the font.
The channel list header can be customized on the global level. These settings will apply to all channel list views.
By setting up the ChannelListFragment.Builder() within the ChannelListFragmentProvider in the BaseApplication.kt, you're defining global settings that apply to all instances of ChannelListFragment across the app. This approach ensures that your preference will be uniformly applied across all users and instances where a ChannelListFragment is used.
Once you change the button from being an icon to text, reset onClickListener. To do so, create a custom header component by extending the HeaderComponent class and override the onCreateView method. Then set it to the BaseApplication class.
ChannelListHeaderComponentBaseApplication.kt
class ChannelListHeaderComponent : HeaderComponent() {
override fun onCreateView(context: Context, inflater: LayoutInflater, parent: ViewGroup, args: Bundle?): View {
val headerView = inflater.inflate(R.layout.view_channel_list_header, parent, false)
// TODO : headerView initialization
val rightButton = headerView.findViewById<TextView>(R.id.rightButton)
rightButton.setOnClickListener { onRightButtonClicked(rightButton) }
return headerView
}
}