tip
This feature is supported starting from version 5.12.0.
Friend Request List Page
The ApplyFriendList
page displays and manages friend request lists. Users can view received and sent friend requests on this page, and perform accept or reject actions. Below are detailed descriptions of the components related to the ApplyFriendList
page:
- ApplyFriendListActivity: The container class for the friend request list page, responsible for loading and displaying
ApplyFriendListFragment
. - ApplyFriendListFragment: The core component of the friend request list page, responsible for displaying the friend request list, handling request actions (accept or reject), and providing filtering and refresh functionality.
- ApplyFriendViewModel: The data and business logic handler, responsible for fetching friend request list data and processing accept or reject actions.
- XML Layout:
rc_page_friend_list_apply.xml
The friend request list page generally consists of two parts: the navigation bar and the friend request list.


Customization
For details, refer to the User Profile Hosting Page Design section on custom fragments.
The styling of IMKit's friend request list interface can be customized.
Launching the Friend Request List Page
startActivity(ApplyFriendListActivity.newIntent(getContext()));
Title Bar, Navigation Buttons, and Friend Request Click Events
// Custom CustomApplyFriendListFragment
public class CustomApplyFriendListFragment extends ApplyFriendListFragment {
@Override
protected void onViewReady(@NonNull ApplyFriendViewModel viewModel) {
super.onViewReady(viewModel);
// Change the title text
headComponent.setTitleText("New Title");
// Override the title bar back button click event
headComponent.setLeftClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
// Override search functionality
searchComponent.setSearchQueryListener(
new SearchComponent.OnSearchQueryListener() {
@Override
public void onSearch(String query) {
// Search input callback
}
@Override
public void onClickSearch(String query) {
// Search button click callback
}
});
}
// Friend request accept click
@Override
protected void onFriendApplyAcceptClick(UiFriendApplicationInfo uiFriendApplicationInfo) {
}
// Friend request reject click
@Override
protected void onFriendApplyRejectClick(UiFriendApplicationInfo uiFriendApplicationInfo) {
}
}
Custom List Functionality
The data list supports custom time grouping intervals.
// Custom ViewModel (e.g., CustomApplyFriendViewModel)
public class CustomApplyFriendViewModel extends ApplyFriendViewModel {
public CustomApplyFriendViewModel(@NonNull Bundle arguments) {
super(arguments);
}
// Override the getTimeLabel method to return the display string
@Override
protected @StringRes int getTimeLabel(long timestamp) {
}
}