mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2024-12-28 01:52:26 -06:00
89 lines
3.6 KiB
Java
89 lines
3.6 KiB
Java
package androidx.databinding;
|
|
|
|
import androidx.core.util.Pools;
|
|
import androidx.databinding.CallbackRegistry;
|
|
import androidx.databinding.ObservableList;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class ListChangeRegistry extends CallbackRegistry<ObservableList.OnListChangedCallback, ObservableList, ListChanges> {
|
|
private static final int ALL = 0;
|
|
private static final int CHANGED = 1;
|
|
private static final int INSERTED = 2;
|
|
private static final int MOVED = 3;
|
|
private static final int REMOVED = 4;
|
|
private static final Pools.SynchronizedPool<ListChanges> sListChanges = new Pools.SynchronizedPool<>(10);
|
|
private static final CallbackRegistry.NotifierCallback<ObservableList.OnListChangedCallback, ObservableList, ListChanges> NOTIFIER_CALLBACK = new CallbackRegistry.NotifierCallback<ObservableList.OnListChangedCallback, ObservableList, ListChanges>() { // from class: androidx.databinding.ListChangeRegistry.1
|
|
@Override // androidx.databinding.CallbackRegistry.NotifierCallback
|
|
public void onNotifyCallback(ObservableList.OnListChangedCallback onListChangedCallback, ObservableList observableList, int i, ListChanges listChanges) {
|
|
if (i == 1) {
|
|
onListChangedCallback.onItemRangeChanged(observableList, listChanges.start, listChanges.count);
|
|
return;
|
|
}
|
|
if (i == 2) {
|
|
onListChangedCallback.onItemRangeInserted(observableList, listChanges.start, listChanges.count);
|
|
return;
|
|
}
|
|
if (i == 3) {
|
|
onListChangedCallback.onItemRangeMoved(observableList, listChanges.start, listChanges.to, listChanges.count);
|
|
} else if (i == 4) {
|
|
onListChangedCallback.onItemRangeRemoved(observableList, listChanges.start, listChanges.count);
|
|
} else {
|
|
onListChangedCallback.onChanged(observableList);
|
|
}
|
|
}
|
|
};
|
|
|
|
public void notifyChanged(ObservableList observableList) {
|
|
notifyCallbacks(observableList, 0, (ListChanges) null);
|
|
}
|
|
|
|
public void notifyChanged(ObservableList observableList, int i, int i2) {
|
|
notifyCallbacks(observableList, 1, acquire(i, 0, i2));
|
|
}
|
|
|
|
public void notifyInserted(ObservableList observableList, int i, int i2) {
|
|
notifyCallbacks(observableList, 2, acquire(i, 0, i2));
|
|
}
|
|
|
|
public void notifyMoved(ObservableList observableList, int i, int i2, int i3) {
|
|
notifyCallbacks(observableList, 3, acquire(i, i2, i3));
|
|
}
|
|
|
|
public void notifyRemoved(ObservableList observableList, int i, int i2) {
|
|
notifyCallbacks(observableList, 4, acquire(i, 0, i2));
|
|
}
|
|
|
|
private static ListChanges acquire(int i, int i2, int i3) {
|
|
ListChanges acquire = sListChanges.acquire();
|
|
if (acquire == null) {
|
|
acquire = new ListChanges();
|
|
}
|
|
acquire.start = i;
|
|
acquire.to = i2;
|
|
acquire.count = i3;
|
|
return acquire;
|
|
}
|
|
|
|
@Override // androidx.databinding.CallbackRegistry
|
|
public synchronized void notifyCallbacks(ObservableList observableList, int i, ListChanges listChanges) {
|
|
super.notifyCallbacks((ListChangeRegistry) observableList, i, (int) listChanges);
|
|
if (listChanges != null) {
|
|
sListChanges.release(listChanges);
|
|
}
|
|
}
|
|
|
|
public ListChangeRegistry() {
|
|
super(NOTIFIER_CALLBACK);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes.dex */
|
|
public static class ListChanges {
|
|
public int count;
|
|
public int start;
|
|
public int to;
|
|
|
|
ListChanges() {
|
|
}
|
|
}
|
|
}
|