The channel settings view can be largely divided into to sections: a header with a title and buttons and a body that contains menu items. Here, we will focus on customizing the header through FragmentProviders.channelSettings in BaseApplication.kt. Through its setters, you can customize the header to show or hide the buttons and change the icon, color, or header text string by overriding the default configurations.
If you wish to change the font, color, or size, you can do so in the styles.xml file.
To show or hide buttons in the header, first determine whether to use the buttons in the BaseApplication.kt file. Then, set the button icon and color in the BaseApplication.kt file.
// Determine whether to use the buttons and set their icon resources and color.
class BaseApplication : Application() {
override fun onCreate() {
super.onCreate()
// Implement init codes here.
FragmentProviders.channelSettings = ChannelSettingsFragmentProvider { channelUrl, args ->
ChannelSettingsFragment.Builder(channelUrl)
.withArguments(args)
.setUseHeaderLeftButton(true) // Shows the left button
.setUseHeaderRightButton(true) // Shows the right button
.setHeaderLeftButtonIconResId(R.drawable.icon_arrow_left) // Sets the left button icon
.setHeaderLeftButtonIcon(
com.sendbird.uikit.R.drawable.icon_arrow_left,
ColorStateList.valueOf(Color.BLUE) // Sets the left button color
)
.setRightButtonText("Text") // If the text is empty, the right button will be hidden
.build()
}
}
}
One of the main features of the channel settings view is the members or member list view. You can customize the member list view by adding or removing the Invite users button.
The Invite users button appears in the top-right corner of the member list screen. To show or hide the buttons, set setUseHeaderRightButton() of MemberListFragment to false in the BaseApplication class. To re-enable it, set true.
// Show or hide "Invite users" button
class BaseApplication : Application() {
override fun onCreate() {
super.onCreate()
// Implement init codes here.
FragmentProviders.memberList = MemberListFragmentProvider { channelUrl, args ->
MemberListFragment.Builder(channelUrl)
.withArguments(args)
.setUseHeaderRightButton(false)
.build()
}
}
}