Page customization design
Page architecture design
Profile and relationship management pages use the MVVM (Model-View-ViewModel) pattern, combined with Android Fragment and Activity lifecycle management and layered decoupling design. Each layer has a clear responsibility in the architecture to improve code readability, maintainability, and extensibility.
- Activity: Serves as the page entry point, loads and displays Fragments, and passes necessary parameters.
- Fragment: Handles UI display and user interaction logic, obtains data through ViewModel, and updates views.
- ViewModel: Acts as the intermediary layer between data and business logic, processes data retrieval, handling, and updates, and notifies Fragment of data changes.
- Handler: Serves as the core layer for business data processing, encapsulates the specific implementation of data retrieval and operations, and provides data operation interfaces.
- Component: Encapsulates common UI controls and interaction logic to improve component reusability.
- XML Layout Files: Define view structure, styles, and layouts, providing UI support for Fragments.

Architecture Layer Relationships
Activity Layer
- Role:
- Serves as the page entry point, initializes and loads Fragments.
- Manages page navigation, passes startup parameters, and handles communication between Fragments.
Fragment Layer
- Role:
- Serves as the primary UI display and interaction logic processing layer, loads and manages view components.
- Handles user interaction events such as button clicks and input field changes.
- Obtains and observes data through ViewModel, and updates views based on data changes.
- Custom Methods:
onCreateViewModel():- Creates ViewModel instances through ViewModelProvider. Override this method to return a custom ViewModel class as needed.
onCreateView():- Calls the parent class layout loading logic through
super.onCreateView(), and adds or adjusts custom views based on the parent class.
- Calls the parent class layout loading logic through
onViewReady():- Binds LiveData, sets click event listeners, and updates UI.
ViewModel Layer
- Role:
- Acts as the bridge between Fragment and the data layer, manages and processes business logic.
- Notifies Fragment of data changes through mechanisms such as LiveData.
- Calls Handler to perform data retrieval, updates, or submission operations.
- Custom Methods:
- Add new business logic processing methods or create new LiveData properties.
Handler Layer
- Role:
- Serves as the specific implementation layer for data operations, encapsulates specific calls to data sources, and prevents memory leaks.
- Provides methods for data retrieval, saving, updating, and deletion, offering interfaces for ViewModel.
Component Layer
- Role:
- Encapsulates common view components to improve component reusability.
XML Layout File Layer
- Role:
- Defines view structure, styles, and layouts, serving as the foundation for UI display.
- Allows quick definition and modification of view structure through layout files.

Customization Guide
ChatUIFragmentFactory Role
ChatUIFragmentFactory is the factory class used in the Kit to create Fragments, helping developers flexibly manage and replace Fragments. Extend ChatUIFragmentFactory and override the Fragment you need to customize, such as the newGroupProfileFragment() method, to return a custom GroupProfileFragment.
public class CustomChatUIFragmentFactory extends ChatUIFragmentFactory {
@NonNull
@Override
public GroupProfileFragment newGroupProfileFragment(@NonNull Bundle args) {
CustomGroupProfileFragment fragment = new CustomGroupProfileFragment();
fragment.setArguments(args);
return fragment;
}
}
// Set custom factory, initialize IMUIKit in Application and set the custom Fragment factory:
public class MyApp extends Application {
@Override
public void onCreate() {
super.onCreate();
// Set the custom Fragment factory
NCChatUI.setFragmentFactory(new CustomChatUIFragmentFactory());
}
}
Custom Fragment
-
Scope:
- Override
onCreateView()andonViewReady()methods to add custom view components and interaction logic. - Handle specific UI logic and user interactions such as button clicks and page refreshes.
- Override
-
Recommendations:
- Delegate all business logic to
ViewModel, withFragmentonly responsible for UI display and user interaction event listening. - Obtain data and listen for data changes through
ViewModel, avoiding direct data source operations.
- Delegate all business logic to
// Custom Fragment (e.g., CustomGroupProfileFragment)
public class CustomGroupProfileFragment extends GroupProfileFragment {
// Override to return custom ViewModel (e.g., CustomGroupProfileViewModel)
@Override
protected GroupProfileViewModel onCreateViewModel(Bundle bundle) {
return new ViewModelProvider(this, new ViewModelFactory(bundle))
.get(CustomGroupProfileViewModel.class);
}
@Override
protected void onViewReady(@NonNull GroupProfileViewModel viewModel) {
super.onViewReady(viewModel);
// Change title content
headComponent.setTitleText("New Title");
// Override title bar back button click event
headComponent.setLeftClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Custom back button logic
}
});
// Override title bar right button click event (if any)
headComponent.setRightClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Custom right button logic
}
});
// Set title bar right button icon
headComponent.setRightTextDrawable(R.drawable.nc_lively_right_arrow_light);
}
}
Custom ViewModel
-
Scope:
- Add custom business logic processing methods such as data filtering and transformation.
- Create new
LiveDataproperties forFragmentto listen to data changes.
-
Recommendations:
- Encapsulate all business logic in
ViewModel, avoiding writing logic inFragmentorHandler. - Process data retrieval and operations through
Handler, avoiding direct interaction betweenViewModeland data sources.
- Encapsulate all business logic in
// Custom ViewModel (e.g., CustomGroupProfileViewModel)
public class CustomGroupProfileViewModel extends GroupProfileViewModel {
public CustomGroupProfileViewModel(@NonNull Bundle arguments) {
super(arguments);
}
// Add your own business logic
}
Custom XML Layout Files
-
Scope:
- Copy the XML layout file corresponding to the original Kit page to the application's
res/layoutdirectory, and add or adjust view components based on the original. - Define custom view properties and styles such as color, size, and spacing.
- Copy the XML layout file corresponding to the original Kit page to the application's
-
Notes:
- Do not delete Views from the original layout: Even if you don't need certain default views, do not delete them. Hide views by setting
visibilitytoGONEorINVISIBLE. - Do not modify original View IDs: Modifying the
idof originalViewelements may causeGroupProfileFragmentlogic to malfunction.
- Do not delete Views from the original layout: Even if you don't need certain default views, do not delete them. Hide views by setting
Handler Function Overview
Role: Serves as the core layer for business data processing, encapsulates the specific implementation of data retrieval and operations, and provides data operation interfaces.
GroupInfoHandler
GroupInfoHandler is primarily used to obtain basic group information and detailed information for specified members. It uses DataKey to identify different data operation types for easy listening and processing. The following describes the public interfaces and DataKey definitions for GroupInfoHandler:
public class GroupInfoHandler extends MultiDataHandler {
// DataKey for identifying group information retrieval
public static final DataKey<GroupInfo> KEY_GROUP_INFO =
MultiDataHandler.DataKey.obtain("KEY_GROUP_INFO", GroupInfo.class);
// DataKey for identifying group member information retrieval
public static final DataKey<List<GroupMemberInfo>> KEY_GET_GROUP_MEMBERS =
MultiDataHandler.DataKey.obtain("KEY_GET_GROUP_MEMBERS",
(Class<List<GroupMemberInfo>>) (Class<?>) List.class);
// DataKey for identifying group member search
public static final DataKey<List<GroupMemberInfo>> KEY_SEARCH_GROUP_MEMBERS =
MultiDataHandler.DataKey.obtain("KEY_SEARCH_GROUP_MEMBERS",
(Class<List<GroupMemberInfo>>) (Class<?>) List.class);
/**
* Get group information
* @description Retrieves detailed information for the specified group and notifies the caller through listener callback.
*/
public void getGroupsInfo() {
// Retrieves detailed information for the specified group from the server, including group name, announcement, avatar, etc.
// Results are returned to the caller through listener callback, returning group information on success or error code on failure.
}
/**
* Get group member information
* @param userIds User ID list
* @description Retrieves group member information for the specified user ID list and notifies the caller through listener callback.
*/
public void getGroupMembers(List<String> userIds) {
// Retrieves detailed information for the specified user ID list in the current group, such as member role and join time.
// Results are returned to the caller through listener callback, returning group member information list on success or error code on failure.
}
/**
* Search group members
* @param name Member name
* @description Searches for group members by member name and notifies the caller through listener callback.
*/
public void searchGroupMembers(String name) {
// Searches for matching member information by member name in the current group.
// Results are returned to the caller through listener callback, returning the list of found member information on success or error code on failure.
}
}
DataKey Description - KEY_GROUP_INFO: Data key for retrieving group information, type GroupInfo. - KEY_GET_GROUP_MEMBERS: Data key for retrieving group member information, type List<GroupMemberInfo>. - KEY_SEARCH_GROUP_MEMBERS: Data key for searching group members, type List<GroupMemberInfo>. - KEY_GROUP_FOLLOWS: Data key for retrieving followed group members, type List<GroupFollowDetail>.
GroupMembersPagedHandler
GroupMembersPagedHandler is used to retrieve group member lists with pagination, supports retrieving group member information by role with pagination, and provides load more functionality. The following describes the public interfaces and DataKey definitions for GroupMembersPagedHandler:
public class GroupMembersPagedHandler extends MultiDataHandler {
// DataKey for identifying group member information retrieval
public static final DataKey<List<GroupMemberInfo>> KEY_GET_GROUP_MEMBERS =
MultiDataHandler.DataKey.obtain("KEY_GET_GROUP_MEMBERS",
(Class<List<GroupMemberInfo>>) (Class<?>) List.class);
// DataKey for identifying whether more group member data can be loaded
private static final DataKey<Boolean> KEY_LOAD_MORE =
DataKey.obtain("KEY_LOAD_MORE", Boolean.class);
/**
* Get group member information
* @param groupMemberRole Group member role
* @description Retrieves member list by specified group member role, supports pagination.
*/
public void getGroupMembersByRole(@NonNull GroupMemberRole groupMemberRole) {
// This method retrieves group member list by role, such as owner, administrator, regular member, etc.
// Supports paginated loading, returns results through listener callback, returning group member list on success or error code on failure.
}
/**
* Load next page of group member data
* @param listener Data change listener
* @description Loads more group member information and notifies the caller through listener callback.
*/
public void loadNext(OnDataChangeListener<Boolean> listener) {
// This method loads the next page of data for the current group member role.
// Returns true through listener on successful load, otherwise returns false.
}
/**
* Check if there is more data
* @description Checks whether there is more group member data available to load.
* @return true indicates more data available, false indicates all data loaded.
*/
public boolean hasNext() {
// Returns whether there is more data available to load.
return !TextUtils.isEmpty(nextPageToken);
}
}
DataKey Description - KEY_GET_GROUP_MEMBERS: Data key for retrieving group member information, type List<GroupMemberInfo>. KEY_LOAD_MORE is used internally for load-more callbacks and is not a public data key.
GroupOperationsHandler
GroupOperationsHandler provides various operation interfaces for groups, such as creating groups, inviting users to join, removing group members, updating group information, dismissing and leaving groups. The following describes the public interfaces and DataKey definitions for GroupOperationsHandler:
public class GroupOperationsHandler extends MultiDataHandler {
// DataKey for identifying create group operation
public static final DataKey<Integer> KEY_CREATE_GROUP =
DataKey.obtain("KEY_CREATE_GROUP", Integer.class);
// DataKey for identifying invite users to group operation
public static final DataKey<Integer> KEY_INVITE_USERS_TO_GROUP =
DataKey.obtain("KEY_INVITE_USERS_TO_GROUP", Integer.class);
// DataKey for identifying remove group members operation
public static final DataKey<Boolean> KEY_KICK_GROUP_MEMBERS =
DataKey.obtain("KEY_KICK_GROUP_MEMBERS", Boolean.class);
// DataKey for identifying update group information operation
public static final DataKey<Boolean> KEY_UPDATE_GROUP_INFO =
DataKey.obtain("KEY_UPDATE_GROUP_INFO", Boolean.class);
// DataKey for identifying leave group operation
public static final DataKey<Boolean> KEY_QUIT_GROUP =
DataKey.obtain("KEY_QUIT_GROUP", Boolean.class);
// DataKey for identifying dismiss group operation
public static final DataKey<Boolean> KEY_DISMISS_GROUP =
DataKey.obtain("KEY_DISMISS_GROUP", Boolean.class);
/**
* Create group
* @param groupInfo Group information
* @param inviteeUserIds List of user IDs to invite to the group
* @description Creates a group and invites specified users to join, notifies the caller through listener callback.
*/
public void createGroup(GroupInfo groupInfo, List<String> inviteeUserIds) {
// This method creates a new group and invites specified users to join.
// Results are returned through listener callback, returning successful group creation result on success or error code on failure.
}
/**
* Invite users to group
* @param userIds User ID list
* @description Invites specified users to join the group and notifies the caller through listener callback.
*/
public void inviteUsersToGroup(@NonNull List<String> userIds) {
// This method invites specified users to join the current group.
// Results are returned through listener callback, returning true on success or false on failure.
}
/**
* Remove group members
* @param userIds User ID list
* @param config Leave group configuration
* @description Removes specified users from the group and notifies the caller through listener callback.
*/
public void kickGroupMembers(List<String> userIds, LeaveGroupConfig config) {
// This method removes specified users from the group, typically requires owner or administrator permissions.
// Results are returned through listener callback, returning true on success or false on failure.
}
/**
* Update group information
* @param groupInfo Group information
* @description Updates basic group information such as group name, avatar, announcement, and notifies the caller through listener callback.
*/
public void updateGroupInfo(@NonNull GroupInfo groupInfo) {
// This method updates basic group information.
// Results are returned through listener callback, returning true on success or false on failure.
}
/**
* Leave group
* @param config Leave group configuration
* @description Leaves the current group and notifies the caller through listener callback.
*/
public void quitGroup(LeaveGroupConfig config) {
// This method leaves the current group, typically called when user chooses to leave the group.
// Results are returned through listener callback, returning true on success or false on failure.
}
/**
* Dismiss group
* @description Dismisses the current group and notifies the caller through listener callback.
*/
public void dismissGroup() {
// This method dismisses the current group, typically requires owner permissions.
// Results are returned through listener callback, returning true on success or false on failure.
}
}
DataKey Description - KEY_CREATE_GROUP: Data key for create group operation, type Integer. - KEY_CREATE_GROUP_EXAMINE: Data key for create group with review, type Integer. - KEY_INVITE_USERS_TO_GROUP: Data key for invite users to group operation, type Integer. - KEY_KICK_GROUP_MEMBERS: Data key for remove group members operation, type Boolean. - KEY_UPDATE_GROUP_INFO: Data key for update group information operation, type Boolean. - KEY_UPDATE_GROUP_INFO_EXAMINE: Data key for updating group information with review, type Boolean. - KEY_SET_GROUP_MEMBER_INFO: Data key for setting group member information, type Boolean. - KEY_SET_GROUP_MEMBER_INFO_EXAMINE: Data key for setting group member information with review, type Boolean. - KEY_QUIT_GROUP: Data key for leave group operation, type Boolean. - KEY_DISMISS_GROUP: Data key for dismiss group operation, type Boolean. - KEY_ADD_GROUP_FOLLOWS: Data key for adding followed group members, type Boolean. - KEY_REMOVE_GROUP_FOLLOWS: Data key for removing followed group members, type Boolean. - KEY_TRANSFER_GROUP_OWNER: Data key for transferring group ownership, type Boolean. - KEY_ADD_GROUP_MANAGERS: Data key for adding group managers, type Boolean. - KEY_REMOVE_GROUP_MANAGERS: Data key for removing group managers, type Boolean. - KEY_JOIN_GROUP: Data key for joining a group, type Integer.
GroupMembersFullHandler
GroupMembersFullHandler is used to retrieve all group member information at once, including retrieving group member lists by role. This handler class notifies external classes of group member information retrieval status through data change and error callback listening.
public class GroupMembersFullHandler extends MultiDataHandler {
// DataKey for identifying retrieval of all group member information
public static final DataKey<List<GroupMemberInfo>> KEY_GET_ALL_GROUP_MEMBERS_BY_ROLES =
DataKey.obtain("KEY_GET_ALL_GROUP_MEMBERS_BY_ROLES",
(Class<List<GroupMemberInfo>>) (Class<?>) List.class);
/**
* Get all group members
* @param groupMemberRole Group member role
* @description Retrieves all group member information by specified group member role. This method supports retrieving member information for all roles sequentially and notifies external classes of retrieval results through callback.
*/
public void getAllGroupMembersByRole(@NonNull GroupMemberRole groupMemberRole) {
// This method retrieves all member information in the group by role.
// On success, returns group member list and total count through listener, on failure returns error code.
}
}
DataKey Description
- KEY_GET_ALL_GROUP_MEMBERS_BY_ROLES: Data key for retrieving all group member information, type
List<GroupMemberInfo>.
FriendInfoHandler
FriendInfoHandler is used to manage friend information, including retrieving friend lists, checking friend relationships, and searching for friends. It provides multiple methods and data keys to help developers manage friend relationships.
public class FriendInfoHandler extends MultiDataHandler {
// Data key for checking friend relationship
public static final DataKey<FriendRelation> KEY_CHECK_FRIEND =
MultiDataHandler.DataKey.obtain("KEY_CHECK_FRIEND", FriendRelation.class);
// Data key for retrieving friend list
public static final DataKey<List<FriendDetail>> KEY_GET_FRIENDS =
MultiDataHandler.DataKey.obtain("KEY_GET_FRIENDS",
(Class<List<FriendDetail>>) (Class<?>) List.class);
// Data key for searching users
public static final DataKey<UserProfile> KEY_SEARCH_USER =
MultiDataHandler.DataKey.obtain("KEY_SEARCH_USER", UserProfile.class);
// Data key for retrieving specified friend information
public static final DataKey<FriendDetail> KEY_GET_FRIEND =
MultiDataHandler.DataKey.obtain("KEY_GET_FRIEND", FriendDetail.class);
// Data key for delete friend operation result
public static final DataKey<Boolean> KEY_DELETE_FRIEND =
MultiDataHandler.DataKey.obtain("KEY_DELETE_FRIEND", Boolean.class);
// Data key for apply friend operation result
public static final DataKey<Integer> KEY_APPLY_FRIEND =
MultiDataHandler.DataKey.obtain("KEY_APPLY_FRIEND", Integer.class);
// Data key for search friends result
public static final DataKey<List<FriendDetail>> KEY_SEARCH_FRIENDS =
MultiDataHandler.DataKey.obtain("KEY_SEARCH_FRIENDS",
(Class<List<FriendDetail>>) (Class<?>) List.class);
/**
* Get friend list
* @param directionType Query direction
* @description Retrieves friend list in specified direction, including bidirectional or unidirectional friends.
*/
public void getFriends() {
// Retrieves friend list and returns results through listener callback.
}
/**
* Check friend relationship
* @param userId User ID
* @description Checks friend relationship status for specified user ID.
*/
public void checkFriend(String userId) {
// Checks whether a friend relationship exists with the specified user, notifies through listener callback.
}
/**
* Get specified friend information
* @param userId User ID
* @description Retrieves detailed friend information for specified user ID.
*/
public void getFriendInfo(String userId) {
// Retrieves friend information for specified user, notifies through listener callback.
}
/**
* Delete friend
* @param userId User ID
* @param listener Data change listener
* @description Deletes friend relationship for specified user ID.
*/
public void deleteFriend(String userId, OnDataChangeListener<Boolean> listener) {
// Deletes friend relationship for specified user, returns true on success or false on failure.
}
/**
* Apply friend
* @param userId User ID
* @param remark Application message
* @param listener Data change listener
* @description Sends friend request to specified user ID.
*/
public void applyFriend(
String userId,
String remark,
OnDataChangeListener<Integer> listener) {
// Sends friend request to specified user, notifies through listener callback.
}
/**
* Search user information
* @param uniqueId Unique identifier
* @description Searches for user information by unique identifier.
*/
public void findUser(String uniqueId) {
// Searches for user information by unique identifier, notifies through listener callback.
}
/**
* Search friend information
* @param query Query keyword
* @description Searches for friend information by query keyword.
*/
public void searchFriendsInfo(String query) {
// Searches for friend information by keyword, notifies through listener callback.
}
}
DataKey Description - KEY_CHECK_FRIEND: Data key for checking friend relationship, type FriendRelation. - KEY_GET_FRIENDS: Data key for retrieving friend list, type List<FriendDetail>. - KEY_SEARCH_USER: Data key for searching users, type UserProfile. - KEY_GET_FRIEND: Data key for retrieving specified friend information, type FriendDetail. - KEY_DELETE_FRIEND: Data key for delete friend operation result, type Boolean. - KEY_APPLY_FRIEND: Data key for apply friend operation result, type Integer. - KEY_SEARCH_FRIENDS: Data key for search friends result, type List<FriendDetail>. - KEY_GET_FRIENDS_ONLINE_STATUS: Data key for friend online status, type Map<String, UserOnlineStatus>.
FriendApplicationHandler
FriendApplicationHandler is used to manage friend request operations, including retrieving friend request lists, accepting friend requests, and rejecting friend requests. The following describes the public interfaces and DataKey definitions for this handler class:
public class FriendApplicationHandler extends MultiDataHandler {
// Data key for retrieving friend request list
public static final DataKey<PageResult> KEY_GET_FRIEND_APPLICATIONS =
MultiDataHandler.DataKey.obtain("KEY_GET_FRIEND_APPLICATIONS", PageResult.class);
// Data key for accept friend request operation result
public static final DataKey<Boolean> KEY_ACCEPT_FRIEND_APPLICATIONS =
MultiDataHandler.DataKey.obtain("KEY_ACCEPT_FRIEND_APPLICATIONS", Boolean.class);
// Data key for reject friend request operation result
public static final DataKey<Boolean> KEY_REJECT_FRIEND_APPLICATIONS =
MultiDataHandler.DataKey.obtain("KEY_REJECT_FRIEND_APPLICATIONS", Boolean.class);
/**
* Get friend request list
*
* @param option Paging query parameters
* @param type Application type (received/sent)
* @param status Application status (unprocessed, processed, etc.)
* @description Retrieves friend request list, supports paging query, returns results through listener callback.
*/
public void getFriendApplications(
FriendApplicationsQueryParams params,
FriendApplicationType[] type,
FriendApplicationStatus[] status) {
// Retrieves friend request list
}
/**
* Accept friend request
*
* @param userId Applicant's user ID
* @param listener Data change listener
* @description Accepts friend request from specified user and returns operation result through listener callback.
*/
public void acceptFriendApplication(String userId, OnDataChangeListener<Boolean> listener) {
// Accept friend request operation
}
/**
* Reject friend request
*
* @param userId Applicant's user ID
* @param listener Data change listener
* @description Rejects friend request from specified user and returns operation result through listener callback.
*/
public void refuseFriendApplication(String userId, OnDataChangeListener<Boolean> listener) {
// Reject friend request operation
}
}
DataKey Description
- KEY_GET_FRIEND_APPLICATIONS: Data key for retrieving friend request list, type PageResult.
- KEY_ACCEPT_FRIEND_APPLICATIONS: Data key for accept friend request operation result, type Boolean.
- KEY_REJECT_FRIEND_APPLICATIONS: Data key for reject friend request operation result, type Boolean.
UserProfileHandler
UserProfileHandler is used to manage user personal information, including retrieving current user information and retrieving specified user information. The following describes the public interfaces and DataKey definitions for this handler class:
public class UserProfileHandler extends MultiDataHandler {
// Data key for retrieving user information
public static final DataKey<UserProfile> KEY_GET_USER_PROFILE =
DataKey.obtain("KEY_GET_USER_PROFILE", UserProfile.class);
// Data key for retrieving current user information
public static final DataKey<UserProfile> KEY_GET_MY_USER_PROFILE =
DataKey.obtain("KEY_GET_MY_USER_PROFILE", UserProfile.class);
/**
* Get current user information
* @description Retrieves current user's personal information and returns results through listener callback.
*/
public void getMyUserProfile() {
// Retrieves current user information
}
/**
* Get specified user information
*
* @param id User ID
* @description Retrieves personal information for specified user and returns results through listener callback.
*/
public void getUserProfile(String id) {
// Retrieves specified user information
}
}
DataKey Description
- KEY_GET_USER_PROFILE: Data key for retrieving specified user information, type UserProfile.
- KEY_GET_MY_USER_PROFILE: Data key for retrieving current user information, type UserProfile.
UserProfileOperationsHandler
UserProfileOperationsHandler is used to manage user information update operations, including updating current user information and setting friend information. The following describes the public interfaces and DataKey definitions for this handler class:
public class UserProfileOperationsHandler extends MultiDataHandler {
// Data key for update user information operation result
public static final DataKey<Boolean> KEY_UPDATE_MY_USER_PROFILE =
DataKey.obtain("KEY_UPDATE_MY_USER_PROFILE", Boolean.class);
// Data key for update user information with review
public static final DataKey<Boolean> KEY_UPDATE_MY_USER_PROFILE_EXAMINE =
DataKey.obtain("KEY_UPDATE_MY_USER_PROFILE_EXAMINE", Boolean.class);
// Data key for set friend information operation result
public static final DataKey<Boolean> KEY_SET_FRIEND_INFO =
DataKey.obtain("KEY_SET_FRIEND_INFO", Boolean.class);
// Data key for set friend information with review
public static final DataKey<Boolean> KEY_SET_FRIEND_INFO_EXMAINE =
DataKey.obtain("KEY_SET_FRIEND_INFO_EXMAINE", Boolean.class);
/**
* Update user information
* @param userProfile User information
* @description Updates current user's personal information, operation result notified through listener callback.
*/
public void updateMyUserProfile(UserProfile userProfile) {
// Updates current user information
}
/**
* Set friend information
* @param userId User ID
* @param remark Remark
* @param extProfile Extended information
* @description Sets remark and extended information for specified friend, operation result notified through listener callback.
*/
public void setFriendInfo(final String userId, final String remark, final Map<String, String> extProfile) {
// Sets friend information
}
}
DataKey Description
- KEY_UPDATE_MY_USER_PROFILE: Data key for update current user information operation result, type Boolean.
- KEY_UPDATE_MY_USER_PROFILE_EXAMINE: Data key for update current user information with review, type Boolean.
- KEY_SET_FRIEND_INFO: Data key for set friend information operation result, type Boolean.
- KEY_SET_FRIEND_INFO_EXMAINE: Data key for set friend information with review, type Boolean.
ChannelOperationsHandler
ChannelOperationsHandler is primarily used to handle channel operations such as setting channel do-not-disturb level and pinned status. It uses DataKey to identify different data operation types for easy listening and processing. The following describes the public interfaces and DataKey definitions for this handler class:
public class ChannelOperationsHandler extends MultiDataHandler {
// DataKey for setting channel do-not-disturb level
public static final DataKey<ChannelNoDisturbLevel>
KEY_SET_CONVERSATION_NOTIFICATION_STATUS =
DataKey.obtain("KEY_SET_CONVERSATION_NOTIFICATION_STATUS", ChannelNoDisturbLevel.class);
// DataKey for setting channel pinned status
public static final DataKey<Boolean>
KEY_SET_CONVERSATION_TO_TOP =
DataKey.obtain("KEY_SET_CONVERSATION_TO_TOP", Boolean.class);
@NonNull
private final ChannelIdentifier channelIdentifier;
public ChannelOperationsHandler(@NonNull ChannelIdentifier channelIdentifier) {
this.channelIdentifier = channelIdentifier;
}
/**
* Set channel do-not-disturb level
* @param conversationNotificationStatus Channel notification status
* @description Sets notification status for specified channel and notifies the caller through listener callback.
*/
public void setConversationNotificationStatus(ChannelNoDisturbLevel level) {
// Sets notification status for specified channel
}
/**
* Set channel pinned status
* @param isTop Whether to pin
* @description Sets pinned status for specified channel and notifies the caller through listener callback.
*/
public void setConversationToTop(boolean isTop) {
// Sets pinned status for specified channel
}
}
DataKey Description
- KEY_SET_CONVERSATION_NOTIFICATION_STATUS: Data key for setting channel do-not-disturb level, type ChannelNoDisturbLevel.
- KEY_SET_CONVERSATION_TO_TOP: Data key for setting channel pinned status, type Boolean.
ChannelStatusHandler
ChannelStatusHandler is primarily used to retrieve channel notification status and pinned status. It uses DataKey to identify different data operation types for easy listening and processing. The following describes the public interfaces and DataKey definitions for ChannelStatusHandler:
public class ChannelStatusHandler extends MultiDataHandler {
// DataKey for retrieving channel notification status
public static final DataKey<ChannelNoDisturbLevel>
KEY_GET_CONVERSATION_NOTIFICATION_STATUS =
DataKey.obtain("KEY_GET_CONVERSATION_NOTIFICATION_STATUS", ChannelNoDisturbLevel.class);
// DataKey for retrieving channel pinned status
public static final DataKey<Boolean>
KEY_GET_CONVERSATION_TOP_STATUS =
DataKey.obtain("KEY_GET_CONVERSATION_TOP_STATUS", Boolean.class);
/** Gets the conversation notification status. */
public void getConversationNotificationStatus() {
// Retrieves the current channel do-not-disturb level.
}
/** Gets the conversation pinned status. */
public void getConversationTopStatus() {
// Retrieves whether the current channel is pinned.
}
}