Rabbit-R1/switch port/java/sources/androidx/compose/ui/window/DialogLayout.java

139 lines
9 KiB
Java
Raw Normal View History

2024-05-21 16:08:36 -05:00
package androidx.compose.ui.window;
import android.content.Context;
import android.view.View;
import android.view.Window;
import androidx.compose.runtime.Composer;
import androidx.compose.runtime.ComposerKt;
import androidx.compose.runtime.CompositionContext;
import androidx.compose.runtime.MutableState;
import androidx.compose.runtime.RecomposeScopeImplKt;
import androidx.compose.runtime.ScopeUpdateScope;
import androidx.compose.runtime.SnapshotStateKt__SnapshotStateKt;
import androidx.compose.ui.platform.AbstractComposeView;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.Intrinsics;
import kotlin.math.MathKt;
/* JADX INFO: Access modifiers changed from: package-private */
/* compiled from: AndroidDialog.android.kt */
@Metadata(d1 = {"\u0000D\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\u0018\u0002\n\u0002\b\b\n\u0002\u0010\b\n\u0002\b\u0004\n\u0002\u0010\u000b\n\u0002\b\u0017\n\u0002\u0018\u0002\n\u0002\b\u0002\b\u0002\u0018\u00002\u00020\u00012\u00020\u0002B\u0015\u0012\u0006\u0010\u0003\u001a\u00020\u0004\u0012\u0006\u0010\u0005\u001a\u00020\u0006¢\u0006\u0002\u0010\u0007J\r\u0010#\u001a\u00020\nH\u0017¢\u0006\u0002\u0010$J5\u0010%\u001a\u00020\n2\u0006\u0010&\u001a\u00020\u00192\u0006\u0010'\u001a\u00020\u00142\u0006\u0010(\u001a\u00020\u00142\u0006\u0010)\u001a\u00020\u00142\u0006\u0010*\u001a\u00020\u0014H\u0010¢\u0006\u0002\b+J\u001d\u0010,\u001a\u00020\n2\u0006\u0010-\u001a\u00020\u00142\u0006\u0010.\u001a\u00020\u0014H\u0010¢\u0006\u0002\b/J&\u0010\u000f\u001a\u00020\n2\u0006\u00100\u001a\u0002012\u0011\u0010\f\u001a\r\u0012\u0004\u0012\u00020\n0\\u0006\u0002\b\u000b¢\u0006\u0002\u00102RA\u0010\f\u001a\r\u0012\u0004\u0012\u00020\n0\\u0006\u0002\b\u000b2\u0011\u0010\b\u001a\r\u0012\u0004\u0012\u00020\n0\\u0006\u0002\b\u000b8B@BX\u0082\u008e\u0002¢\u0006\u0012\n\u0004\b\u0011\u0010\u0012\u001a\u0004\b\r\u0010\u000e\"\u0004\b\u000f\u0010\u0010R\u0014\u0010\u0013\u001a\u00020\u00148BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b\u0015\u0010\u0016R\u0014\u0010\u0017\u001a\u00020\u00148BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b\u0018\u0010\u0016R\u001e\u0010\u001a\u001a\u00020\u00192\u0006\u0010\b\u001a\u00020\u0019@RX\u0094\u000e¢\u0006\b\n\u0000\u001a\u0004\b\u001b\u0010\u001cR\u001a\u0010\u001d\u001a\u00020\u0019X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u001e\u0010\u001c\"\u0004\b\u001f\u0010 R\u0014\u0010\u0005\u001a\u00020\u0006X\u0096\u0004¢\u0006\b\n\u0000\u001a\u0004\b!\u0010\"¨\u00063"}, d2 = {"Landroidx/compose/ui/window/DialogLayout;", "Landroidx/compose/ui/platform/AbstractComposeView;", "Landroidx/compose/ui/window/DialogWindowProvider;", "context", "Landroid/content/Context;", "window", "Landroid/view/Window;", "(Landroid/content/Context;Landroid/view/Window;)V", "<set-?>", "Lkotlin/Function0;", "", "Landroidx/compose/runtime/Composable;", "content", "getContent", "()Lkotlin/jvm/functions/Function2;", "setContent", "(Lkotlin/jvm/functions/Function2;)V", "content$delegate", "Landroidx/compose/runtime/MutableState;", "displayHeight", "", "getDisplayHeight", "()I", "displayWidth", "getDisplayWidth", "", "shouldCreateCompositionOnAttachedToWindow", "getShouldCreateCompositionOnAttachedToWindow", "()Z", "usePlatformDefaultWidth", "getUsePlatformDefaultWidth", "setUsePlatformDefaultWidth", "(Z)V", "getWindow", "()Landroid/view/Window;", "Content", "(Landroidx/compose/runtime/Composer;I)V", "internalOnLayout", "changed", "left", "top", "right", "bottom", "internalOnLayout$ui_release", "internalOnMeasure", "widthMeasureSpec", "heightMeasureSpec", "internalOnMeasure$ui_release", "parent", "Landroidx/compose/runtime/CompositionContext;", "(Landroidx/compose/runtime/CompositionContext;Lkotlin/jvm/functions/Function2;)V", "ui_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class DialogLayout extends AbstractComposeView implements DialogWindowProvider {
/* renamed from: content$delegate, reason: from kotlin metadata */
private final MutableState content;
private boolean shouldCreateCompositionOnAttachedToWindow;
private boolean usePlatformDefaultWidth;
private final Window window;
@Override // androidx.compose.ui.platform.AbstractComposeView
protected boolean getShouldCreateCompositionOnAttachedToWindow() {
return this.shouldCreateCompositionOnAttachedToWindow;
}
public final boolean getUsePlatformDefaultWidth() {
return this.usePlatformDefaultWidth;
}
@Override // androidx.compose.ui.window.DialogWindowProvider
public Window getWindow() {
return this.window;
}
public final void setUsePlatformDefaultWidth(boolean z) {
this.usePlatformDefaultWidth = z;
}
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public DialogLayout(Context context, Window window) {
super(context, null, 0, 6, null);
MutableState mutableStateOf$default;
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(window, "window");
this.window = window;
mutableStateOf$default = SnapshotStateKt__SnapshotStateKt.mutableStateOf$default(ComposableSingletons$AndroidDialog_androidKt.INSTANCE.m5126getLambda1$ui_release(), null, 2, null);
this.content = mutableStateOf$default;
}
private final Function2<Composer, Integer, Unit> getContent() {
return (Function2) this.content.getValue();
}
public final void setContent(CompositionContext parent, Function2<? super Composer, ? super Integer, Unit> content) {
Intrinsics.checkNotNullParameter(parent, "parent");
Intrinsics.checkNotNullParameter(content, "content");
setParentCompositionContext(parent);
setContent(content);
this.shouldCreateCompositionOnAttachedToWindow = true;
createComposition();
}
@Override // androidx.compose.ui.platform.AbstractComposeView
public void internalOnMeasure$ui_release(int widthMeasureSpec, int heightMeasureSpec) {
if (this.usePlatformDefaultWidth) {
super.internalOnMeasure$ui_release(widthMeasureSpec, heightMeasureSpec);
} else {
super.internalOnMeasure$ui_release(View.MeasureSpec.makeMeasureSpec(getDisplayWidth(), Integer.MIN_VALUE), View.MeasureSpec.makeMeasureSpec(getDisplayHeight(), Integer.MIN_VALUE));
}
}
@Override // androidx.compose.ui.platform.AbstractComposeView
public void internalOnLayout$ui_release(boolean changed, int left, int top, int right, int bottom) {
View childAt;
super.internalOnLayout$ui_release(changed, left, top, right, bottom);
if (this.usePlatformDefaultWidth || (childAt = getChildAt(0)) == null) {
return;
}
getWindow().setLayout(childAt.getMeasuredWidth(), childAt.getMeasuredHeight());
}
private final int getDisplayWidth() {
return MathKt.roundToInt(getContext().getResources().getConfiguration().screenWidthDp * getContext().getResources().getDisplayMetrics().density);
}
private final int getDisplayHeight() {
return MathKt.roundToInt(getContext().getResources().getConfiguration().screenHeightDp * getContext().getResources().getDisplayMetrics().density);
}
@Override // androidx.compose.ui.platform.AbstractComposeView
public void Content(Composer composer, final int i) {
Composer startRestartGroup = composer.startRestartGroup(1735448596);
ComposerKt.sourceInformation(startRestartGroup, "C(Content)269@10475L9:AndroidDialog.android.kt#2oxthz");
if (ComposerKt.isTraceInProgress()) {
ComposerKt.traceEventStart(1735448596, i, -1, "androidx.compose.ui.window.DialogLayout.Content (AndroidDialog.android.kt:268)");
}
getContent().invoke(startRestartGroup, 0);
if (ComposerKt.isTraceInProgress()) {
ComposerKt.traceEventEnd();
}
ScopeUpdateScope endRestartGroup = startRestartGroup.endRestartGroup();
if (endRestartGroup == null) {
return;
}
endRestartGroup.updateScope(new Function2<Composer, Integer, Unit>() { // from class: androidx.compose.ui.window.DialogLayout$Content$4
/* JADX INFO: Access modifiers changed from: package-private */
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(2);
}
@Override // kotlin.jvm.functions.Function2
public /* bridge */ /* synthetic */ Unit invoke(Composer composer2, Integer num) {
invoke(composer2, num.intValue());
return Unit.INSTANCE;
}
public final void invoke(Composer composer2, int i2) {
DialogLayout.this.Content(composer2, RecomposeScopeImplKt.updateChangedFlags(i | 1));
}
});
}
private final void setContent(Function2<? super Composer, ? super Integer, Unit> function2) {
this.content.setValue(function2);
}
}