Initial commit
This commit is contained in:
1854
sources/androidx/coordinatorlayout/widget/CoordinatorLayout.java
Normal file
1854
sources/androidx/coordinatorlayout/widget/CoordinatorLayout.java
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,121 @@
|
||||
package androidx.coordinatorlayout.widget;
|
||||
|
||||
import androidx.collection.SimpleArrayMap;
|
||||
import androidx.core.util.Pools$Pool;
|
||||
import androidx.core.util.Pools$SimplePool;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class DirectedAcyclicGraph<T> {
|
||||
private final Pools$Pool<ArrayList<T>> a = new Pools$SimplePool(10);
|
||||
private final SimpleArrayMap<T, ArrayList<T>> b = new SimpleArrayMap<>();
|
||||
private final ArrayList<T> c = new ArrayList<>();
|
||||
private final HashSet<T> d = new HashSet<>();
|
||||
|
||||
public void a(T t) {
|
||||
if (this.b.containsKey(t)) {
|
||||
return;
|
||||
}
|
||||
this.b.put(t, null);
|
||||
}
|
||||
|
||||
public boolean b(T t) {
|
||||
return this.b.containsKey(t);
|
||||
}
|
||||
|
||||
public List c(T t) {
|
||||
return this.b.get(t);
|
||||
}
|
||||
|
||||
public List<T> d(T t) {
|
||||
int size = this.b.size();
|
||||
ArrayList arrayList = null;
|
||||
for (int i = 0; i < size; i++) {
|
||||
ArrayList<T> d = this.b.d(i);
|
||||
if (d != null && d.contains(t)) {
|
||||
if (arrayList == null) {
|
||||
arrayList = new ArrayList();
|
||||
}
|
||||
arrayList.add(this.b.b(i));
|
||||
}
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
public boolean e(T t) {
|
||||
int size = this.b.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
ArrayList<T> d = this.b.d(i);
|
||||
if (d != null && d.contains(t)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private ArrayList<T> c() {
|
||||
ArrayList<T> a = this.a.a();
|
||||
return a == null ? new ArrayList<>() : a;
|
||||
}
|
||||
|
||||
public ArrayList<T> b() {
|
||||
this.c.clear();
|
||||
this.d.clear();
|
||||
int size = this.b.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
a(this.b.b(i), this.c, this.d);
|
||||
}
|
||||
return this.c;
|
||||
}
|
||||
|
||||
public void a(T t, T t2) {
|
||||
if (this.b.containsKey(t) && this.b.containsKey(t2)) {
|
||||
ArrayList<T> arrayList = this.b.get(t);
|
||||
if (arrayList == null) {
|
||||
arrayList = c();
|
||||
this.b.put(t, arrayList);
|
||||
}
|
||||
arrayList.add(t2);
|
||||
return;
|
||||
}
|
||||
throw new IllegalArgumentException("All nodes must be present in the graph before being added as an edge");
|
||||
}
|
||||
|
||||
public void a() {
|
||||
int size = this.b.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
ArrayList<T> d = this.b.d(i);
|
||||
if (d != null) {
|
||||
a((ArrayList) d);
|
||||
}
|
||||
}
|
||||
this.b.clear();
|
||||
}
|
||||
|
||||
private void a(T t, ArrayList<T> arrayList, HashSet<T> hashSet) {
|
||||
if (arrayList.contains(t)) {
|
||||
return;
|
||||
}
|
||||
if (!hashSet.contains(t)) {
|
||||
hashSet.add(t);
|
||||
ArrayList<T> arrayList2 = this.b.get(t);
|
||||
if (arrayList2 != null) {
|
||||
int size = arrayList2.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
a(arrayList2.get(i), arrayList, hashSet);
|
||||
}
|
||||
}
|
||||
hashSet.remove(t);
|
||||
arrayList.add(t);
|
||||
return;
|
||||
}
|
||||
throw new RuntimeException("This graph contains cyclic dependencies");
|
||||
}
|
||||
|
||||
private void a(ArrayList<T> arrayList) {
|
||||
arrayList.clear();
|
||||
this.a.a(arrayList);
|
||||
}
|
||||
}
|
@@ -0,0 +1,51 @@
|
||||
package androidx.coordinatorlayout.widget;
|
||||
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewParent;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ViewGroupUtils {
|
||||
private static final ThreadLocal<Matrix> a = new ThreadLocal<>();
|
||||
private static final ThreadLocal<RectF> b = new ThreadLocal<>();
|
||||
|
||||
public static void a(ViewGroup viewGroup, View view, Rect rect) {
|
||||
rect.set(0, 0, view.getWidth(), view.getHeight());
|
||||
b(viewGroup, view, rect);
|
||||
}
|
||||
|
||||
static void b(ViewGroup viewGroup, View view, Rect rect) {
|
||||
Matrix matrix = a.get();
|
||||
if (matrix == null) {
|
||||
matrix = new Matrix();
|
||||
a.set(matrix);
|
||||
} else {
|
||||
matrix.reset();
|
||||
}
|
||||
a(viewGroup, view, matrix);
|
||||
RectF rectF = b.get();
|
||||
if (rectF == null) {
|
||||
rectF = new RectF();
|
||||
b.set(rectF);
|
||||
}
|
||||
rectF.set(rect);
|
||||
matrix.mapRect(rectF);
|
||||
rect.set((int) (rectF.left + 0.5f), (int) (rectF.top + 0.5f), (int) (rectF.right + 0.5f), (int) (rectF.bottom + 0.5f));
|
||||
}
|
||||
|
||||
private static void a(ViewParent viewParent, View view, Matrix matrix) {
|
||||
Object parent = view.getParent();
|
||||
if ((parent instanceof View) && parent != viewParent) {
|
||||
a(viewParent, (View) parent, matrix);
|
||||
matrix.preTranslate(-r0.getScrollX(), -r0.getScrollY());
|
||||
}
|
||||
matrix.preTranslate(view.getLeft(), view.getTop());
|
||||
if (view.getMatrix().isIdentity()) {
|
||||
return;
|
||||
}
|
||||
matrix.preConcat(view.getMatrix());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user