mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2025-01-09 13:43:22 +00:00
91 lines
5 KiB
Java
91 lines
5 KiB
Java
|
package androidx.window.layout;
|
||
|
|
||
|
import android.app.Activity;
|
||
|
import android.graphics.Rect;
|
||
|
import androidx.window.core.Bounds;
|
||
|
import androidx.window.layout.FoldingFeature;
|
||
|
import androidx.window.layout.HardwareFoldingFeature;
|
||
|
import java.util.ArrayList;
|
||
|
import java.util.List;
|
||
|
import kotlin.Metadata;
|
||
|
import kotlin.jvm.internal.Intrinsics;
|
||
|
|
||
|
/* compiled from: ExtensionsWindowLayoutInfoAdapter.kt */
|
||
|
@Metadata(d1 = {"\u00006\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0000\bÀ\u0002\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u001f\u0010\u0003\u001a\u0004\u0018\u00010\u00042\u0006\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u0007\u001a\u00020\bH\u0000¢\u0006\u0002\b\tJ\u001d\u0010\u0003\u001a\u00020\n2\u0006\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u000b\u001a\u00020\fH\u0000¢\u0006\u0002\b\tJ\u0018\u0010\r\u001a\u00020\u000e2\u0006\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u000f\u001a\u00020\u0010H\u0002¨\u0006\u0011"}, d2 = {"Landroidx/window/layout/ExtensionsWindowLayoutInfoAdapter;", "", "()V", "translate", "Landroidx/window/layout/FoldingFeature;", "activity", "Landroid/app/Activity;", "oemFeature", "Landroidx/window/extensions/layout/FoldingFeature;", "translate$window_release", "Landroidx/window/layout/WindowLayoutInfo;", "info", "Landroidx/window/extensions/layout/WindowLayoutInfo;", "validBounds", "", "bounds", "Landroidx/window/core/Bounds;", "window_release"}, k = 1, mv = {1, 6, 0}, xi = 48)
|
||
|
/* loaded from: classes2.dex */
|
||
|
public final class ExtensionsWindowLayoutInfoAdapter {
|
||
|
public static final ExtensionsWindowLayoutInfoAdapter INSTANCE = new ExtensionsWindowLayoutInfoAdapter();
|
||
|
|
||
|
private ExtensionsWindowLayoutInfoAdapter() {
|
||
|
}
|
||
|
|
||
|
public final FoldingFeature translate$window_release(Activity activity, androidx.window.extensions.layout.FoldingFeature oemFeature) {
|
||
|
HardwareFoldingFeature.Type fold;
|
||
|
FoldingFeature.State state;
|
||
|
Intrinsics.checkNotNullParameter(activity, "activity");
|
||
|
Intrinsics.checkNotNullParameter(oemFeature, "oemFeature");
|
||
|
int type = oemFeature.getType();
|
||
|
if (type == 1) {
|
||
|
fold = HardwareFoldingFeature.Type.INSTANCE.getFOLD();
|
||
|
} else {
|
||
|
if (type != 2) {
|
||
|
return null;
|
||
|
}
|
||
|
fold = HardwareFoldingFeature.Type.INSTANCE.getHINGE();
|
||
|
}
|
||
|
int state2 = oemFeature.getState();
|
||
|
if (state2 == 1) {
|
||
|
state = FoldingFeature.State.FLAT;
|
||
|
} else {
|
||
|
if (state2 != 2) {
|
||
|
return null;
|
||
|
}
|
||
|
state = FoldingFeature.State.HALF_OPENED;
|
||
|
}
|
||
|
Rect bounds = oemFeature.getBounds();
|
||
|
Intrinsics.checkNotNullExpressionValue(bounds, "oemFeature.bounds");
|
||
|
if (validBounds(activity, new Bounds(bounds))) {
|
||
|
Rect bounds2 = oemFeature.getBounds();
|
||
|
Intrinsics.checkNotNullExpressionValue(bounds2, "oemFeature.bounds");
|
||
|
return new HardwareFoldingFeature(new Bounds(bounds2), fold, state);
|
||
|
}
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
public final WindowLayoutInfo translate$window_release(Activity activity, androidx.window.extensions.layout.WindowLayoutInfo info) {
|
||
|
FoldingFeature foldingFeature;
|
||
|
Intrinsics.checkNotNullParameter(activity, "activity");
|
||
|
Intrinsics.checkNotNullParameter(info, "info");
|
||
|
List<androidx.window.extensions.layout.FoldingFeature> displayFeatures = info.getDisplayFeatures();
|
||
|
Intrinsics.checkNotNullExpressionValue(displayFeatures, "info.displayFeatures");
|
||
|
ArrayList arrayList = new ArrayList();
|
||
|
for (androidx.window.extensions.layout.FoldingFeature feature : displayFeatures) {
|
||
|
if (feature instanceof androidx.window.extensions.layout.FoldingFeature) {
|
||
|
ExtensionsWindowLayoutInfoAdapter extensionsWindowLayoutInfoAdapter = INSTANCE;
|
||
|
Intrinsics.checkNotNullExpressionValue(feature, "feature");
|
||
|
foldingFeature = extensionsWindowLayoutInfoAdapter.translate$window_release(activity, feature);
|
||
|
} else {
|
||
|
foldingFeature = null;
|
||
|
}
|
||
|
if (foldingFeature != null) {
|
||
|
arrayList.add(foldingFeature);
|
||
|
}
|
||
|
}
|
||
|
return new WindowLayoutInfo(arrayList);
|
||
|
}
|
||
|
|
||
|
private final boolean validBounds(Activity activity, Bounds bounds) {
|
||
|
Rect bounds2 = WindowMetricsCalculatorCompat.INSTANCE.computeCurrentWindowMetrics(activity).getBounds();
|
||
|
if (bounds.isZero()) {
|
||
|
return false;
|
||
|
}
|
||
|
if (bounds.getWidth() != bounds2.width() && bounds.getHeight() != bounds2.height()) {
|
||
|
return false;
|
||
|
}
|
||
|
if (bounds.getWidth() >= bounds2.width() || bounds.getHeight() >= bounds2.height()) {
|
||
|
return (bounds.getWidth() == bounds2.width() && bounds.getHeight() == bounds2.height()) ? false : true;
|
||
|
}
|
||
|
return false;
|
||
|
}
|
||
|
}
|