Skip to main content

tip

This feature is supported starting from version 5.12.2.

My Groups Page

The My Groups page displays all groups the current user has joined. Upon entering this page, the SDK automatically retrieves group information from the database. IMKit provides RCMyGroupsViewController, a group page class based on UITableView.

My Groups Page (Group List)

The group list page displays all groups the user has joined, supporting group search, entering group chats via click, and long-press operations. Below are detailed descriptions of related components:

  • GroupListActivity: Container class for the group list page, responsible for loading and displaying GroupListFragment.
  • GroupListFragment: Core component of the group list page, displaying the user's joined groups and handling user interactions.
  • GroupListViewModel: Handles data and business logic, retrieving the user's joined group data from the server or local storage and passing it to GroupListFragment.
  • XML Layout: rc_page_group_list.xml

Launching the Group List Page

int pageCount = 50;  // Number of items per page (default: 50)
startActivity(GroupListActivity.newIntent(this, pageCount));

Customizing the Group List Page

// Custom GroupListFragment
public class CustomGroupListFragment extends GroupListFragment {

@Override
protected void onViewReady(@NonNull GroupListViewModel viewModel) {
super.onViewReady(viewModel);
// Override search click event
searchComponent.setSearchClickListener(
v -> startActivity(GroupSearchActivity.newIntent(getContext())));
}

/**
* Click on a group
*
* @param groupInfo Group information
*/
protected void onGroupItemClick(GroupInfo groupInfo) {

}

/**
* Long-press on a group
*
* @param groupInfo Group information
*/
protected void onGroupItemLongClick(GroupInfo groupInfo) {}
}

Group Search Page

The group search page allows users to search and quickly locate joined groups. Below are detailed descriptions of related components:

  • GroupSearchActivity: Container class for the group search page, responsible for loading and displaying GroupSearchFragment.
  • GroupSearchFragment: Core component of the group search page, displaying search results and handling user interactions.
  • GroupSearchViewModel: Handles data and business logic, searching the user's joined groups from the server or local storage and passing results to GroupSearchFragment.
  • XML Layout: rc_page_group_search.xml

Launching the Group Search Page

int pageCount = 50;  // Number of items per page (default: 50)
startActivity(GroupSearchActivity.newIntent(this, pageCount));

Customizing the Group Search Page

// Custom GroupSearchFragment
public class CustomGroupSearchFragment extends GroupSearchFragment {

/**
* Click on a group
*
* @param groupInfo Group information
*/
protected void onGroupItemClick(GroupInfo groupInfo) {

}

/**
* Long-press on a group
*
* @param groupInfo Group information
*/
protected void onGroupItemLongClick(GroupInfo groupInfo) {}
}