mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2024-12-30 11:02:31 -06:00
117 lines
3.9 KiB
Java
117 lines
3.9 KiB
Java
|
package androidx.databinding;
|
||
|
|
||
|
import androidx.databinding.ObservableList;
|
||
|
import java.util.ArrayList;
|
||
|
import java.util.Collection;
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public class ObservableArrayList<T> extends ArrayList<T> implements ObservableList<T> {
|
||
|
private transient ListChangeRegistry mListeners = new ListChangeRegistry();
|
||
|
|
||
|
@Override // androidx.databinding.ObservableList
|
||
|
public void addOnListChangedCallback(ObservableList.OnListChangedCallback onListChangedCallback) {
|
||
|
if (this.mListeners == null) {
|
||
|
this.mListeners = new ListChangeRegistry();
|
||
|
}
|
||
|
this.mListeners.add(onListChangedCallback);
|
||
|
}
|
||
|
|
||
|
@Override // androidx.databinding.ObservableList
|
||
|
public void removeOnListChangedCallback(ObservableList.OnListChangedCallback onListChangedCallback) {
|
||
|
ListChangeRegistry listChangeRegistry = this.mListeners;
|
||
|
if (listChangeRegistry != null) {
|
||
|
listChangeRegistry.remove(onListChangedCallback);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // java.util.ArrayList, java.util.AbstractList, java.util.AbstractCollection, java.util.Collection, java.util.List
|
||
|
public boolean add(T t) {
|
||
|
super.add(t);
|
||
|
notifyAdd(size() - 1, 1);
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
@Override // java.util.ArrayList, java.util.AbstractList, java.util.List
|
||
|
public void add(int i, T t) {
|
||
|
super.add(i, t);
|
||
|
notifyAdd(i, 1);
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Multi-variable type inference failed */
|
||
|
@Override // java.util.ArrayList, java.util.AbstractCollection, java.util.Collection, java.util.List
|
||
|
public boolean addAll(Collection<? extends T> collection) {
|
||
|
int size = size();
|
||
|
boolean addAll = super.addAll(collection);
|
||
|
if (addAll) {
|
||
|
notifyAdd(size, size() - size);
|
||
|
}
|
||
|
return addAll;
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Multi-variable type inference failed */
|
||
|
@Override // java.util.ArrayList, java.util.AbstractList, java.util.List
|
||
|
public boolean addAll(int i, Collection<? extends T> collection) {
|
||
|
boolean addAll = super.addAll(i, collection);
|
||
|
if (addAll) {
|
||
|
notifyAdd(i, collection.size());
|
||
|
}
|
||
|
return addAll;
|
||
|
}
|
||
|
|
||
|
@Override // java.util.ArrayList, java.util.AbstractList, java.util.AbstractCollection, java.util.Collection, java.util.List
|
||
|
public void clear() {
|
||
|
int size = size();
|
||
|
super.clear();
|
||
|
if (size != 0) {
|
||
|
notifyRemove(0, size);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // java.util.ArrayList, java.util.AbstractList, java.util.List
|
||
|
public T remove(int i) {
|
||
|
T t = (T) super.remove(i);
|
||
|
notifyRemove(i, 1);
|
||
|
return t;
|
||
|
}
|
||
|
|
||
|
@Override // java.util.ArrayList, java.util.AbstractCollection, java.util.Collection, java.util.List
|
||
|
public boolean remove(Object obj) {
|
||
|
int indexOf = indexOf(obj);
|
||
|
if (indexOf < 0) {
|
||
|
return false;
|
||
|
}
|
||
|
remove(indexOf);
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
@Override // java.util.ArrayList, java.util.AbstractList, java.util.List
|
||
|
public T set(int i, T t) {
|
||
|
T t2 = (T) super.set(i, t);
|
||
|
ListChangeRegistry listChangeRegistry = this.mListeners;
|
||
|
if (listChangeRegistry != null) {
|
||
|
listChangeRegistry.notifyChanged(this, i, 1);
|
||
|
}
|
||
|
return t2;
|
||
|
}
|
||
|
|
||
|
@Override // java.util.ArrayList, java.util.AbstractList
|
||
|
protected void removeRange(int i, int i2) {
|
||
|
super.removeRange(i, i2);
|
||
|
notifyRemove(i, i2 - i);
|
||
|
}
|
||
|
|
||
|
private void notifyAdd(int i, int i2) {
|
||
|
ListChangeRegistry listChangeRegistry = this.mListeners;
|
||
|
if (listChangeRegistry != null) {
|
||
|
listChangeRegistry.notifyInserted(this, i, i2);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void notifyRemove(int i, int i2) {
|
||
|
ListChangeRegistry listChangeRegistry = this.mListeners;
|
||
|
if (listChangeRegistry != null) {
|
||
|
listChangeRegistry.notifyRemoved(this, i, i2);
|
||
|
}
|
||
|
}
|
||
|
}
|