androidx.recyclerview.widget.AsyncListDiffer Java Examples

The following examples show how to use androidx.recyclerview.widget.AsyncListDiffer. 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: AsyncListDifferDelegationAdapter.java    From AdapterDelegates with Apache License 2.0 5 votes vote down vote up
public AsyncListDifferDelegationAdapter(@NonNull DiffUtil.ItemCallback<T> diffCallback,
                                        @NonNull AdapterDelegatesManager<List<T>> delegatesManager) {

    if (diffCallback == null) {
        throw new NullPointerException("ItemCallback is null");
    }

    if (delegatesManager == null) {
        throw new NullPointerException("AdapterDelegatesManager is null");
    }
    this.differ = new AsyncListDiffer<T>(this, diffCallback);
    this.delegatesManager = delegatesManager;
}
 
Example #2
Source File: AsyncListDifferDelegationAdapter.java    From AdapterDelegates with Apache License 2.0 5 votes vote down vote up
public AsyncListDifferDelegationAdapter(@NonNull AsyncDifferConfig differConfig,
                                        @NonNull AdapterDelegatesManager<List<T>> delegatesManager) {

    if (differConfig == null) {
        throw new NullPointerException("AsyncDifferConfig is null");
    }

    if (delegatesManager == null) {
        throw new NullPointerException("AdapterDelegatesManager is null");
    }

    this.differ = new AsyncListDiffer<T>(new AdapterListUpdateCallback(this), differConfig);
    this.delegatesManager = delegatesManager;
}
 
Example #3
Source File: AsyncListDifferDelegationAdapter.java    From AdapterDelegates with Apache License 2.0 5 votes vote down vote up
/**
 * Adds a list of {@link AdapterDelegate}s
 *
 * @param delegates
 * @since 4.2.0
 */
public AsyncListDifferDelegationAdapter(@NonNull DiffUtil.ItemCallback<T> diffCallback,
                                        @NonNull AdapterDelegate<List<T>>... delegates) {

    if (diffCallback == null) {
        throw new NullPointerException("ItemCallback is null");
    }
    
    this.differ = new AsyncListDiffer<T>(this, diffCallback);
    this.delegatesManager = new AdapterDelegatesManager<List<T>>(delegates);
}
 
Example #4
Source File: AsyncListDifferDelegationAdapter.java    From AdapterDelegates with Apache License 2.0 5 votes vote down vote up
/**
 * Adds a list of {@link AdapterDelegate}s
 *
 * @param delegates
 * @since 4.2.0
 */
public AsyncListDifferDelegationAdapter(@NonNull AsyncDifferConfig differConfig,
                                        @NonNull AdapterDelegate<List<T>>... delegates) {

    if (differConfig == null) {
        throw new NullPointerException("AsyncDifferConfig is null");
    }

    this.differ = new AsyncListDiffer<T>(new AdapterListUpdateCallback(this), differConfig);
    this.delegatesManager = new AdapterDelegatesManager<List<T>>(delegates);
}
 
Example #5
Source File: DifferFlapAdapter.java    From Flap with Apache License 2.0 4 votes vote down vote up
public DifferFlapAdapter(final @NonNull DiffUtil.ItemCallback<T> itemCallback) {
    differ = new AsyncListDiffer(this, itemCallback);
}
 
Example #6
Source File: DifferFlapAdapter.java    From Flap with Apache License 2.0 4 votes vote down vote up
public DifferFlapAdapter(@NonNull AsyncDifferConfig<T> config) {
    differ = new AsyncListDiffer(new AdapterListUpdateCallback(this), config);
}
 
Example #7
Source File: RendererRecyclerViewAdapter.java    From RendererRecyclerViewAdapter with Apache License 2.0 4 votes vote down vote up
@NonNull
private AsyncListDiffer<ViewModel> createDiffer(@NonNull final DiffCallback<? extends ViewModel> diffCallback, final boolean async) {
	return (AsyncListDiffer<ViewModel>) new AsyncListDiffer<>(getListUpdateCallback(), getConfig(diffCallback, async));
}