Chat UIKit Android View v3
Chat UIKit Android View
Chat UIKit
Android View
Version 3

Moderate open channels and participants

Copy link

In open channels, you can moderate channels and participants through the OpenChannelModerationActivity or OpenChannelModerationFragment class. Using the moderation menu, you can retrieve a list of operators, muted participants, and banned users in a channel. In order to use this feature, a channel must have at least one operator.


Open channel moderation screen

Copy link

An open channel moderation screen is composed of two components: header and moderation list.

Header

Copy link

The header component shows the default title of the open channel moderation screen as Moderations. It also has two buttons on the left corner of the header. When the left button is tapped, the finish() method of the activity is called to exit the screen. The view of the header is created and customized in the HeaderComponent of the OpenChannelModerationModule.

Moderation list

Copy link

The moderation list shows all items of the moderation menu, which includes a list of operators, muted participants, and banned users. The view of the moderation list is created and customized in the OpenChannelModerationListComponent of the OpenChannelModerationModule.


UIKit for Android provides both activity and fragment to create an open channel moderation 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 an open channel moderation screen through OpenChannelModerationActivity, which uses UIKitFragmentFactory to create views.

Start an activity

Copy link

You can start an activity by using intent to move from one activity to OpenChannelModerationActivity as shown below:

KotlinJava
val intent = OpenChannelModerationActivity.newIntent(context, "channel_url")
startActivity(intent)

Create a fragment

Copy link

OpenChannelModerationActivity allows you to create a basic OpenChannelModerationFragment through UIKitFragmentFactory and OpenChannelModerationFragment.Builder. 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 OpenChannelModerationFragment. To see all APIs of OpenChannelModerationFragment.Builder, refer to the API reference page.

KotlinJava
val fragment = OpenChannelModerationFragment.Builder("channel_url").build()

Note: To use UIKit's fragments as a nested fragment, refer to the Android Developer Documentation's Nested Fragments.


Customization

Copy link

In the moderate open channels and participants key function, you can customize OpenChannelModerationFragment to change different parts of the screen. The OpenChannelModerationFragment.Builder class allows you to create and customize the basic OpenChannelModerationFragment 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 OpenChannelModerationFragment to display and customize the open channel moderation screen.

FragmentModuleComponentStyle

OpenChannelModerationFragment

OpenChannelModerationModule

HeaderComponent

OpenChannelModerationListComponent

Module.OpenChannelModeration

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, see the Customizations overview page for further details.

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 open channel moderation screen, you must use the correct classes.