Skip to main content

Friend list page

Friend list page overview

The FriendList page displays all friends of the current user and supports search and friend detail viewing. The following components make up the FriendList page:

  • FriendListActivity: The container class that loads and displays FriendListFragment.
  • FriendListFragment: The core component that displays the friend list, search box, and other UI elements, and handles user input and interactions.
  • FriendListViewModel: The data and business logic handler that retrieves friend list data and passes it to FriendListFragment.
  • XML layout file: nc_page_friend_list.xml

Page structure

The friend list page typically includes a navigation bar, search box, and contact list.

Friend list page

Customization

Chat UI SDK provides customizable styling for the friend list page.

Launch the friend list page

Java
startActivity(FriendListActivity.newIntent(this));

Customize

See Page customization design for custom Fragment details.

Customization includes the title, search box click, friend request click, and contact friend click.

Java
// Custom CustomFriendListFragment
public class CustomFriendListFragment extends FriendListFragment {

@Override
protected void onViewReady(@NonNull FriendListViewModel viewModel) {
super.onViewReady(viewModel);

// Change title text
headComponent.setTitleText("New Title");

// Override title bar back button click event
headComponent.setLeftClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

}
});

// Override friend request click event
headComponent.setRightClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

}
});
// Set title bar right button icon
headComponent.setRightTextDrawable(R.drawable.nc_lively_right_arrow_light);


// Override search click event
searchComponent.setSearchClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

}
});


// Set contact list click event
contactListComponent.setOnContactClickListener(new OnContactClickListener() {
@Override
public void onContactClick(ContactModel contactModel) {

}
});
}
}