User Profile Hosting Page Design
This feature is supported starting from version 5.12.0.
Page Architecture Design
The User Profile Hosting adopts the MVVM (Model-View-ViewModel) pattern, combining Android's Fragment and Activity lifecycle management with a layered decoupling design philosophy. Each layer has clearly defined responsibilities in the architecture, aiming to improve code readability, maintainability, and extensibility.
- Activity: Serves as the entry point of the page, responsible for loading and displaying Fragments and passing necessary parameters.
- Fragment: Handles UI display and user interaction logic, fetching data through ViewModel and updating views.
- ViewModel: Acts as the intermediary layer for data and business logic, processing data retrieval, manipulation, and updates, and notifying Fragments of data changes.
- Handler: Serves as the core layer for business data processing, encapsulating specific implementations of data retrieval and operations, and providing interfaces for data manipulation.
- Component: Encapsulates commonly used UI controls and interaction logic to enhance component reusability.
- XML Layout Files: Define the structure, style, and layout of views, providing UI support for Fragments.

Page Architecture Hierarchy
Activity Layer
- Role:
- Serves as the entry point of the page, responsible for initializing and loading Fragments.
- Manages page navigation, parameter passing, and communication between Fragments.
Fragment Layer
- Role:
- Acts as the primary layer for UI display and interaction logic, responsible for loading and managing view components.
- Handles user interaction events such as button clicks and input field changes.
- Observes data changes through ViewModel and updates views accordingly.
- Custom Methods:
onCreateViewModel():- Creates a ViewModel instance via ViewModelProvider. Can be overridden to return a custom ViewModel class.
onCreateView():- Calls the parent class's layout loading logic via
super.onCreateView()and adds or adjusts custom views on top of the parent class.
- Calls the parent class's layout loading logic via
onViewReady():- Binds LiveData, sets click event listeners, and updates the UI.
ViewModel Layer
- Role:
- Acts as the bridge between Fragments and the data layer, managing and processing business logic.
- Notifies Fragments of data changes via mechanisms like LiveData.
- Calls Handlers for data retrieval, updates, or submissions.
- Custom Methods:
- Add new business logic processing methods or create new LiveData properties.
Handler Layer
- Role:
- Serves as the concrete implementation layer for data operations, encapsulating calls to data sources to avoid memory leaks.
- Provides methods for data retrieval, saving, updating, and deletion, offering interfaces for ViewModel.
Component Layer
- Role:
- Encapsulates commonly used view components to improve reusability.
XML Layout File Layer
- Role:
- Defines the structure, style, and layout of views, forming the foundation for UI display.
- Allows quick definition and modification of view structures through layout files.

Customization Guide
Role of KitFragmentFactory
KitFragmentFactory is a factory class in Kit for creating Fragments, enabling developers to flexibly manage and replace Fragments. By extending KitFragmentFactory and overriding methods like newGroupProfileFragment(), you can return a custom GroupProfileFragment.
public class CustomKitFragmentFactory extends KitFragmentFactory {
@NonNull
@Override
public GroupProfileFragment newGroupProfileFragment(@NonNull Bundle args) {
CustomGroupProfileFragment fragment = new CustomGroupProfileFragment();
fragment.setArguments(args);
return fragment;
}
}
// Set the custom factory during IMUIKit initialization in the Application class:
public class MyApp extends Application {
@Override
public void onCreate() {
super.onCreate();
// Set the custom Fragment factory
IMCenter.setKitFragmentFactory(new CustomKitFragmentFactory());
}
}
Customizing Fragments
-
Scope:
- Override
onCreateView()andonViewReady()to add custom view components and interaction logic. - Handle specific UI logic and user interactions, such as button clicks or page refreshes.
- Override
-
Recommendations:
- Delegate all business logic to
ViewModel, withFragmentfocusing solely on UI display and user interaction event handling. - Fetch data and observe changes via
ViewModel, avoiding direct interaction with data sources.
- Delegate all business logic to
// Custom Fragment (e.g., CustomGroupProfileFragment)
public class CustomGroupProfileFragment extends GroupProfileFragment {
// Override to return a 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 the title text
headComponent.setTitleText("New Title");
// Override the back button click event in the title bar
headComponent.setLeftClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Custom back button logic
}
});
// Override the right button click event in the title bar (if applicable)
headComponent.setRightClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Custom right button logic
}
});
// Set the right button icon in the title bar
headComponent.setRightTextDrawable(R.drawable.rc_right_icon);
}
}
Customizing ViewModel
-
Scope:
- Add custom business logic methods, such as data filtering or transformation.
- Create new
LiveDataproperties for Fragments to observe data changes.
-
Recommendations:
- Encapsulate all business logic in
ViewModel, avoiding logic inFragmentorHandler. - Use
Handlerfor data retrieval and operations, preventing direct interaction with data sources inViewModel.
- Encapsulate all business logic in
// Custom ViewModel (e.g., CustomGroupProfileViewModel)
public class CustomGroupProfileViewModel extends GroupProfileViewModel {
public CustomGroupProfileViewModel(@NonNull Bundle arguments) {
super(arguments);
}
// Add custom business logic
}
Customizing XML Layout Files
-
Scope:
- Copy the original Kit page's XML layout files to the app's
res/layoutdirectory and modify or add view components as needed. - Define custom view attributes and styles, such as colors, sizes, and spacing.
- Copy the original Kit page's XML layout files to the app's
-
Notes:
- Do not delete original views: Even if certain default views are unnecessary, avoid deleting them. Instead, hide them by setting
visibilitytoGONEorINVISIBLE. - Do not modify original view IDs: Changing original view IDs may cause
GroupProfileFragmentlogic to malfunction.
- Do not delete original views: Even if certain default views are unnecessary, avoid deleting them. Instead, hide them by setting
Handler Function Overview
Role: Serves as the core layer for business data processing, encapsulating concrete implementations of data retrieval and operations, and providing interfaces for data manipulation.
GroupInfoHandler
GroupInfoHandler is primarily used to fetch basic group information and details of specified members, with DataKey identifying different data operation types for easy monitoring and handling. Below are the external interface descriptions and DataKey definitions for GroupInfoHandler:
public class GroupInfoHandler extends MultiDataHandler {
// DataKey for fetching group information
public static final DataKey<GroupInfo> KEY_GROUP_INFO =
MultiDataHandler.DataKey.obtain("KEY_GROUP_INFO", GroupInfo.class);
// DataKey for fetching group member information
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 searching group members
public static final DataKey<List<GroupMemberInfo>> KEY_SEARCH_GROUP_MEMBERS =
MultiDataHandler.DataKey.obtain("KEY_SEARCH_GROUP_MEMBERS",
(Class<List<GroupMemberInfo>>) (Class<?>) List.class);
/**
* Fetch group information
* @description Fetches detailed information of the specified group and notifies the caller via listener callback.
*/
public void getGroupsInfo() {
// Fetches detailed group information (e.g., group name, announcement, avatar) from the server.
// Results are returned via listener callback: group info on success, error code on failure.
}
/**
* Fetch group member information
* @param userIds List of user IDs
* @description Fetches group member information for the specified user IDs and notifies the caller via listener callback.
*/
public void getGroupMembers(List<String> userIds) {
// Fetches detailed member information (e.g., role, join time) for the specified user IDs in the current group.
// Results are returned via listener callback: member info list on success, error code on failure.
}
/**
* Search group members
* @param name Member name
* @description Searches group members by name and notifies the caller via listener callback.
*/
public void searchGroupMembers(String name) {
// Searches for member information matching the name in the current group.
// Results are returned via listener callback: member info list on success, error code on failure.
}
}
DataKey Descriptions
- KEY_GET_GROUP_MEMBERS: Identifies the data key for fetching group member information, type:
List<GroupMemberInfo>. - KEY_TOTAL_GROUP_MEMBERS: Identifies the data key for total group member count, type: Integer.
- KEY_LOAD_MORE: Identifies the data key for whether more group member data can be loaded, type: Boolean.
GroupMembersPagedHandler
GroupMembersPagedHandler is used to fetch group member lists in a paginated manner, supporting fetching by role and providing load-more functionality. Below are the external interface descriptions and DataKey definitions for GroupMembersPagedHandler:
public class GroupMembersPagedHandler extends MultiDataHandler {
// DataKey for fetching group member information
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 whether more group member data can be loaded
private static final DataKey<Boolean> KEY_LOAD_MORE =
DataKey.obtain("KEY_LOAD_MORE", Boolean.class);
/**
* Fetch group member information
* @param groupMemberRole Group member role
* @description Fetches member lists by specified role (e.g., owner, admin, regular member) with pagination support.
*/
public void getGroupMembersByRole(@NonNull GroupMemberRole groupMemberRole) {
// Fetches member lists by role with pagination.
// Results are returned via listener callback: member list on success, 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 via listener callback.
*/
public void loadNext(OnDataChangeListener<Boolean> listener) {
// Loads the next page of data for the current member role.
// Returns true via listener on success, false otherwise.
}
/**
* Check if more data is available
* @description Checks if more group member data can be loaded.
* @return true if more data is available, false otherwise.
*/
public boolean hasNext() {
// Returns whether more data can be loaded.
return !TextUtils.isEmpty(nextPageToken);
}
}
DataKey Descriptions
- KEY_GET_GROUP_MEMBERS: Identifies the data key for fetching group member information, type:
List<GroupMemberInfo>. - KEY_TOTAL_GROUP_MEMBERS: Identifies the data key for total group member count, type: Integer.
- KEY_LOAD_MORE: Identifies the data key for whether more group member data can be loaded, type: Boolean.
GroupOperationsHandler
GroupOperationsHandler provides interfaces for various group operations, such as creating groups, inviting users, kicking members, updating group info, disbanding, and leaving groups. Below are the external interface descriptions and DataKey definitions for GroupOperationsHandler:
public class GroupOperationsHandler extends MultiDataHandler {
// DataKey for group creation operation
public static final DataKey<IRongCoreEnum.CoreErrorCode> KEY_CREATE_GROUP =
DataKey.obtain("KEY_CREATE_GROUP", IRongCoreEnum.CoreErrorCode.class);
// DataKey for inviting users to a group
public static final DataKey<Boolean> KEY_INVITE_USERS_TO_GROUP =
DataKey.obtain("KEY_INVITE_USERS_TO_GROUP", Boolean.class);
// DataKey for kicking group members
public static final DataKey<Boolean> KEY_KICK_GROUP_MEMBERS =
DataKey.obtain("KEY_KICK_GROUP_MEMBERS", Boolean.class);
// DataKey for updating group info
public static final DataKey<Boolean> KEY_UPDATE_GROUP_INFO =
DataKey.obtain("KEY_UPDATE_GROUP_INFO", Boolean.class);
// DataKey for leaving a group
public static final DataKey<Boolean> KEY_QUIT_GROUP =
DataKey.obtain("KEY_QUIT_GROUP", Boolean.class);
// DataKey for disbanding a group
public static final DataKey<Boolean> KEY_DISMISS_GROUP =
DataKey.obtain("KEY_DISMISS_GROUP", Boolean.class);
/**
* Create a group
* @param groupInfo Group info
* @param inviteeUserIds List of user IDs to invite
* @description Creates a group and invites specified users, notifying the caller via listener callback.
*/
public void createGroup(GroupInfo groupInfo, List<String> inviteeUserIds) {
// Creates a new group and invites specified users.
// Results are returned via listener callback: success result on success, error code on failure.
}
/**
* Invite users to a group
* @param userIds List of user IDs
* @description Invites specified users to the group and notifies the caller via listener callback.
*/
public void inviteUsersToGroup(@NonNull List<String> userIds) {
// Invites specified users to the current group.
// Returns true via listener on success, false otherwise.
}
/**
* Kick group members
* @param userIds List of user IDs
* @param config Group exit configuration
* @description Kicks specified users from the group and notifies the caller via listener callback.
*/
public void kickGroupMembers(List<String> userIds, QuitGroupConfig config) {
// Kicks specified users from the group (requires owner or admin permissions).
// Returns true via listener on success, false otherwise.
}
/**
* Update group info
* @param groupInfo Group info
* @description Updates basic group info (e.g., name, avatar, announcement) and notifies the caller via listener callback.
*/
public void updateGroupInfo(@NonNull GroupInfo groupInfo) {
// Updates basic group info.
// Returns true via listener on success, false otherwise.
}
/**
* Leave a group
* @param config Group exit configuration
* @description Leaves the current group and notifies the caller via listener callback.
*/
public void quitGroup(QuitGroupConfig config) {
// Leaves the current group (typically called when a user chooses to exit).
// Returns true via listener on success, false otherwise.
}
/**
* Disband a group
* @description Disbands the current group and notifies the caller via listener callback.
*/
public void dismissGroup() {
// Disbands the current group (requires owner permissions).
// Returns true via listener on success, false otherwise.
}
}
DataKey Descriptions
- KEY_CREATE_GROUP: Identifies the data key for group creation, type:
IRongCoreEnum.CoreErrorCode. - KEY_INVITE_USERS_TO_GROUP: Identifies the data key for inviting users to a group, type:
Boolean. - KEY_KICK_GROUP_MEMBERS: Identifies the data key for kicking group members, type:
Boolean. - KEY_UPDATE_GROUP_INFO: Identifies the data key for updating group info, type:
Boolean. - KEY_QUIT_GROUP: Identifies the data key for leaving a group, type:
Boolean. - KEY_DISMISS_GROUP: Identifies the data key for disbanding a group, type:
Boolean.
GroupMembersFullHandler
GroupMembersFullHandler is used to fetch all member information of a group at once, including fetching by role. It notifies external classes of member info retrieval status via data change and error callbacks.
public class GroupMembersFullHandler extends MultiDataHandler {
// DataKey for fetching 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);
/**
* Fetch all group members
* @param groupMemberRole Group member role
* @description Fetches all group member information based on the specified member role. This method supports fetching member information for all roles sequentially and notifies external classes via callback.
*/
public void getAllGroupMembersByRole(@NonNull GroupMemberRole groupMemberRole) {
// This method fetches all member information in the group by role.
// On success, returns the member list and total count via listener; on failure, returns error code.
}
}
DataKey Descriptions
- KEY_GET_ALL_GROUP_MEMBERS_BY_ROLES: Identifies the data key for fetching all group member information, type:
List<GroupMemberInfo>. - KEY_TOTAL_GROUP_MEMBERS: Identifies the data key for total group member count, type: Integer.
FriendInfoHandler
FriendInfoHandler is used to manage friend information, including fetching 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 {
// DataKey for checking friend relationship
public static final DataKey<FriendRelationInfo> KEY_CHECK_FRIEND =
MultiDataHandler.DataKey.obtain("KEY_CHECK_FRIEND", FriendRelationInfo.class);
// DataKey for fetching friend list
public static final DataKey<List<FriendInfo>> KEY_GET_FRIENDS =
MultiDataHandler.DataKey.obtain("KEY_GET_FRIENDS",
(Class<List<FriendInfo>>) (Class<?>) List.class);
// DataKey for searching users
public static final DataKey<UserProfile> KEY_SEARCH_USER =
MultiDataHandler.DataKey.obtain("KEY_SEARCH_USER", UserProfile.class);
// DataKey for fetching specified friend information
public static final DataKey<FriendInfo> KEY_GET_FRIEND =
MultiDataHandler.DataKey.obtain("KEY_GET_FRIEND", FriendInfo.class);
// DataKey for delete friend operation result
public static final DataKey<Boolean> KEY_DELETE_FRIEND =
MultiDataHandler.DataKey.obtain("KEY_DELETE_FRIEND", Boolean.class);
// DataKey for friend request operation result
public static final DataKey<IRongCoreEnum.CoreErrorCode> KEY_APPLY_FRIEND =
MultiDataHandler.DataKey.obtain("KEY_APPLY_FRIEND", IRongCoreEnum.CoreErrorCode.class);
// DataKey for friend search results
public static final DataKey<List<FriendInfo>> KEY_SEARCH_FRIENDS =
MultiDataHandler.DataKey.obtain("KEY_SEARCH_FRIENDS",
(Class<List<FriendInfo>>) (Class<?>) List.class);
/**
* Fetch friend list
* @param directionType Query direction
* @description Fetches friend list in the specified direction, including bidirectional or unidirectional friends.
*/
public void getFriends(QueryFriendsDirectionType directionType) {
// Fetches friend list and returns results via listener callback.
}
/**
* Check friend relationship
* @param userId User ID
* @description Checks the friend relationship status for the specified user ID.
*/
public void checkFriend(String userId) {
// Checks if a friend relationship exists with the specified user, results notified via listener callback.
}
/**
* Fetch specified friend information
* @param userId User ID
* @description Fetches detailed information for the specified user ID.
*/
public void getFriendInfo(String userId) {
// Fetches friend information for the specified user, results notified via listener callback.
}
/**
* Delete friend
* @param userId User ID
* @param listener Data change listener
* @description Deletes the friend relationship for the specified user ID.
*/
public void deleteFriend(String userId, OnDataChangeListener<Boolean> listener) {
// Deletes friend relationship for the specified user, returns true on success, false on failure.
}
/**
* Send friend request
* @param userId User ID
* @param remark Request message
* @param listener Data change listener
* @description Sends a friend request to the specified user ID.
*/
public void applyFriend(
String userId,
String remark,
OnDataChangeListener<IRongCoreEnum.CoreErrorCode> listener) {
// Sends friend request to the specified user, results notified via listener callback.
}
/**
* Search user information
* @param uniqueId Unique identifier
* @description Searches user information by unique identifier.
*/
public void findUser(String uniqueId) {
// Searches user information by unique identifier, results notified via listener callback.
}
/**
* Search friend information
* @param query Query keyword
* @description Searches friend information by query keyword.
*/
public void searchFriendsInfo(String query) {
// Searches friend information by keyword, results notified via listener callback.
}
}
DataKey Descriptions
- KEY_CHECK_FRIEND: Identifies the data key for checking friend relationship, type: FriendRelationInfo.
- KEY_GET_FRIENDS: Identifies the data key for fetching friend list, type:
List<FriendInfo>. - KEY_SEARCH_USER: Identifies the data key for searching users, type: UserProfile.
- KEY_GET_FRIEND: Identifies the data key for fetching specified friend information, type: FriendInfo.
- KEY_DELETE_FRIEND: Identifies the data key for delete friend operation result, type: Boolean.
- KEY_APPLY_FRIEND: Identifies the data key for friend request operation result, type: IRongCoreEnum.CoreErrorCode.
- KEY_SEARCH_FRIENDS: Identifies the data key for friend search results, type:
List<FriendInfo>.
FriendApplicationHandler
FriendApplicationHandler is used to manage friend request operations, including fetching friend request lists, accepting friend requests, and rejecting friend requests. Below are the external interface descriptions and DataKey definitions for this handler:
public class FriendApplicationHandler extends MultiDataHandler {
// DataKey for fetching friend request list
public static final DataKey<PagingQueryResult> KEY_GET_FRIEND_APPLICATIONS =
MultiDataHandler.DataKey.obtain("KEY_GET_FRIEND_APPLICATIONS", PagingQueryResult.class);
// DataKey for accept friend request operation result
public static final DataKey<Boolean> KEY_ACCEPT_FRIEND_APPLICATIONS =
MultiDataHandler.DataKey.obtain("KEY_ACCEPT_FRIEND_APPLICATIONS", Boolean.class);
// DataKey for reject friend request operation result
public static final DataKey<Boolean> KEY_REJECT_FRIEND_APPLICATIONS =
MultiDataHandler.DataKey.obtain("KEY_REJECT_FRIEND_APPLICATIONS", Boolean.class);
/**
* Fetch friend request list
*
* @param option Pagination query parameters
* @param type Request type (received/sent)
* @param status Request status (pending, processed, etc.)
* @description Fetch friend request list, supports pagination and returns results via listener callback.
*/
public void getFriendApplications(
PagingQueryOption option,
FriendApplicationType[] type,
FriendApplicationStatus[] status) {
// Fetch friend request list
}
/**
* Accept friend request
*
* @param userId Applicant user ID
* @param listener Data change listener
* @description Accepts friend request from the specified user and returns operation result via listener callback.
*/
public void acceptFriendApplication(String userId, OnDataChangeListener<Boolean> listener) {
// Accept friend request operation
}
/**
* Reject friend request
*
* @param userId Applicant user ID
* @param listener Data change listener
* @description Rejects friend request from the specified user and returns operation result via listener callback.
*/
public void refuseFriendApplication(String userId, OnDataChangeListener<Boolean> listener) {
// Reject friend request operation
}
}
DataKey Descriptions
- KEY_GET_FRIEND_APPLICATIONS: Identifies the data key for fetching friend request list, type: PagingQueryResult.
- KEY_ACCEPT_FRIEND_APPLICATIONS: Identifies the data key for accept friend request operation result, type: Boolean.
- KEY_REJECT_FRIEND_APPLICATIONS: Identifies the data key for reject friend request operation result, type: Boolean.
UserProfileHandler
UserProfileHandler is used to manage user profile information, including fetching current user information and specified user information. Below are the external interface descriptions and DataKey definitions for this handler:
public class UserProfileHandler extends MultiDataHandler {
// DataKey for fetching user profile
public static final DataKey<UserProfile> KEY_GET_USER_PROFILE =
DataKey.obtain("KEY_GET_USER_PROFILE", UserProfile.class);
// DataKey for fetching current user profile
public static final DataKey<UserProfile> KEY_GET_MY_USER_PROFILE =
DataKey.obtain("KEY_GET_MY_USER_PROFILE", UserProfile.class);
/**
* Fetch current user profile
* @description Fetches current user profile information and returns results via listener callback.
*/
public void getMyUserProfile() {
// Fetch current user profile
}
/**
* Fetch specified user profile
*
* @param id User ID
* @description Fetches specified user profile information and returns results via listener callback.
*/
public void getUserProfile(String id) {
// Fetch specified user profile
}
}
DataKey Descriptions
- KEY_GET_USER_PROFILE: Identifies the data key for fetching specified user profile, type: UserProfile.
- KEY_GET_MY_USER_PROFILE: Identifies the data key for fetching current user profile, type: UserProfile.
UserProfileOperationsHandler
UserProfileOperationsHandler is used to manage user profile update operations, including updating current user information and setting friend information. Below are the external interface descriptions and DataKey definitions for this handler:
public class UserProfileOperationsHandler extends MultiDataHandler {
// DataKey for update user profile operation result
public static final DataKey<Boolean> KEY_UPDATE_MY_USER_PROFILE =
DataKey.obtain("KEY_UPDATE_MY_USER_PROFILE", Boolean.class);
// DataKey for set friend info operation result
public static final DataKey<Boolean> KEY_SET_FRIEND_INFO =
DataKey.obtain("KEY_SET_FRIEND_INFO", Boolean.class);
/**
* Update user profile
* @param userProfile User profile
* @description Updates current user profile information, operation result notified via listener callback.
*/
public void updateMyUserProfile(UserProfile userProfile) {
// Update current user profile
}
/**
* 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 via listener callback.
*/
public void setFriendInfo(final String userId, final String remark, final Map<String, String> extProfile) {
// Set friend information
}
}
DataKey Descriptions
- KEY_UPDATE_MY_USER_PROFILE: Identifies the data key for update current user profile operation result, type: Boolean.
- KEY_SET_FRIEND_INFO: Identifies the data key for set friend information operation result, type: Boolean.
ConversationOperationsHandler
ConversationOperationsHandler is primarily used to handle conversation operations, such as setting conversation notification status and pin status. It uses DataKey to identify different data operation types for easy monitoring and handling. Below are the external interface descriptions and DataKey definitions for this handler:
public class ConversationOperationsHandler extends MultiDataHandler {
// DataKey for setting conversation notification status
public static final DataKey<Conversation.ConversationNotificationStatus>
KEY_SET_CONVERSATION_NOTIFICATION_STATUS =
DataKey.obtain("KEY_SET_CONVERSATION_NOTIFICATION_STATUS", Conversation.ConversationNotificationStatus.class);
// DataKey for setting conversation pin status
public static final DataKey<Boolean>
KEY_SET_CONVERSATION_TO_TOP =
DataKey.obtain("KEY_SET_CONVERSATION_TO_TOP", Boolean.class);
@NonNull
private final ConversationIdentifier conversationIdentifier;
public ConversationOperationsHandler(@NonNull ConversationIdentifier conversationIdentifier) {
this.conversationIdentifier = conversationIdentifier;
}
/**
* Set conversation notification status
* @param conversationNotificationStatus Conversation notification status
* @description Sets notification status for the specified conversation and notifies caller via listener callback.
*/
public void setConversationNotificationStatus(Conversation.ConversationNotificationStatus conversationNotificationStatus) {
// Set notification status for the specified conversation
}
/**
* Set conversation pin status
* @param isTop Whether to pin
* @description Sets pin status for the specified conversation and notifies caller via listener callback.
*/
public void setConversationToTop(boolean isTop) {
// Set pin status for the specified conversation
}
}
DataKey Descriptions
- KEY_SET_CONVERSATION_NOTIFICATION_STATUS: Identifies the data key for setting conversation notification status, type: Conversation.ConversationNotificationStatus.
- KEY_SET_CONVERSATION_TO_TOP: Identifies the data key for setting conversation pin status, type: Boolean.
ConversationStatusHandler
ConversationStatusHandler is primarily used to fetch conversation notification status and pin status. It uses DataKey to identify different data operation types for easy monitoring and handling. Below are the external interface descriptions and DataKey definitions for ConversationStatusHandler:
public class ConversationStatusHandler extends MultiDataHandler {
// DataKey for fetching conversation notification status
public static final DataKey<Conversation.ConversationNotificationStatus>
KEY_GET_CONVERSATION_NOTIFICATION_STATUS =
DataKey.obtain("KEY_GET_CONVERSATION_NOTIFICATION_STATUS", Conversation.ConversationNotificationStatus.class);
// DataKey for fetching conversation pin status
public static final DataKey<Boolean>
KEY_GET_CONVERSATION_TOP_STATUS =
DataKey.obtain("KEY_GET_CONVERSATION_TOP_STATUS", Boolean.class);
public ConversationStatusHandler(@NonNull ConversationIdentifier conversationIdentifier) {
this.conversationIdentifier = conversationIdentifier;
}
/**
* Fetch conversation notification status
* @description Fetches notification status for the specified conversation and notifies caller via listener callback.
*/
public void getConversationNotificationStatus() {
// This method fetches notification status for the specified conversation.
// On success, returns notification status via listener callback; on failure, returns error code.
}
/**
* Fetch conversation pin status
* @description Fetches pin status for the specified conversation and notifies caller via listener callback.
*/
public void getConversationTopStatus() {
// This method fetches pin status for the specified conversation.
// On success, returns pin status via listener callback; on failure, returns error code.
}
}
DataKey Descriptions
- KEY_GET_CONVERSATION_NOTIFICATION_STATUS: Identifies the data key for fetching conversation notification status, type: Conversation.ConversationNotificationStatus.
- KEY_GET_CONVERSATION_TOP_STATUS: Identifies the data key for fetching conversation pin status, type: Boolean.
GroupApplicationOperationsHandler
GroupApplicationOperationsHandler is primarily used to handle group application and invitation operations, including accepting or rejecting group invitations and applications. It uses DataKey to identify different data operation types for easy monitoring and handling. Below are the external interface descriptions and DataKey definitions for GroupApplicationOperationsHandler:
public class GroupApplicationOperationsHandler extends MultiDataHandler {
// DataKey for accepting group invitation operation
public static final DataKey<Boolean>
KEY_ACCEPT_GROUP_INVITE =
DataKey.obtain("KEY_ACCEPT_GROUP_INVITE", Boolean.class);
// DataKey for rejecting group invitation operation
public static final DataKey<Boolean>
KEY_REFUSE_GROUP_INVITE =
DataKey.obtain("KEY_REFUSE_GROUP_INVITE", Boolean.class);
// DataKey for accepting group application operation
public static final DataKey<IRongCoreEnum.CoreErrorCode>
KEY_ACCEPT_GROUP_APPLICATION =
DataKey.obtain("KEY_ACCEPT_GROUP_APPLICATION", IRongCoreEnum.CoreErrorCode.class);
// DataKey for rejecting group application operation
public static final DataKey<Boolean>
KEY_REFUSE_GROUP_APPLICATION =
DataKey.obtain("KEY_REFUSE_GROUP_APPLICATION", Boolean.class);
public GroupApplicationOperationsHandler() {}
/**
* Accept group invitation
* @param groupId Group ID
* @param inviterId Inviter ID
* @description Accepts invitation to the specified group and notifies caller via listener callback.
*/
public void acceptGroupInvite(String groupId, String inviterId) {
// On success, returns true via listener callback; on failure, returns error code.
}
/**
* Reject group invitation
* @param groupId Group ID
* @param inviterId Inviter ID
* @param reason Rejection reason
* @description Rejects invitation to the specified group and notifies caller via listener callback.
*/
public void refuseGroupInvite(String groupId, String inviterId, String reason) {
// On success, returns true via listener callback; on failure, returns error code.
}
/**
* Accept group application
* @param groupId Group ID
* @param inviterId Inviter ID
* @param applicantId Applicant ID
* @description Accepts the specified applicant's request to join the group and notifies caller via listener callback.
*/
public void acceptGroupApplication(String groupId, String inviterId, String applicantId) {
// On success, returns operation result code via listener callback; on failure, returns error code.
}
/**
* Reject group application
* @param groupId Group ID
* @param inviterId Inviter ID
* @param applicantId Applicant ID
* @param reason Rejection reason
* @description Rejects the specified applicant's request to join the group and notifies caller via listener callback.
*/
public void refuseGroupApplication(String groupId, String inviterId, String applicantId, String reason) {
// On success, returns true via listener callback; on failure, returns error code.
}
}
DataKey Descriptions
- KEY_ACCEPT_GROUP_INVITE: Identifies the operation for accepting group invitation, type: Boolean, indicates whether operation succeeded.
- KEY_REFUSE_GROUP_INVITE: Identifies the operation for rejecting group invitation, type: Boolean, indicates whether operation succeeded.
- KEY_ACCEPT_GROUP_APPLICATION: Identifies the operation for accepting group application, type: IRongCoreEnum.CoreErrorCode, represents operation result code.
- KEY_REFUSE_GROUP_APPLICATION: Identifies the operation for rejecting group application, type: Boolean, indicates whether operation succeeded.
GroupApplicationsPagedHandler
GroupApplicationsPagedHandler is primarily used to fetch group application data with pagination, supporting filtering by direction and status, and implements the OnPagedDataLoader interface to load more data. It uses DataKey to identify different data operation types for easy monitoring and handling. Below are the external interface descriptions and DataKey definitions for GroupApplicationsPagedHandler:
public class GroupApplicationsPagedHandler extends MultiDataHandler implements OnPagedDataLoader {
private static final String TAG = GroupApplicationsPagedHandler.class.getSimpleName();
// DataKey for fetching group application data
public static final DataKey<List<GroupApplicationInfo>>
KEY_GET_GROUP_APPLICATIONS =
DataKey.obtain("KEY_GET_GROUP_APPLICATIONS",
(Class<List<GroupApplicationInfo>>) (Class<?>) List.class);
// DataKey for load more status
private static final DataKey<Boolean>
KEY_LOAD_MORE =
DataKey.obtain("KEY_LOAD_MORE", Boolean.class);
public GroupApplicationsPagedHandler() {
this(50);
}
public GroupApplicationsPagedHandler(int pageCount) {
this.pageCount = pageCount;
}
/**
* Fetch group applications
* @param directions Application directions
* @param status Application status
* @description Fetches group application data by direction and status, and notifies caller via listener callback.
*/
public void getGroupApplications(
final GroupApplicationDirection[] directions, final GroupApplicationStatus[] status) {
}
/**
* Load next page of group application data
* @param listener Data change listener
*/
@Override
public void loadNext(OnDataChangeListener<Boolean> listener) {
replaceDataChangeListener(KEY_LOAD_MORE, listener);
getGroupApplicationsByPage(currentDirections, currentStatus, nextPageToken);
}
/**
* Check if more data is available
* @return Whether more data is available
*/
@Override
public boolean hasNext() {
return !TextUtils.isEmpty(nextPageToken);
}
}
DataKey Descriptions
- KEY_GET_GROUP_APPLICATIONS: Identifies the key for fetching group application data, type:
List<GroupApplicationInfo>, represents fetched group application data. - KEY_LOAD_MORE: Identifies the key for load more operation, type: Boolean, indicates whether more data can be loaded.
GroupJoinedPagedHandler
GroupJoinedPagedHandler is primarily used to fetch paginated lists of groups that the user has joined with specific roles, supporting filtering by role and implementing the OnPagedDataLoader interface to load more data. It uses DataKey to identify different data operation types for easy monitoring and handling. Below are the external interface descriptions and DataKey definitions for GroupJoinedPagedHandler:
public class GroupJoinedPagedHandler extends MultiDataHandler implements OnPagedDataLoader {
private static final String TAG = GroupJoinedPagedHandler.class.getSimpleName();
// DataKey for fetching joined groups by role
public static final DataKey<List<GroupInfo>>
KEY_GET_JOINED_GROUPS_BY_ROLE =
DataKey.obtain("KEY_GET_JOINED_GROUPS_BY_ROLE",
(Class<List<GroupInfo>>) (Class<?>) List.class);
public GroupJoinedPagedHandler() {
this(50);
}
public GroupJoinedPagedHandler(int pageCount) {
this.pageCount = pageCount;
}
/**
* Fetch joined groups
* @param groupMemberRole Group member role
* @description Fetches groups that the current user has joined with the specified role and notifies caller via listener callback.
*/
public void getJoinedGroupsByRole(@NonNull GroupMemberRole groupMemberRole) {
}
/**
* Load next page of group data
* @param listener Data change listener
*/
@Override
public void loadNext(OnDataChangeListener<Boolean> listener) {
replaceDataChangeListener(KEY_LOAD_MORE, listener);
getJoinedGroupsByRoleByPage(currentGroupMemberRole, nextPageToken);
}
/**
* Check if more data is available
* @return Whether more data is available
*/
@Override
public boolean hasNext() {
return !TextUtils.isEmpty(nextPageToken);
}
}
DataKey Descriptions
- KEY_GET_JOINED_GROUPS_BY_ROLE: Identifies the key for fetching joined groups by role, type:
List<GroupInfo>, represents fetched group list. - KEY_LOAD_MORE: Identifies the key for load more operation, type: Boolean, indicates whether more data can be loaded.
GroupJoinedSearchPagedHandler
GroupJoinedSearchPagedHandler is primarily used to search paginated lists of groups that the user has joined, supporting filtering by group name and implementing the OnPagedDataLoader interface to load more data. It uses DataKey to identify different data operation types for easy monitoring and handling. Below are the external interface descriptions and DataKey definitions for GroupJoinedSearchPagedHandler:
public class GroupJoinedSearchPagedHandler extends MultiDataHandler implements OnPagedDataLoader {
private static final String TAG = GroupJoinedSearchPagedHandler.class.getSimpleName();
// DataKey for searching joined groups
public static final DataKey<List<GroupInfo>>
KEY_SEARCH_JOINED_GROUPS =
DataKey.obtain("KEY_SEARCH_JOINED_GROUPS", (Class<List<GroupInfo>>) (Class<?>) List.class);
// DataKey for load more status
private static final DataKey<Boolean>
KEY_LOAD_MORE =
DataKey.obtain("KEY_LOAD_MORE", Boolean.class);
public GroupJoinedSearchPagedHandler() {
this(50);
}
public GroupJoinedSearchPagedHandler(int pageCount) {
this.pageCount = pageCount;
}
/**
* Search joined groups
* @param groupName Group name
* @description Searches groups that the current user has joined by group name and notifies caller via listener callback.
*/
public void searchJoinedGroups(@NonNull String groupName) {
}
/**
* Load next page of group data
* @param listener Data change listener
*/
@Override
public void loadNext(OnDataChangeListener<Boolean> listener) {
}
/**
* Check if more data is available
* @return Whether more data is available
*/
@Override
public boolean hasNext() {
return !TextUtils.isEmpty(nextPageToken);
}
}
DataKey Descriptions
- KEY_SEARCH_JOINED_GROUPS: Identifies the key for searching joined groups, type:
List<GroupInfo>, represents search result group list. - KEY_LOAD_MORE: Identifies the key for load more operation, type: Boolean, indicates whether more data can be loaded.
GroupMembersByUserIdsHandler
GroupMembersByUserIdsHandler is used to fetch group member information based on a list of user IDs, supporting batch processing of large user lists while monitoring group events to handle member information updates. It uses DataKey to identify different data operation types for easy monitoring and handling.
public class GroupMembersByUserIdsHandler extends MultiDataHandler {
private static final String TAG = GroupMembersByUserIdsHandler.class.getSimpleName();
// DataKey for fetching group member data
public static final DataKey<List<GroupMemberInfo>>
KEY_GET_GROUP_MEMBERS =
MultiDataHandler.DataKey.obtain("KEY_GET_GROUP_MEMBERS",
(Class<List<GroupMemberInfo>>) (Class<?>) List.class);
public GroupMembersByUserIdsHandler(@NonNull ConversationIdentifier conversationIdentifier) {
this.groupId = conversationIdentifier.getTargetId();
}
/**
* Fetch group member information
* @param userIds User ID list
* @description Fetches group member information based on user ID list, supports batch processing and notifies caller via listener callback.
*/
public void getGroupMembers(List<String> userIds) {
}
}
DataKey Descriptions
- KEY_GET_GROUP_MEMBERS: Identifies the key for fetching group member data, type:
List<GroupMemberInfo>, represents fetched group member information list.
GroupMembersSearchPagedHandler
GroupMembersSearchPagedHandler is used to search group members with pagination, supporting filtering members by name and implementing the OnPagedDataLoader interface to load more data. It uses DataKey to identify different data operation types for easy monitoring and handling.
public class GroupMembersSearchPagedHandler extends MultiDataHandler implements OnPagedDataLoader {
private static final String TAG = GroupMembersSearchPagedHandler.class.getSimpleName();
// DataKey for searching group member data
public static final DataKey<List<GroupMemberInfo>>
KEY_SEARCH_GROUP_MEMBERS =
DataKey.obtain("KEY_SEARCH_GROUP_MEMBERS",
(Class<List<GroupMemberInfo>>) (Class<?>) List.class);
// DataKey for load more status
private static final DataKey<Boolean>
KEY_LOAD_MORE =
DataKey.obtain("KEY_LOAD_MORE", Boolean.class);
public GroupMembersSearchPagedHandler(@NonNull ConversationIdentifier conversationIdentifier) {
this(conversationIdentifier, 50);
}
public GroupMembersSearchPagedHandler(
@NonNull ConversationIdentifier conversationIdentifier, int pageCount) {
this.pageCount = pageCount;
this.groupId = conversationIdentifier.getTargetId();
}
/**
* Search group members
* @param name Member name
* @description Searches group members by member name with pagination and notifies caller via listener callback.
*/
public void searchGroupMembers(@NonNull String name) {
}
/**
* Load next page of group member data
* @param listener Data change listener
*/
@Override
public void loadNext(OnDataChangeListener<Boolean> listener) {
}
/**
* Check if more data is available
* @return Whether more data is available
*/
@Override
public boolean hasNext() {
return !TextUtils.isEmpty(nextPageToken);
}
}
DataKey Descriptions
- KEY_SEARCH_GROUP_MEMBERS: Identifies the key for searching group member data, type:
List<GroupMemberInfo>, represents search result group member list. - KEY_LOAD_MORE: Identifies the key for load more operation, type: Boolean, indicates whether more data can be loaded.