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

93 lines
3.2 KiB
Java
Raw Normal View History

2021-12-17 21:59:34 +00:00
package b.a.j;
2021-07-24 02:37:17 +00:00
import android.view.View;
2021-08-11 06:37:47 +00:00
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import androidx.annotation.MainThread;
import com.discord.floating_view_manager.FloatingViewGravity;
import com.discord.utilities.logging.Logger;
2021-11-02 06:38:17 +00:00
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.Map;
import java.util.Objects;
import kotlin.NoWhenBranchMatchedException;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
/* compiled from: FloatingViewManager.kt */
public final class a {
public Function1<? super Integer, Unit> a;
2021-07-24 02:37:17 +00:00
2021-12-17 21:59:34 +00:00
/* renamed from: b reason: collision with root package name */
2022-02-01 08:01:17 +00:00
public final Map<Integer, C0026a> f240b = new LinkedHashMap();
2021-12-17 21:59:34 +00:00
public final Logger c;
2021-08-11 06:37:47 +00:00
/* compiled from: FloatingViewManager.kt */
2021-12-17 21:59:34 +00:00
/* renamed from: b.a.j.a$a reason: collision with other inner class name */
2022-02-01 08:01:17 +00:00
public static final class C0026a {
2021-08-11 06:37:47 +00:00
public final View 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 ViewGroup f241b;
2021-12-17 21:59:34 +00:00
public final ViewTreeObserver.OnPreDrawListener c;
2021-08-11 06:37:47 +00:00
2022-02-01 08:01:17 +00:00
public C0026a(View view, ViewGroup viewGroup, ViewTreeObserver.OnPreDrawListener onPreDrawListener) {
2021-08-11 06:37:47 +00:00
m.checkNotNullParameter(view, "floatingView");
m.checkNotNullParameter(viewGroup, "ancestorViewGroup");
m.checkNotNullParameter(onPreDrawListener, "ancestorPreDrawListener");
this.a = view;
2022-01-27 07:52:47 +00:00
this.f241b = viewGroup;
2021-12-17 21:59:34 +00:00
this.c = onPreDrawListener;
2021-08-11 06:37:47 +00:00
}
}
/* compiled from: FloatingViewManager.kt */
public static final class b {
public static WeakReference<a> a;
}
public a(Logger logger) {
m.checkNotNullParameter(logger, "logger");
2021-12-17 21:59:34 +00:00
this.c = logger;
2021-08-11 06:37:47 +00:00
}
public static final void a(a aVar, View view, View view2, FloatingViewGravity floatingViewGravity, int i, int i2) {
int i3;
Objects.requireNonNull(aVar);
int[] iArr = new int[2];
view2.getLocationInWindow(iArr);
int i4 = iArr[0];
int i5 = iArr[1];
int width = (((view2.getWidth() / 2) + i4) - (view.getWidth() / 2)) + i;
int ordinal = floatingViewGravity.ordinal();
if (ordinal == 0) {
i3 = i5 - view.getHeight();
} else if (ordinal == 1) {
i3 = ((view2.getHeight() / 2) + i5) - (view.getHeight() / 2);
} else if (ordinal == 2) {
i3 = view2.getHeight() + i5;
} else {
throw new NoWhenBranchMatchedException();
}
view.setX((float) width);
view.setY((float) (i3 + i2));
2021-07-24 02:37:17 +00:00
}
2021-08-11 06:37:47 +00:00
@MainThread
public final void b(int i) {
2022-02-01 08:01:17 +00:00
C0026a aVar = this.f240b.get(Integer.valueOf(i));
2021-08-11 06:37:47 +00:00
if (aVar != null) {
2022-01-27 07:52:47 +00:00
ViewGroup viewGroup = aVar.f241b;
2021-08-11 06:37:47 +00:00
View view = aVar.a;
2021-12-17 21:59:34 +00:00
ViewTreeObserver.OnPreDrawListener onPreDrawListener = aVar.c;
2022-01-27 07:52:47 +00:00
this.f240b.remove(Integer.valueOf(i));
2021-08-11 06:37:47 +00:00
viewGroup.getViewTreeObserver().removeOnPreDrawListener(onPreDrawListener);
viewGroup.removeView(view);
Function1<? super Integer, Unit> function1 = this.a;
if (function1 != null) {
function1.invoke(Integer.valueOf(i));
}
}
2021-07-24 02:37:17 +00:00
}
}