正在查看: Housing v14.7.8 应用的 InsetsObserverProxy.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Housing v14.7.8 应用的 InsetsObserverProxy.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.swmansion.rnscreens;
import android.view.View;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import androidx.core.view.t;
import com.facebook.react.bridge.LifecycleEventListener;
import com.facebook.react.bridge.ReactApplicationContext;
import com.newrelic.agent.android.instrumentation.Instrumented;
import com.newrelic.agent.android.instrumentation.LogInstrumentation;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Iterator;
import kotlin.Metadata;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlin.jvm.internal.r;
import org.jetbrains.annotations.NotNull;
@Metadata(d1 = {"\u0000J\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\n\n\u0002\u0010\u000b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\n\bÆ\u0002\u0018\u00002\u00020\u00012\u00020\u0002B\t\b\u0002¢\u0006\u0004\b\u0003\u0010\u0004J\u0011\u0010\u0006\u001a\u0004\u0018\u00010\u0005H\u0002¢\u0006\u0004\b\u0006\u0010\u0007J\u001f\u0010\u000b\u001a\u00020\t2\u0006\u0010\b\u001a\u00020\u00052\u0006\u0010\n\u001a\u00020\tH\u0016¢\u0006\u0004\b\u000b\u0010\fJ\u0015\u0010\u0010\u001a\u00020\u000f2\u0006\u0010\u000e\u001a\u00020\r¢\u0006\u0004\b\u0010\u0010\u0011J\u000f\u0010\u0012\u001a\u00020\u000fH\u0016¢\u0006\u0004\b\u0012\u0010\u0004J\u000f\u0010\u0013\u001a\u00020\u000fH\u0016¢\u0006\u0004\b\u0013\u0010\u0004J\u000f\u0010\u0014\u001a\u00020\u000fH\u0016¢\u0006\u0004\b\u0014\u0010\u0004J\u0015\u0010\u0016\u001a\u00020\u000f2\u0006\u0010\u0015\u001a\u00020\u0001¢\u0006\u0004\b\u0016\u0010\u0017J\u0015\u0010\u0018\u001a\u00020\u000f2\u0006\u0010\u0015\u001a\u00020\u0001¢\u0006\u0004\b\u0018\u0010\u0017J\u0015\u0010\u001b\u001a\u00020\u001a2\u0006\u0010\u0019\u001a\u00020\u0005¢\u0006\u0004\b\u001b\u0010\u001cJ\r\u0010\u001d\u001a\u00020\u000f¢\u0006\u0004\b\u001d\u0010\u0004R$\u0010 \u001a\u0012\u0012\u0004\u0012\u00020\u00010\u001ej\b\u0012\u0004\u0012\u00020\u0001`\u001f8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b \u0010!R\u001c\u0010#\u001a\b\u0012\u0004\u0012\u00020\u00050\"8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b#\u0010$R\u0016\u0010%\u001a\u00020\u001a8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b%\u0010&R\u0016\u0010'\u001a\u00020\u001a8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b'\u0010&R\u0016\u0010(\u001a\u00020\u001a8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b(\u0010&R\u0014\u0010+\u001a\u00020\u001a8BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b)\u0010*¨\u0006,"}, d2 = {"Lcom/swmansion/rnscreens/InsetsObserverProxy;", "Landroidx/core/view/t;", "Lcom/facebook/react/bridge/LifecycleEventListener;", "<init>", "()V", "Landroid/view/View;", "getObservedView", "()Landroid/view/View;", "v", "Landroidx/core/view/WindowInsetsCompat;", "insets", "onApplyWindowInsets", "(Landroid/view/View;Landroidx/core/view/WindowInsetsCompat;)Landroidx/core/view/WindowInsetsCompat;", "Lcom/facebook/react/bridge/ReactApplicationContext;", "context", "Lzp/j0;", "registerWithContext", "(Lcom/facebook/react/bridge/ReactApplicationContext;)V", "onHostResume", "onHostPause", "onHostDestroy", "listener", "addOnApplyWindowInsetsListener", "(Landroidx/core/view/t;)V", "removeOnApplyWindowInsetsListener", "view", "", "registerOnView", "(Landroid/view/View;)Z", "unregister", "Ljava/util/ArrayList;", "Lkotlin/collections/ArrayList;", "listeners", "Ljava/util/ArrayList;", "Ljava/lang/ref/WeakReference;", "eventSourceView", "Ljava/lang/ref/WeakReference;", "hasBeenRegistered", "Z", "isObservingContextLifetime", "shouldForwardInsetsToView", "getAllowRegistration", "()Z", "allowRegistration", "react-native-screens_release"}, k = 1, mv = {2, 0, 0}, xi = 48)
@Instrumented
@SourceDebugExtension({"SMAP\nInsetsObserverProxy.kt\nKotlin\n*S Kotlin\n*F\n+ 1 InsetsObserverProxy.kt\ncom/swmansion/rnscreens/InsetsObserverProxy\n+ 2 _Collections.kt\nkotlin/collections/CollectionsKt___CollectionsKt\n+ 3 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,105:1\n1863#2,2:106\n1#3:108\n*S KotlinDebug\n*F\n+ 1 InsetsObserverProxy.kt\ncom/swmansion/rnscreens/InsetsObserverProxy\n*L\n42#1:106,2\n*E\n"})
public final class InsetsObserverProxy implements t, LifecycleEventListener {
private static boolean hasBeenRegistered;
private static boolean isObservingContextLifetime;
@NotNull
public static final InsetsObserverProxy INSTANCE = new InsetsObserverProxy();
@NotNull
private static final ArrayList<t> listeners = new ArrayList<>();
@NotNull
private static WeakReference<View> eventSourceView = new WeakReference<>(null);
private static boolean shouldForwardInsetsToView = true;
private InsetsObserverProxy() {
}
private final boolean getAllowRegistration() {
return !hasBeenRegistered || eventSourceView.get() == null;
}
private final View getObservedView() {
return eventSourceView.get();
}
public final void addOnApplyWindowInsetsListener(@NotNull t listener) {
r.k(listener, "listener");
listeners.add(listener);
}
@NotNull
public WindowInsetsCompat onApplyWindowInsets(@NotNull View v, @NotNull WindowInsetsCompat insets) {
r.k(v, "v");
r.k(insets, "insets");
WindowInsetsCompat u = shouldForwardInsetsToView ? ViewCompat.u(v, insets) : insets;
r.h(u);
Iterator<T> it = listeners.iterator();
while (it.hasNext()) {
u = ((t) it.next()).onApplyWindowInsets(v, insets);
}
return u;
}
public void onHostDestroy() {
View observedView = getObservedView();
if (hasBeenRegistered && observedView != null) {
ViewCompat.I(observedView, (t) null);
hasBeenRegistered = false;
eventSourceView.clear();
}
isObservingContextLifetime = false;
}
public void onHostPause() {
}
public void onHostResume() {
}
public final boolean registerOnView(@NotNull View view) {
r.k(view, "view");
if (!getAllowRegistration()) {
return false;
}
ViewCompat.I(view, this);
eventSourceView = new WeakReference<>(view);
hasBeenRegistered = true;
return true;
}
public final void registerWithContext(@NotNull ReactApplicationContext context) {
r.k(context, "context");
if (isObservingContextLifetime) {
LogInstrumentation.w("[RNScreens]", "InsetObserverProxy registers on new context while it has not been invalidated on the old one. Please report this as issue at https://github.com/software-mansion/react-native-screens/issues");
}
isObservingContextLifetime = true;
context.addLifecycleEventListener(this);
}
public final void removeOnApplyWindowInsetsListener(@NotNull t listener) {
r.k(listener, "listener");
listeners.remove(listener);
}
public final void unregister() {
View observedView = getObservedView();
if (observedView != null) {
if (!hasBeenRegistered) {
observedView = null;
}
if (observedView != null) {
ViewCompat.I(observedView, (t) null);
}
}
}
}