discord-jadx/app/src/main/java/b/a/o/b.java

113 lines
3.9 KiB
Java
Raw Normal View History

2021-12-17 21:59:34 +00:00
package b.a.o;
2021-07-24 02:37:17 +00:00
2021-08-11 06:37:47 +00:00
import android.graphics.Rect;
2021-11-20 07:11:29 +00:00
import android.util.Log;
2021-08-11 06:37:47 +00:00
import android.view.View;
2021-08-20 05:39:29 +00:00
import android.view.ViewTreeObserver;
2021-08-11 06:37:47 +00:00
import androidx.annotation.UiThread;
2021-11-02 06:38:17 +00:00
import d0.t.u;
import d0.z.d.m;
2021-08-11 06:37:47 +00:00
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 {
2021-12-02 18:53:44 +00:00
public final Map<Integer, Rect> j = new LinkedHashMap();
public final Map<Integer, ViewTreeObserver.OnScrollChangedListener> k = new LinkedHashMap();
public final Set<a> l = new LinkedHashSet();
2021-07-24 02:37:17 +00:00
2021-08-11 06:37:47 +00:00
/* compiled from: PanelsChildGestureRegionObserver.kt */
public interface a {
void onGestureRegionsUpdate(List<Rect> list);
2021-07-24 02:37:17 +00:00
}
2021-08-11 06:37:47 +00:00
/* compiled from: PanelsChildGestureRegionObserver.kt */
2021-12-17 21:59:34 +00:00
/* renamed from: b.a.o.b$b reason: collision with other inner class name */
2022-02-02 08:50:56 +00:00
public static final class C0031b {
2021-08-11 06:37:47 +00:00
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;
}
}
2021-08-20 05:39:29 +00:00
/* compiled from: PanelsChildGestureRegionObserver.kt */
public static final class c implements ViewTreeObserver.OnScrollChangedListener {
public final /* synthetic */ b a;
2021-12-17 21:59:34 +00:00
/* renamed from: b reason: collision with root package name */
2022-01-27 07:52:47 +00:00
public final /* synthetic */ View f249b;
2021-08-20 05:39:29 +00:00
public c(b bVar, View view) {
this.a = bVar;
2022-01-27 07:52:47 +00:00
this.f249b = view;
2021-08-20 05:39:29 +00:00
}
@Override // android.view.ViewTreeObserver.OnScrollChangedListener
public final void onScrollChanged() {
b bVar = this.a;
2022-01-27 07:52:47 +00:00
View view = this.f249b;
bVar.onLayoutChange(view, view.getLeft(), this.f249b.getTop(), this.f249b.getRight(), this.f249b.getBottom(), 0, 0, 0, 0);
2021-08-20 05:39:29 +00:00
}
}
2021-08-11 06:37:47 +00:00
public final void a() {
2021-12-02 18:53:44 +00:00
List<Rect> list = u.toList(this.j.values());
for (a aVar : this.l) {
2021-08-11 06:37:47 +00:00
aVar.onGestureRegionsUpdate(list);
}
}
2021-08-20 05:39:29 +00:00
@UiThread
public final void b(View view) {
m.checkParameterIsNotNull(view, "view");
2021-12-02 18:53:44 +00:00
if (this.k.containsKey(Integer.valueOf(view.getId()))) {
2021-11-20 07:11:29 +00:00
String simpleName = b.class.getSimpleName();
2021-12-17 21:59:34 +00:00
StringBuilder R = b.d.b.a.a.R("failed to register view with ID ");
2021-11-20 07:11:29 +00:00
R.append(view.getId());
R.append(". already registered");
Log.w(simpleName, R.toString());
return;
}
2021-08-20 05:39:29 +00:00
view.addOnLayoutChangeListener(this);
c cVar = new c(this, view);
view.getViewTreeObserver().addOnScrollChangedListener(cVar);
2021-12-02 18:53:44 +00:00
this.k.put(Integer.valueOf(view.getId()), cVar);
2021-08-20 05:39:29 +00:00
}
@UiThread
public final void c(View view) {
m.checkParameterIsNotNull(view, "view");
2021-12-02 18:53:44 +00:00
ViewTreeObserver.OnScrollChangedListener remove = this.k.remove(Integer.valueOf(view.getId()));
2021-08-20 05:39:29 +00:00
if (remove != null) {
view.getViewTreeObserver().removeOnScrollChangedListener(remove);
}
view.removeOnLayoutChangeListener(this);
2021-12-02 18:53:44 +00:00
this.j.remove(Integer.valueOf(view.getId()));
2021-08-20 05:39:29 +00:00
a();
}
2021-08-11 06:37:47 +00:00
@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) {
2021-08-20 05:39:29 +00:00
m.checkParameterIsNotNull(view, "view");
2021-12-02 18:53:44 +00:00
if (this.k.keySet().contains(Integer.valueOf(view.getId()))) {
2021-11-20 07:11:29 +00:00
int[] iArr = {0, 0};
view.getLocationInWindow(iArr);
int i9 = iArr[0];
int i10 = iArr[1];
2021-12-02 18:53:44 +00:00
this.j.put(Integer.valueOf(view.getId()), new Rect(i9, i10, i3 + i9, i4 + i10));
2021-11-20 07:11:29 +00:00
a();
}
2021-07-24 02:37:17 +00:00
}
}