Rabbit-R1/android (non root)/java/sources/androidx/compose/ui/platform/AndroidViewsHandler.java
2024-05-21 17:08:36 -04:00

113 lines
7.1 KiB
Java

package androidx.compose.ui.platform;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import androidx.compose.ui.node.LayoutNode;
import androidx.compose.ui.viewinterop.AndroidViewHolder;
import androidx.media3.exoplayer.upstream.CmcdHeadersFactory;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
/* compiled from: AndroidViewsHandler.android.kt */
@Metadata(d1 = {"\u0000d\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0001\n\u0000\n\u0002\u0010\u0015\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\b\n\u0002\b\t\b\u0000\u0018\u00002\u00020\u0001B\r\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004J\u0012\u0010\u000e\u001a\u00020\u000f2\b\u0010\u0010\u001a\u0004\u0018\u00010\u0011H\u0016J\u0016\u0010\u0012\u001a\u00020\u00132\u0006\u0010\u0014\u001a\u00020\u00072\u0006\u0010\u0015\u001a\u00020\u0016J\u001e\u0010\u0017\u001a\u0004\u0018\u00010\u00182\b\u0010\u0019\u001a\u0004\u0018\u00010\u001a2\b\u0010\u001b\u001a\u0004\u0018\u00010\u001cH\u0016J\u0018\u0010\u001d\u001a\u00020\u00132\u0006\u0010\u001e\u001a\u00020\u001f2\u0006\u0010 \u001a\u00020\u001fH\u0017J0\u0010!\u001a\u00020\u00132\u0006\u0010\"\u001a\u00020\u000f2\u0006\u0010#\u001a\u00020$2\u0006\u0010%\u001a\u00020$2\u0006\u0010&\u001a\u00020$2\u0006\u0010'\u001a\u00020$H\u0014J\u0018\u0010(\u001a\u00020\u00132\u0006\u0010)\u001a\u00020$2\u0006\u0010*\u001a\u00020$H\u0014J\b\u0010+\u001a\u00020\u0013H\u0017J\b\u0010,\u001a\u00020\u000fH\u0016R-\u0010\u0005\u001a\u001e\u0012\u0004\u0012\u00020\u0007\u0012\u0004\u0012\u00020\b0\u0006j\u000e\u0012\u0004\u0012\u00020\u0007\u0012\u0004\u0012\u00020\b`\\u0006\b\n\u0000\u001a\u0004\b\n\u0010\u000bR-\u0010\f\u001a\u001e\u0012\u0004\u0012\u00020\b\u0012\u0004\u0012\u00020\u00070\u0006j\u000e\u0012\u0004\u0012\u00020\b\u0012\u0004\u0012\u00020\u0007`\\u0006\b\n\u0000\u001a\u0004\b\r\u0010\u000b¨\u0006-"}, d2 = {"Landroidx/compose/ui/platform/AndroidViewsHandler;", "Landroid/view/ViewGroup;", "context", "Landroid/content/Context;", "(Landroid/content/Context;)V", "holderToLayoutNode", "Ljava/util/HashMap;", "Landroidx/compose/ui/viewinterop/AndroidViewHolder;", "Landroidx/compose/ui/node/LayoutNode;", "Lkotlin/collections/HashMap;", "getHolderToLayoutNode", "()Ljava/util/HashMap;", "layoutNodeToHolder", "getLayoutNodeToHolder", "dispatchTouchEvent", "", "ev", "Landroid/view/MotionEvent;", "drawView", "", "view", "canvas", "Landroid/graphics/Canvas;", "invalidateChildInParent", "", "location", "", "dirty", "Landroid/graphics/Rect;", "onDescendantInvalidated", "child", "Landroid/view/View;", "target", "onLayout", "changed", CmcdHeadersFactory.STREAM_TYPE_LIVE, "", "t", "r", "b", "onMeasure", "widthMeasureSpec", "heightMeasureSpec", "requestLayout", "shouldDelayChildPressedState", "ui_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class AndroidViewsHandler extends ViewGroup {
private final HashMap<AndroidViewHolder, LayoutNode> holderToLayoutNode;
private final HashMap<LayoutNode, AndroidViewHolder> layoutNodeToHolder;
@Override // android.view.ViewGroup, android.view.View
public boolean dispatchTouchEvent(MotionEvent ev) {
return true;
}
public final HashMap<AndroidViewHolder, LayoutNode> getHolderToLayoutNode() {
return this.holderToLayoutNode;
}
public final HashMap<LayoutNode, AndroidViewHolder> getLayoutNodeToHolder() {
return this.layoutNodeToHolder;
}
@Override // android.view.ViewGroup, android.view.ViewParent
public Void invalidateChildInParent(int[] location, Rect dirty) {
return null;
}
@Override // android.view.ViewGroup, android.view.ViewParent
public void onDescendantInvalidated(View child, View target) {
Intrinsics.checkNotNullParameter(child, "child");
Intrinsics.checkNotNullParameter(target, "target");
}
@Override // android.view.ViewGroup
public boolean shouldDelayChildPressedState() {
return false;
}
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public AndroidViewsHandler(Context context) {
super(context);
Intrinsics.checkNotNullParameter(context, "context");
setClipChildren(false);
this.holderToLayoutNode = new HashMap<>();
this.layoutNodeToHolder = new HashMap<>();
}
@Override // android.view.ViewGroup, android.view.ViewParent
public /* bridge */ /* synthetic */ ViewParent invalidateChildInParent(int[] iArr, Rect rect) {
return (ViewParent) invalidateChildInParent(iArr, rect);
}
@Override // android.view.View
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
if (View.MeasureSpec.getMode(widthMeasureSpec) != 1073741824) {
throw new IllegalArgumentException("Failed requirement.".toString());
}
if (View.MeasureSpec.getMode(heightMeasureSpec) != 1073741824) {
throw new IllegalArgumentException("Failed requirement.".toString());
}
setMeasuredDimension(View.MeasureSpec.getSize(widthMeasureSpec), View.MeasureSpec.getSize(heightMeasureSpec));
Set<AndroidViewHolder> keySet = this.holderToLayoutNode.keySet();
Intrinsics.checkNotNullExpressionValue(keySet, "holderToLayoutNode.keys");
Iterator<T> it = keySet.iterator();
while (it.hasNext()) {
((AndroidViewHolder) it.next()).remeasure();
}
}
@Override // android.view.ViewGroup, android.view.View
protected void onLayout(boolean changed, int l, int t, int r, int b) {
Set<AndroidViewHolder> keySet = this.holderToLayoutNode.keySet();
Intrinsics.checkNotNullExpressionValue(keySet, "holderToLayoutNode.keys");
for (AndroidViewHolder androidViewHolder : keySet) {
androidViewHolder.layout(androidViewHolder.getLeft(), androidViewHolder.getTop(), androidViewHolder.getRight(), androidViewHolder.getBottom());
}
}
public final void drawView(AndroidViewHolder view, Canvas canvas) {
Intrinsics.checkNotNullParameter(view, "view");
Intrinsics.checkNotNullParameter(canvas, "canvas");
view.draw(canvas);
}
@Override // android.view.View, android.view.ViewParent
public void requestLayout() {
cleanupLayoutState(this);
int childCount = getChildCount();
for (int i = 0; i < childCount; i++) {
View childAt = getChildAt(i);
LayoutNode layoutNode = this.holderToLayoutNode.get(childAt);
if (childAt.isLayoutRequested() && layoutNode != null) {
LayoutNode.requestRemeasure$ui_release$default(layoutNode, false, false, 3, null);
}
}
}
}