Java Code Examples for androidx.recyclerview.widget.RecyclerView#RecycledViewPool

The following examples show how to use androidx.recyclerview.widget.RecyclerView#RecycledViewPool . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConversationAdapter.java    From mollyim-android with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Provided a pool, this will initialize it with view counts that make sense.
 */
@MainThread
static void initializePool(@NonNull RecyclerView.RecycledViewPool pool) {
  pool.setMaxRecycledViews(MESSAGE_TYPE_INCOMING_TEXT, 15);
  pool.setMaxRecycledViews(MESSAGE_TYPE_INCOMING_MULTIMEDIA, 15);
  pool.setMaxRecycledViews(MESSAGE_TYPE_OUTGOING_TEXT, 15);
  pool.setMaxRecycledViews(MESSAGE_TYPE_OUTGOING_MULTIMEDIA, 15);
  pool.setMaxRecycledViews(MESSAGE_TYPE_PLACEHOLDER, 15);
  pool.setMaxRecycledViews(MESSAGE_TYPE_HEADER, 1);
  pool.setMaxRecycledViews(MESSAGE_TYPE_FOOTER, 1);
  pool.setMaxRecycledViews(MESSAGE_TYPE_UPDATE, 5);
}
 
Example 2
Source File: CellRecyclerViewAdapter.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public CellRecyclerViewAdapter(Context context, List<C> itemList, ITableView tableView) {
    super(context, itemList);
    this.mTableView = tableView;

    // Create view pool to share Views between multiple RecyclerViews.
    mRecycledViewPool = new RecyclerView.RecycledViewPool();
    //TODO set the right value.
    //mRecycledViewPool.setMaxRecycledViews(0, 110);
}
 
Example 3
Source File: BackupPackagesAdapter.java    From SAI with GNU General Public License v3.0 5 votes vote down vote up
public BackupPackagesAdapter(Selection<String> selection, LifecycleOwner lifecycleOwner, Context c) {
    super(selection, lifecycleOwner);

    mInflater = LayoutInflater.from(c);
    setHasStableIds(true);

    mFeatureViewPool = new RecyclerView.RecycledViewPool();
    mFeatureViewPool.setMaxRecycledViews(0, 16);
}
 
Example 4
Source File: BackupAppDetailsAdapter.java    From SAI with GNU General Public License v3.0 5 votes vote down vote up
public BackupAppDetailsAdapter(Context context, Selection<String> selection, LifecycleOwner lifecycleOwner, ActionDelegate actionDelegate) {
    super(selection, lifecycleOwner);
    mContext = context;
    mInflater = LayoutInflater.from(context);
    mActionDelegate = actionDelegate;

    mComponentViewPool = new RecyclerView.RecycledViewPool();
    mComponentViewPool.setMaxRecycledViews(0, 16);

    setHasStableIds(true);
}
 
Example 5
Source File: CellRecyclerViewAdapter.java    From TableView with MIT License 5 votes vote down vote up
public CellRecyclerViewAdapter(@NonNull Context context, @Nullable List<C> itemList, @NonNull ITableView tableView) {
    super(context, itemList);
    this.mTableView = tableView;

    // Create view pool to share Views between multiple RecyclerViews.
    mRecycledViewPool = new RecyclerView.RecycledViewPool();
    //TODO set the right value.
    //mRecycledViewPool.setMaxRecycledViews(0, 110);
}
 
Example 6
Source File: CompositeViewRenderer.java    From RendererRecyclerViewAdapter with Apache License 2.0 2 votes vote down vote up
/**
 * Recycled view pools allow multiple RecyclerViews to share a common pool of scrap views.
 * This can be useful if you have multiple RecyclerViews with adapters that use the same
 * view types, for example if you have several data sets with the same kinds of item views
 * displayed by a {@link ViewPager ViewPager}.
 *
 * @param pool Pool to set. If this parameter is null a new pool will be created and used.
 */
@NonNull
public CompositeViewRenderer<M, VH> setRecycledViewPool(@Nullable final RecyclerView.RecycledViewPool pool) {
	mRecycledViewPool = pool;
	return this;
}
 
Example 7
Source File: RendererRecyclerViewAdapter.java    From RendererRecyclerViewAdapter with Apache License 2.0 2 votes vote down vote up
/**
 * Recycled view pools allow multiple RecyclerViews to share a common pool of scrap views.
 * This can be useful if you have multiple RecyclerViews with adapters that use the same
 * view types, for example if you have several data sets with the same kinds of item views
 * displayed by a {@link ViewPager ViewPager}.
 *
 * @param pool Pool to set. If this parameter is null a new pool will be created and used.
 */
public void setNestedRecycledViewPool(@Nullable final RecyclerView.RecycledViewPool pool) {
	mNestedRecycledViewPool = pool;
}