Skip to content

Customization of Load More Indicator

Vitaly Vivchar edited this page Feb 17, 2018 · 3 revisions

Step 1: Extend the LoadMoreItemModel

public class CustomLoadMoreModel extends LoadMoreItemModel {

	public CustomLoadMoreModel (String yourData) {
		mYourData = yourData;
	}
    
	public String getYourData() {
		return mYourData;
	}
}

Step 2: Extend the LoadMoreViewHolder

public class CustomLoadMoreViewHolder extends LoadMoreViewHolder {

	TextView yourDataTextView

	public CustomLoadMoreViewHolder(View itemView) {
		super(itemView);
		yourDataTextView = itemView.findViewById(R.id.yourId);
	}
}

Step 3: Extend the LoadMoreViewRenderer or create new one

public class CustomLoadMoreViewRenderer extends LoadMoreViewRenderer<CustomLoadMoreItemModel, CustomLoadMoreViewHolder> {

	@Override
	public void bindView(@NonNull final CustomLoadMoreItemModel model, @NonNull final CustomLoadMoreViewHolder holder) {
		holder.yourDataTextView.setText(model.getYourData());
	}
}

Step 4: Replace a old LoadMoreViewRenderer to new

//mRecyclerViewAdapter.registerRenderer(new LoadMoreViewRenderer(...));
mRecyclerViewAdapter.registerRenderer(new CustomLoadMoreViewRenderer(...));

Step 5: Set new CustomLoadMoreModel to your adapter before using

mRecyclerViewAdapter.setLoadMoreModel(new CustomLoadMoreModel(...))