To display custom text (like section headers) in the fast scroll popup, implement the PopupTextProvider interface. You can either pass this provider directly to the RecyclerViewHelper constructor or implement it within your RecyclerView.Adapter.
When implemented, getPopupText(RecyclerView view, int position) will be called to retrieve the label for the item at the current scroll position.
// Option 1: Implement in your Adapter
public class MyAdapter extends RecyclerView.Adapter<MyViewHolder> implements PopupTextProvider {
@Override
public CharSequence getPopupText(@NonNull RecyclerView view, int position) {
return "Section " + position;
}
}
// Option 2: Pass a separate provider to RecyclerViewHelper
PopupTextProvider myProvider = new PopupTextProvider() {
@Override
public CharSequence getPopupText(@NonNull RecyclerView view, int position) {
return "Label " + position;
}
};
RecyclerViewHelper helper = new RecyclerViewHelper(recyclerView, myProvider);