forked from Juby210/discord-jadx
113 lines
3.9 KiB
Java
113 lines
3.9 KiB
Java
package b.a.o;
|
|
|
|
import android.graphics.Rect;
|
|
import android.util.Log;
|
|
import android.view.View;
|
|
import android.view.ViewTreeObserver;
|
|
import androidx.annotation.UiThread;
|
|
import d0.t.u;
|
|
import d0.z.d.m;
|
|
import java.lang.ref.WeakReference;
|
|
import java.util.LinkedHashMap;
|
|
import java.util.LinkedHashSet;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Set;
|
|
/* compiled from: PanelsChildGestureRegionObserver.kt */
|
|
public final class b implements View.OnLayoutChangeListener {
|
|
public final Map<Integer, Rect> j = new LinkedHashMap();
|
|
public final Map<Integer, ViewTreeObserver.OnScrollChangedListener> k = new LinkedHashMap();
|
|
public final Set<a> l = new LinkedHashSet();
|
|
|
|
/* compiled from: PanelsChildGestureRegionObserver.kt */
|
|
public interface a {
|
|
void onGestureRegionsUpdate(List<Rect> list);
|
|
}
|
|
|
|
/* compiled from: PanelsChildGestureRegionObserver.kt */
|
|
/* renamed from: b.a.o.b$b reason: collision with other inner class name */
|
|
public static final class C0031b {
|
|
public static WeakReference<b> a = new WeakReference<>(null);
|
|
|
|
@UiThread
|
|
public static final b a() {
|
|
b bVar = a.get();
|
|
if (bVar != null) {
|
|
return bVar;
|
|
}
|
|
b bVar2 = new b();
|
|
a = new WeakReference<>(bVar2);
|
|
return bVar2;
|
|
}
|
|
}
|
|
|
|
/* compiled from: PanelsChildGestureRegionObserver.kt */
|
|
public static final class c implements ViewTreeObserver.OnScrollChangedListener {
|
|
public final /* synthetic */ b a;
|
|
|
|
/* renamed from: b reason: collision with root package name */
|
|
public final /* synthetic */ View f249b;
|
|
|
|
public c(b bVar, View view) {
|
|
this.a = bVar;
|
|
this.f249b = view;
|
|
}
|
|
|
|
@Override // android.view.ViewTreeObserver.OnScrollChangedListener
|
|
public final void onScrollChanged() {
|
|
b bVar = this.a;
|
|
View view = this.f249b;
|
|
bVar.onLayoutChange(view, view.getLeft(), this.f249b.getTop(), this.f249b.getRight(), this.f249b.getBottom(), 0, 0, 0, 0);
|
|
}
|
|
}
|
|
|
|
public final void a() {
|
|
List<Rect> list = u.toList(this.j.values());
|
|
for (a aVar : this.l) {
|
|
aVar.onGestureRegionsUpdate(list);
|
|
}
|
|
}
|
|
|
|
@UiThread
|
|
public final void b(View view) {
|
|
m.checkParameterIsNotNull(view, "view");
|
|
if (this.k.containsKey(Integer.valueOf(view.getId()))) {
|
|
String simpleName = b.class.getSimpleName();
|
|
StringBuilder R = b.d.b.a.a.R("failed to register view with ID ");
|
|
R.append(view.getId());
|
|
R.append(". already registered");
|
|
Log.w(simpleName, R.toString());
|
|
return;
|
|
}
|
|
view.addOnLayoutChangeListener(this);
|
|
c cVar = new c(this, view);
|
|
view.getViewTreeObserver().addOnScrollChangedListener(cVar);
|
|
this.k.put(Integer.valueOf(view.getId()), cVar);
|
|
}
|
|
|
|
@UiThread
|
|
public final void c(View view) {
|
|
m.checkParameterIsNotNull(view, "view");
|
|
ViewTreeObserver.OnScrollChangedListener remove = this.k.remove(Integer.valueOf(view.getId()));
|
|
if (remove != null) {
|
|
view.getViewTreeObserver().removeOnScrollChangedListener(remove);
|
|
}
|
|
view.removeOnLayoutChangeListener(this);
|
|
this.j.remove(Integer.valueOf(view.getId()));
|
|
a();
|
|
}
|
|
|
|
@Override // android.view.View.OnLayoutChangeListener
|
|
public void onLayoutChange(View view, int i, int i2, int i3, int i4, int i5, int i6, int i7, int i8) {
|
|
m.checkParameterIsNotNull(view, "view");
|
|
if (this.k.keySet().contains(Integer.valueOf(view.getId()))) {
|
|
int[] iArr = {0, 0};
|
|
view.getLocationInWindow(iArr);
|
|
int i9 = iArr[0];
|
|
int i10 = iArr[1];
|
|
this.j.put(Integer.valueOf(view.getId()), new Rect(i9, i10, i3 + i9, i4 + i10));
|
|
a();
|
|
}
|
|
}
|
|
}
|