public abstract class

SortedListAdapterCallback<T2>

extends SortedList.Callback<java.lang.Object>

 java.lang.Object

androidx.recyclerview.widget.SortedList.Callback<java.lang.Object>

↳androidx.recyclerview.widget.SortedListAdapterCallback<T2>

Gradle dependencies

compile group: 'androidx.recyclerview', name: 'recyclerview', version: '1.3.0-alpha02'

  • groupId: androidx.recyclerview
  • artifactId: recyclerview
  • version: 1.3.0-alpha02

Artifact androidx.recyclerview:recyclerview:1.3.0-alpha02 it located at Google repository (https://maven.google.com/)

Androidx artifact mapping:

androidx.recyclerview:recyclerview com.android.support:recyclerview-v7

Androidx class mapping:

androidx.recyclerview.widget.SortedListAdapterCallback android.support.v7.widget.util.SortedListAdapterCallback

Overview

A SortedList.Callback implementation that can bind a SortedList to a RecyclerView.Adapter.

Summary

Constructors
publicSortedListAdapterCallback(RecyclerView.Adapter adapter)

Creates a SortedList.Callback that will forward data change events to the provided Adapter.

Methods
public abstract voidonChanged(int position, int count)

Called by the SortedList when the item at the given position is updated.

public voidonChanged(int position, int count, java.lang.Object payload)

public voidonInserted(int position, int count)

public voidonMoved(int fromPosition, int toPosition)

public voidonRemoved(int position, int count)

from SortedList.Callback<T2>areContentsTheSame, areItemsTheSame, compare, getChangePayload
from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public SortedListAdapterCallback(RecyclerView.Adapter adapter)

Creates a SortedList.Callback that will forward data change events to the provided Adapter.

Parameters:

adapter: The Adapter instance which should receive events from the SortedList.

Methods

public void onInserted(int position, int count)

public void onRemoved(int position, int count)

public void onMoved(int fromPosition, int toPosition)

public abstract void onChanged(int position, int count)

Called by the SortedList when the item at the given position is updated.

Parameters:

position: The position of the item which has been updated.
count: The number of items which has changed.

public void onChanged(int position, int count, java.lang.Object payload)

Source

/*
 * Copyright 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package androidx.recyclerview.widget;

/**
 * A {@link SortedList.Callback} implementation that can bind a {@link SortedList} to a
 * {@link RecyclerView.Adapter}.
 */
public abstract class SortedListAdapterCallback<T2> extends SortedList.Callback<T2> {

    final RecyclerView.Adapter mAdapter;

    /**
     * Creates a {@link SortedList.Callback} that will forward data change events to the provided
     * Adapter.
     *
     * @param adapter The Adapter instance which should receive events from the SortedList.
     */
    public SortedListAdapterCallback(RecyclerView.Adapter adapter) {
        mAdapter = adapter;
    }

    @Override
    public void onInserted(int position, int count) {
        mAdapter.notifyItemRangeInserted(position, count);
    }

    @Override
    public void onRemoved(int position, int count) {
        mAdapter.notifyItemRangeRemoved(position, count);
    }

    @Override
    public void onMoved(int fromPosition, int toPosition) {
        mAdapter.notifyItemMoved(fromPosition, toPosition);
    }

    @Override
    public void onChanged(int position, int count) {
        mAdapter.notifyItemRangeChanged(position, count);
    }

    @Override
    public void onChanged(int position, int count, Object payload) {
        mAdapter.notifyItemRangeChanged(position, count, payload);
    }
}