androidx.recyclerview.widget.RecyclerView#RecycledViewPool ( )源码实例Demo

下面列出了androidx.recyclerview.widget.RecyclerView#RecycledViewPool ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: mollyim-android   文件: ConversationAdapter.java
/**
 * 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);
}
 
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);
}
 
源代码3 项目: SAI   文件: BackupPackagesAdapter.java
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);
}
 
源代码4 项目: SAI   文件: BackupAppDetailsAdapter.java
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);
}
 
源代码5 项目: TableView   文件: CellRecyclerViewAdapter.java
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);
}
 
/**
 * 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;
}
 
/**
 * 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;
}