mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-12-06 04:19:23 +01:00
54 lines
2.2 KiB
Java
54 lines
2.2 KiB
Java
package com.facebook.react.uimanager;
|
|
|
|
import android.graphics.Point;
|
|
import android.graphics.Rect;
|
|
import android.view.View;
|
|
import androidx.annotation.UiThread;
|
|
import com.facebook.infer.annotation.Assertions;
|
|
import kotlin.Metadata;
|
|
import kotlin.jvm.JvmStatic;
|
|
import org.jetbrains.annotations.NotNull;
|
|
import org.jetbrains.annotations.Nullable;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
@Metadata(d1 = {"\u0000 \n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\bÆ\u0002\u0018\u00002\u00020\u0001B\t\b\u0002¢\u0006\u0004\b\u0002\u0010\u0003J\u0012\u0010\u0004\u001a\u0004\u0018\u00010\u00052\u0006\u0010\u0006\u001a\u00020\u0007H\u0007J\u0010\u0010\b\u001a\u00020\t2\u0006\u0010\n\u001a\u00020\u0007H\u0007¨\u0006\u000b"}, d2 = {"Lcom/facebook/react/uimanager/RootViewUtil;", "", "<init>", "()V", "getRootView", "Lcom/facebook/react/uimanager/RootView;", "reactView", "Landroid/view/View;", "getViewportOffset", "Landroid/graphics/Point;", "v", "ReactAndroid_release"}, k = 1, mv = {2, 1, 0}, xi = 48)
|
|
/* loaded from: classes6.dex */
|
|
public final class RootViewUtil {
|
|
|
|
@NotNull
|
|
public static final RootViewUtil INSTANCE = new RootViewUtil();
|
|
|
|
private RootViewUtil() {
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
@JvmStatic
|
|
@Nullable
|
|
public static final RootView getRootView(@NotNull View reactView) {
|
|
reactView.getClass();
|
|
View view = reactView;
|
|
while (!(view instanceof RootView)) {
|
|
Object parent = view.getParent();
|
|
if (parent == null) {
|
|
return null;
|
|
}
|
|
Assertions.assertCondition(parent instanceof View);
|
|
view = (View) parent;
|
|
}
|
|
return (RootView) view;
|
|
}
|
|
|
|
@JvmStatic
|
|
@UiThread
|
|
@NotNull
|
|
public static final Point getViewportOffset(@NotNull View v) {
|
|
v.getClass();
|
|
int[] iArr = new int[2];
|
|
v.getLocationInWindow(iArr);
|
|
Rect rect = new Rect();
|
|
v.getWindowVisibleDisplayFrame(rect);
|
|
iArr[0] = iArr[0] - rect.left;
|
|
iArr[1] = iArr[1] - rect.top;
|
|
return new Point(iArr[0], iArr[1]);
|
|
}
|
|
}
|