UIKit Android v3
UIKit Android
UIKit
Android
Home
/
UIKit
/
Android
This is the new Docs for UIKit v3 beta for Android. To see the previous Docs, click here.

Promote members to operator

Operators can promote other channel members to be operators through the PromoteOperatorActivity or PromoteOperatorFragment. All channel members are listed through pagination and members who are already an operator can't be promoted.


Promote to operator screen

A promote to operator screen is composed of three components: header, user list, and user list status.

Header

The header component shows the default title of the promote to operator screen as Promote to operator. It also has two buttons on the left and right corner of the header. When the left button is tapped, the finish() method of the activity is called to exit the current screen. When the right button is tapped, the selected members are promoted to be operators of the channel. The view of the header is created and customized in the SelectUserHeaderComponent of the PromoteOperatorModule.

User list

The user list component shows a list of channel members' profile images, names, and selectable checkboxes. By default, all channel members are retrieved in the list. However, members that already an operator of the channel can't be selected from the list. The view of the user list is created and customized in the PromoteOperatorListComponent of the PromoteOperatorModule. You can also customize each item in the list view using PromoteOperatorListAdapter.

User list status

The user list status component shows the result of the data request for a channel member list. The StatusComponent exists in the PromoteOperatorModule and lets the user know if the list is loading or if the list could not be called.


Usage

UIKit for Android provides both activity and fragment to create a promote to operator 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 promote to operator screen through PromoteOperatorActivity, which uses UIKitFragmentFactory to create views.

Start an activity

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

Intent intent = PromoteOperatorActivity.newIntent(context, "channel_url");
startActivity(intent);

Create a fragment

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

PromoteOperatorFragment fragment = new PromoteOperatorFragment.Builder("channel_url").build();

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


Customization

In the promote to operator key function, you can customize PromoteOperatorFragment to change different aspects of the screen. The PromoteOperatorFragment.Builder class allows you to create and customize the basic PromoteOperatorFragment 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 PromoteOperatorFragment to display and customize the promote to operator screen.

FragmentModuleComponentStyleRecyclerView

PromoteOperatorFragment

PromoteOperatorModule

SelectUserHeaderComponent

PromoteOperatorListComponent

StatusComponent

Module.PromoteOperator

PromoteOperatorListAdapter

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:

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 promote to operator screen, you must use the correct classes.