导航菜单

页面标题

页面副标题

Housing v14.7.8 - ScreenStackFragment.java 源代码

正在查看: Housing v14.7.8 应用的 ScreenStackFragment.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.swmansion.rnscreens;

import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ValueAnimator;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.WindowInsets;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.Transformation;
import androidx.appcompat.widget.Toolbar;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.fragment.app.p;
import com.facebook.react.uimanager.PixelUtil;
import com.facebook.react.uimanager.PointerEvents;
import com.facebook.react.uimanager.ReactPointerEventsView;
import com.facebook.react.uimanager.ThemedReactContext;
import com.facebook.react.uimanager.UIManagerHelper;
import com.facebook.react.uimanager.events.EventDispatcher;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.bottomsheet.BottomSheetBehavior;
import com.google.android.material.shape.MaterialShapeDrawable;
import com.google.android.material.shape.i;
import com.google.android.material.shape.l;
import com.locon.pdp_presentation.ui.components.sections.floorPlan.u;
import com.swmansion.rnscreens.ScreenStackFragment;
import com.swmansion.rnscreens.ScreenStackHeaderSubview;
import com.swmansion.rnscreens.bottomsheet.DimmingViewManager;
import com.swmansion.rnscreens.bottomsheet.SheetDelegate;
import com.swmansion.rnscreens.bottomsheet.SheetUtilsKt;
import com.swmansion.rnscreens.events.ScreenAnimationDelegate;
import com.swmansion.rnscreens.events.ScreenDismissedEvent;
import com.swmansion.rnscreens.events.ScreenEventEmitter;
import com.swmansion.rnscreens.ext.ViewExtKt;
import com.swmansion.rnscreens.transition.ExternalBoundaryValuesEvaluator;
import com.swmansion.rnscreens.utils.DeviceUtils;
import com.swmansion.rnscreens.utils.ViewBackgroundUtilsKt;
import kotlin.Metadata;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlin.jvm.internal.r;
import kq.l;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jivesoftware.smack.sm.packet.StreamManagement;
import zp.j0;

@Metadata(d1 = {"\u0000²\u0001\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0002\b\u000b\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\u000b\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\b\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\u0006\u0018\u00002\u00020\u00012\u00020\u0002:\u0002uvB\u0011\b\u0017\u0012\u0006\u0010\u0004\u001a\u00020\u0003¢\u0006\u0004\b\u0005\u0010\u0006B\t\b\u0016¢\u0006\u0004\b\u0005\u0010\u0007J\u000f\u0010\t\u001a\u00020\bH\u0016¢\u0006\u0004\b\t\u0010\u0007J\u0017\u0010\f\u001a\u00020\b2\u0006\u0010\u000b\u001a\u00020\nH\u0016¢\u0006\u0004\b\f\u0010\rJ\u0017\u0010\u0010\u001a\u00020\b2\u0006\u0010\u000f\u001a\u00020\u000eH\u0016¢\u0006\u0004\b\u0010\u0010\u0011J\u0017\u0010\u0013\u001a\u00020\b2\u0006\u0010\u0012\u001a\u00020\u000eH\u0016¢\u0006\u0004\b\u0013\u0010\u0011J\u000f\u0010\u0014\u001a\u00020\bH\u0016¢\u0006\u0004\b\u0014\u0010\u0007J\u000f\u0010\u0015\u001a\u00020\bH\u0016¢\u0006\u0004\b\u0015\u0010\u0007J\u000f\u0010\u0017\u001a\u00020\bH\u0000¢\u0006\u0004\b\u0016\u0010\u0007J\u000f\u0010\u0019\u001a\u00020\bH\u0000¢\u0006\u0004\b\u0018\u0010\u0007J\u0019\u0010\u001c\u001a\u00020\b2\b\u0010\u001b\u001a\u0004\u0018\u00010\u001aH\u0016¢\u0006\u0004\b\u001c\u0010\u001dJ+\u0010#\u001a\u00020\"2\u0006\u0010\u001f\u001a\u00020\u001e2\b\u0010!\u001a\u0004\u0018\u00010 2\b\u0010\u001b\u001a\u0004\u0018\u00010\u001aH\u0016¢\u0006\u0004\b#\u0010$J!\u0010&\u001a\u00020\b2\u0006\u0010%\u001a\u00020\"2\b\u0010\u001b\u001a\u0004\u0018\u00010\u001aH\u0016¢\u0006\u0004\b&\u0010'J)\u0010-\u001a\u0004\u0018\u00010,2\u0006\u0010)\u001a\u00020(2\u0006\u0010*\u001a\u00020\u000e2\u0006\u0010+\u001a\u00020(H\u0016¢\u0006\u0004\b-\u0010.J)\u00100\u001a\u0004\u0018\u00010/2\u0006\u0010)\u001a\u00020(2\u0006\u0010*\u001a\u00020\u000e2\u0006\u0010+\u001a\u00020(H\u0016¢\u0006\u0004\b0\u00101J\u000f\u00102\u001a\u00020\bH\u0016¢\u0006\u0004\b2\u0010\u0007J\u000f\u00103\u001a\u00020\bH\u0016¢\u0006\u0004\b3\u0010\u0007J\u0017\u00106\u001a\u00020\b2\u0006\u00105\u001a\u000204H\u0016¢\u0006\u0004\b6\u00107J\u001f\u00109\u001a\u00020\b2\u0006\u00105\u001a\u0002042\u0006\u0010\u001f\u001a\u000208H\u0016¢\u0006\u0004\b9\u0010:J\u000f\u0010;\u001a\u00020\u000eH\u0016¢\u0006\u0004\b;\u0010<J\u000f\u0010=\u001a\u00020\bH\u0016¢\u0006\u0004\b=\u0010\u0007J\u000f\u0010>\u001a\u00020\bH\u0002¢\u0006\u0004\b>\u0010\u0007J\u0015\u0010@\u001a\b\u0012\u0004\u0012\u00020\u00030?H\u0002¢\u0006\u0004\b@\u0010AJ\u0019\u0010C\u001a\u0004\u0018\u00010(2\u0006\u0010B\u001a\u00020\u0003H\u0002¢\u0006\u0004\bC\u0010DJ\u0017\u0010E\u001a\u00020\b2\u0006\u0010B\u001a\u00020\u0003H\u0002¢\u0006\u0004\bE\u0010\u0006J\u000f\u0010F\u001a\u00020\u000eH\u0002¢\u0006\u0004\bF\u0010<J\u0017\u0010G\u001a\u00020\b2\u0006\u00105\u001a\u000204H\u0002¢\u0006\u0004\bG\u00107J\u0011\u0010H\u001a\u0004\u0018\u00010\"H\u0002¢\u0006\u0004\bH\u0010IJ\u0019\u0010L\u001a\u00020K2\b\b\u0002\u0010J\u001a\u00020\u000eH\u0002¢\u0006\u0004\bL\u0010MJ\u000f\u0010O\u001a\u00020NH\u0002¢\u0006\u0004\bO\u0010PR\u0018\u0010R\u001a\u0004\u0018\u00010Q8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bR\u0010SR\u0018\u0010\u000b\u001a\u0004\u0018\u00010\n8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b\u000b\u0010TR\u0016\u0010U\u001a\u00020\u000e8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bU\u0010VR\u0016\u0010W\u001a\u00020\u000e8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bW\u0010VR\u0018\u0010X\u001a\u0004\u0018\u00010\"8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bX\u0010YR$\u0010[\u001a\u0004\u0018\u00010Z8\u0006@\u0006X\u0086\u000e¢\u0006\u0012\n\u0004\b[\u0010\\\u001a\u0004\b]\u0010^\"\u0004\b_\u0010`R?\u0010d\u001a\u001f\u0012\u0013\u0012\u00110Z¢\u0006\f\bb\u0012\b\bc\u0012\u0004\b\b([\u0012\u0004\u0012\u00020\b\u0018\u00010a8\u0006@\u0006X\u0086\u000e¢\u0006\u0012\n\u0004\bd\u0010e\u001a\u0004\bf\u0010g\"\u0004\bh\u0010iR\u0016\u0010k\u001a\u00020j8\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\bk\u0010lR\u0018\u0010m\u001a\u0004\u0018\u00010K8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bm\u0010nR\u0018\u0010o\u001a\u0004\u0018\u00010N8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bo\u0010pR\u0014\u0010t\u001a\u00020q8BX\u0082\u0004¢\u0006\u0006\u001a\u0004\br\u0010s¨\u0006w"}, d2 = {"Lcom/swmansion/rnscreens/ScreenStackFragment;", "Lcom/swmansion/rnscreens/ScreenFragment;", "Lcom/swmansion/rnscreens/ScreenStackFragmentWrapper;", "Lcom/swmansion/rnscreens/Screen;", "screenView", "<init>", "(Lcom/swmansion/rnscreens/Screen;)V", "()V", "Lzp/j0;", "removeToolbar", "Landroidx/appcompat/widget/Toolbar;", "toolbar", "setToolbar", "(Landroidx/appcompat/widget/Toolbar;)V", "", "hidden", "setToolbarShadowHidden", "(Z)V", "translucent", "setToolbarTranslucent", "onContainerUpdate", "onViewAnimationEnd", "dismissSelf$react_native_screens_release", "dismissSelf", "onSheetCornerRadiusChange$react_native_screens_release", "onSheetCornerRadiusChange", "Landroid/os/Bundle;", "savedInstanceState", "onCreate", "(Landroid/os/Bundle;)V", "Landroid/view/LayoutInflater;", "inflater", "Landroid/view/ViewGroup;", "container", "Landroid/view/View;", "onCreateView", "(Landroid/view/LayoutInflater;Landroid/view/ViewGroup;Landroid/os/Bundle;)Landroid/view/View;", "view", "onViewCreated", "(Landroid/view/View;Landroid/os/Bundle;)V", "", "transit", "enter", "nextAnim", "Landroid/view/animation/Animation;", "onCreateAnimation", "(IZI)Landroid/view/animation/Animation;", "Landroid/animation/Animator;", "onCreateAnimator", "(IZI)Landroid/animation/Animator;", "onStart", "onStop", "Landroid/view/Menu;", "menu", "onPrepareOptionsMenu", "(Landroid/view/Menu;)V", "Landroid/view/MenuInflater;", "onCreateOptionsMenu", "(Landroid/view/Menu;Landroid/view/MenuInflater;)V", "canNavigateBack", "()Z", "dismissFromContainer", "notifyViewAppearTransitionEnd", "Lcom/google/android/material/bottomsheet/BottomSheetBehavior;", "createBottomSheetBehaviour", "()Lcom/google/android/material/bottomsheet/BottomSheetBehavior;", "screen", "resolveBackgroundColor", "(Lcom/swmansion/rnscreens/Screen;)Ljava/lang/Integer;", "attachShapeToScreen", "shouldShowSearchBar", "updateToolbarMenu", "findLastFocusedChild", "()Landroid/view/View;", "forceCreation", "Lcom/swmansion/rnscreens/bottomsheet/DimmingViewManager;", "requireDimmingDelegate", "(Z)Lcom/swmansion/rnscreens/bottomsheet/DimmingViewManager;", "Lcom/swmansion/rnscreens/bottomsheet/SheetDelegate;", "requireSheetDelegate", "()Lcom/swmansion/rnscreens/bottomsheet/SheetDelegate;", "Lcom/google/android/material/appbar/AppBarLayout;", "appBarLayout", "Lcom/google/android/material/appbar/AppBarLayout;", "Landroidx/appcompat/widget/Toolbar;", "isToolbarShadowHidden", "Z", "isToolbarTranslucent", "lastFocusedChild", "Landroid/view/View;", "Lcom/swmansion/rnscreens/CustomSearchView;", "searchView", "Lcom/swmansion/rnscreens/CustomSearchView;", "getSearchView", "()Lcom/swmansion/rnscreens/CustomSearchView;", "setSearchView", "(Lcom/swmansion/rnscreens/CustomSearchView;)V", "Lkotlin/Function1;", "Lkotlin/ParameterName;", "name", "onSearchViewCreate", "Lkq/l;", "getOnSearchViewCreate", "()Lkq/l;", "setOnSearchViewCreate", "(Lkq/l;)V", "Lcom/swmansion/rnscreens/ScreenStackFragment$ScreensCoordinatorLayout;", "coordinatorLayout", "Lcom/swmansion/rnscreens/ScreenStackFragment$ScreensCoordinatorLayout;", "dimmingDelegate", "Lcom/swmansion/rnscreens/bottomsheet/DimmingViewManager;", "sheetDelegate", "Lcom/swmansion/rnscreens/bottomsheet/SheetDelegate;", "Lcom/swmansion/rnscreens/ScreenStack;", "getScreenStack", "()Lcom/swmansion/rnscreens/ScreenStack;", "screenStack", "ScreensCoordinatorLayout", "ScreensAnimation", "react-native-screens_release"}, k = 1, mv = {2, 0, 0}, xi = 48)
@SourceDebugExtension({"SMAP\nScreenStackFragment.kt\nKotlin\n*S Kotlin\n*F\n+ 1 ScreenStackFragment.kt\ncom/swmansion/rnscreens/ScreenStackFragment\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,591:1\n1#2:592\n*E\n"})
public final class ScreenStackFragment extends ScreenFragment implements ScreenStackFragmentWrapper {

    @Nullable
    private AppBarLayout appBarLayout;
    private ScreensCoordinatorLayout coordinatorLayout;

    @Nullable
    private DimmingViewManager dimmingDelegate;
    private boolean isToolbarShadowHidden;
    private boolean isToolbarTranslucent;

    @Nullable
    private View lastFocusedChild;

    @Nullable
    private l<? super CustomSearchView, j0> onSearchViewCreate;

    @Nullable
    private CustomSearchView searchView;

    @Nullable
    private SheetDelegate sheetDelegate;

    @Nullable
    private Toolbar toolbar;

    @Metadata(d1 = {"\u0000$\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u0007\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\b\u0002\u0018\u00002\u00020\u0001B\u000f\u0012\u0006\u0010\u0003\u001a\u00020\u0002¢\u0006\u0004\b\u0004\u0010\u0005J\u001f\u0010\u000b\u001a\u00020\n2\u0006\u0010\u0007\u001a\u00020\u00062\u0006\u0010\t\u001a\u00020\bH\u0014¢\u0006\u0004\b\u000b\u0010\fR\u0014\u0010\u0003\u001a\u00020\u00028\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b\u0003\u0010\r¨\u0006\u000e"}, d2 = {"Lcom/swmansion/rnscreens/ScreenStackFragment$ScreensAnimation;", "Landroid/view/animation/Animation;", "Lcom/swmansion/rnscreens/ScreenFragment;", "mFragment", "<init>", "(Lcom/swmansion/rnscreens/ScreenFragment;)V", "", "interpolatedTime", "Landroid/view/animation/Transformation;", "t", "Lzp/j0;", "applyTransformation", "(FLandroid/view/animation/Transformation;)V", "Lcom/swmansion/rnscreens/ScreenFragment;", "react-native-screens_release"}, k = 1, mv = {2, 0, 0}, xi = 48)
    public static final class ScreensAnimation extends Animation {

        @NotNull
        private final ScreenFragment mFragment;

        public ScreensAnimation(@NotNull ScreenFragment mFragment) {
            r.k(mFragment, "mFragment");
            this.mFragment = mFragment;
        }

        @Override
        public void applyTransformation(float interpolatedTime, @NotNull Transformation t) {
            r.k(t, "t");
            super.applyTransformation(interpolatedTime, t);
            this.mFragment.dispatchTransitionProgressEvent(interpolatedTime, !r3.isResumed());
        }
    }

    @SuppressLint({"ValidFragment"})
    public ScreenStackFragment(@NotNull Screen screenView) {
        super(screenView);
        r.k(screenView, "screenView");
    }

    private final void attachShapeToScreen(Screen screen) {
        float pixelFromDIP = PixelUtil.toPixelFromDIP(screen.getSheetCornerRadius());
        l.a aVar = new l.a();
        aVar.n(i.a(0));
        aVar.o(pixelFromDIP);
        aVar.r(i.a(0));
        aVar.s(pixelFromDIP);
        MaterialShapeDrawable materialShapeDrawable = new MaterialShapeDrawable(aVar.a());
        Integer resolveBackgroundColor = resolveBackgroundColor(screen);
        materialShapeDrawable.setTint(resolveBackgroundColor != null ? resolveBackgroundColor.intValue() : 0);
        screen.setBackground(materialShapeDrawable);
    }

    private final BottomSheetBehavior<Screen> createBottomSheetBehaviour() {
        return new BottomSheetBehavior<>();
    }

    private final View findLastFocusedChild() {
        View screen = getScreen();
        while (screen != null) {
            if (screen.isFocused()) {
                return screen;
            }
            screen = screen instanceof ViewGroup ? ((ViewGroup) screen).getFocusedChild() : null;
        }
        return null;
    }

    private final ScreenStack getScreenStack() {
        ScreenContainer container = getScreen().getContainer();
        if (container instanceof ScreenStack) {
            return (ScreenStack) container;
        }
        throw new IllegalStateException("ScreenStackFragment added into a non-stack container");
    }

    private final void notifyViewAppearTransitionEnd() {
        View view = getView();
        ViewParent parent = view != null ? view.getParent() : null;
        if (parent instanceof ScreenStack) {
            ((ScreenStack) parent).onViewAppearTransitionEnd();
        }
    }

    public static final void onCreateAnimator$lambda$10$lambda$9(DimmingViewManager dimmingViewManager, ValueAnimator anim) {
        r.k(anim, "anim");
        Object animatedValue = anim.getAnimatedValue();
        Float f = animatedValue instanceof Float ? (Float) animatedValue : null;
        if (f != null) {
            dimmingViewManager.getDimmingView().setAlpha(f.floatValue());
        }
    }

    public static final float onCreateAnimator$lambda$11(ScreenStackFragment screenStackFragment, Number number) {
        return screenStackFragment.getScreen().getHeight();
    }

    public static final Float onCreateAnimator$lambda$12(Number number) {
        return Float.valueOf(0.0f);
    }

    public static final void onCreateAnimator$lambda$15$lambda$14(ScreenStackFragment screenStackFragment, ValueAnimator anim) {
        r.k(anim, "anim");
        Object animatedValue = anim.getAnimatedValue();
        Float f = animatedValue instanceof Float ? (Float) animatedValue : null;
        if (f != null) {
            screenStackFragment.getScreen().setTranslationY(f.floatValue());
        }
    }

    public static final void onCreateAnimator$lambda$19$lambda$18(DimmingViewManager dimmingViewManager, ValueAnimator anim) {
        r.k(anim, "anim");
        Object animatedValue = anim.getAnimatedValue();
        Float f = animatedValue instanceof Float ? (Float) animatedValue : null;
        if (f != null) {
            dimmingViewManager.getDimmingView().setAlpha(f.floatValue());
        }
    }

    public static final void onCreateAnimator$lambda$22$lambda$21(ScreenStackFragment screenStackFragment, ValueAnimator anim) {
        r.k(anim, "anim");
        Object animatedValue = anim.getAnimatedValue();
        Float f = animatedValue instanceof Float ? (Float) animatedValue : null;
        if (f != null) {
            screenStackFragment.getScreen().setTranslationY(f.floatValue());
        }
    }

    private final DimmingViewManager requireDimmingDelegate(boolean forceCreation) {
        DimmingViewManager dimmingViewManager = this.dimmingDelegate;
        if (dimmingViewManager == null || forceCreation) {
            if (dimmingViewManager != null) {
                dimmingViewManager.invalidate(getScreen().getSheetBehavior());
            }
            this.dimmingDelegate = new DimmingViewManager(getScreen().getReactContext(), getScreen());
        }
        DimmingViewManager dimmingViewManager2 = this.dimmingDelegate;
        r.h(dimmingViewManager2);
        return dimmingViewManager2;
    }

    public static DimmingViewManager requireDimmingDelegate$default(ScreenStackFragment screenStackFragment, boolean z, int i, Object obj) {
        if ((i & 1) != 0) {
            z = false;
        }
        return screenStackFragment.requireDimmingDelegate(z);
    }

    private final SheetDelegate requireSheetDelegate() {
        if (this.sheetDelegate == null) {
            this.sheetDelegate = new SheetDelegate(getScreen());
        }
        SheetDelegate sheetDelegate = this.sheetDelegate;
        r.h(sheetDelegate);
        return sheetDelegate;
    }

    private final Integer resolveBackgroundColor(Screen screen) {
        Integer valueOf;
        ColorStateList z;
        Drawable background = screen.getBackground();
        ColorDrawable colorDrawable = background instanceof ColorDrawable ? (ColorDrawable) background : null;
        if (colorDrawable != null) {
            valueOf = Integer.valueOf(colorDrawable.getColor());
        } else {
            MaterialShapeDrawable background2 = screen.getBackground();
            MaterialShapeDrawable materialShapeDrawable = background2 instanceof MaterialShapeDrawable ? background2 : null;
            valueOf = (materialShapeDrawable == null || (z = materialShapeDrawable.z()) == null) ? null : Integer.valueOf(z.getDefaultColor());
        }
        if (valueOf != null) {
            return valueOf;
        }
        ScreenContentWrapper screenContentWrapper = screen.getContentWrapper().get();
        if (screenContentWrapper == null) {
            return null;
        }
        return ViewBackgroundUtilsKt.resolveBackgroundColor(screenContentWrapper);
    }

    private final boolean shouldShowSearchBar() {
        ScreenStackHeaderConfig headerConfig = getScreen().getHeaderConfig();
        int configSubviewsCount = headerConfig != null ? headerConfig.getConfigSubviewsCount() : 0;
        if (headerConfig != null && configSubviewsCount > 0) {
            for (int i = 0; i < configSubviewsCount; i++) {
                if (headerConfig.getConfigSubview(i).getType() == ScreenStackHeaderSubview.Type.SEARCH_BAR) {
                    return true;
                }
            }
        }
        return false;
    }

    private final void updateToolbarMenu(Menu menu) {
        menu.clear();
        if (shouldShowSearchBar()) {
            Context context = getContext();
            if (this.searchView == null && context != null) {
                CustomSearchView customSearchView = new CustomSearchView(context, this);
                this.searchView = customSearchView;
                kq.l<? super CustomSearchView, j0> lVar = this.onSearchViewCreate;
                if (lVar != null) {
                    lVar.invoke(customSearchView);
                }
            }
            MenuItem add = menu.add("");
            add.setShowAsAction(2);
            add.setActionView((View) this.searchView);
        }
    }

    @Override
    public boolean canNavigateBack() {
        ScreenContainer container = getScreen().getContainer();
        if (!(container instanceof ScreenStack)) {
            throw new IllegalStateException("ScreenStackFragment added into a non-stack container");
        }
        if (!r.f(((ScreenStack) container).getRootScreen(), getScreen())) {
            return true;
        }
        p parentFragment = getParentFragment();
        if (parentFragment instanceof ScreenStackFragment) {
            return ((ScreenStackFragment) parentFragment).canNavigateBack();
        }
        return false;
    }

    @Override
    public void dismissFromContainer() {
        getScreenStack().dismiss(this);
    }

    public final void dismissSelf$react_native_screens_release() {
        if (isRemoving() && isDetached()) {
            return;
        }
        ThemedReactContext reactContext = getScreen().getReactContext();
        int surfaceId = UIManagerHelper.getSurfaceId(reactContext);
        EventDispatcher eventDispatcherForReactTag = UIManagerHelper.getEventDispatcherForReactTag(reactContext, getScreen().getId());
        if (eventDispatcherForReactTag != null) {
            eventDispatcherForReactTag.dispatchEvent(new ScreenDismissedEvent(surfaceId, getScreen().getId()));
        }
    }

    @Nullable
    public final kq.l<CustomSearchView, j0> getOnSearchViewCreate() {
        return this.onSearchViewCreate;
    }

    @Nullable
    public final CustomSearchView getSearchView() {
        return this.searchView;
    }

    @Override
    public void onContainerUpdate() {
        super.onContainerUpdate();
        ScreenStackHeaderConfig headerConfig = getScreen().getHeaderConfig();
        if (headerConfig != null) {
            headerConfig.onUpdate();
        }
    }

    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Nullable
    public Animation onCreateAnimation(int transit, boolean enter, int nextAnim) {
        return null;
    }

    @Nullable
    public Animator onCreateAnimator(int transit, boolean enter, int nextAnim) {
        final int i = 1;
        final int i2 = 0;
        if (!SheetUtilsKt.usesFormSheetPresentation(getScreen())) {
            return null;
        }
        AnimatorSet animatorSet = new AnimatorSet();
        final DimmingViewManager requireDimmingDelegate$default = requireDimmingDelegate$default(this, false, 1, null);
        if (enter) {
            ValueAnimator ofFloat = ValueAnimator.ofFloat(0.0f, requireDimmingDelegate$default.getMaxAlpha());
            ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
                @Override
                public final void onAnimationUpdate(ValueAnimator valueAnimator) {
                    switch (i2) {
                        case 0:
                            ScreenStackFragment.onCreateAnimator$lambda$10$lambda$9(requireDimmingDelegate$default, valueAnimator);
                            break;
                        default:
                            ScreenStackFragment.onCreateAnimator$lambda$19$lambda$18(requireDimmingDelegate$default, valueAnimator);
                            break;
                    }
                }
            });
            ValueAnimator ofObject = ValueAnimator.ofObject(new ExternalBoundaryValuesEvaluator(new u(this, 17), new com.locon.reactapp.seller.nativeModules.a(8)), Float.valueOf(getScreen().getHeight()), Float.valueOf(0.0f));
            ofObject.addUpdateListener(new ValueAnimator.AnimatorUpdateListener(this) {
                public final ScreenStackFragment b;

                {
                    this.b = this;
                }

                @Override
                public final void onAnimationUpdate(ValueAnimator valueAnimator) {
                    switch (i2) {
                        case 0:
                            ScreenStackFragment.onCreateAnimator$lambda$15$lambda$14(this.b, valueAnimator);
                            break;
                        default:
                            ScreenStackFragment.onCreateAnimator$lambda$22$lambda$21(this.b, valueAnimator);
                            break;
                    }
                }
            });
            AnimatorSet.Builder play = requireDimmingDelegate$default.willDimForDetentIndex(getScreen(), getScreen().getSheetInitialDetentIndex()) ? animatorSet.play(ofObject) : null;
            if (play != null) {
                play.with(ofFloat);
            }
        } else {
            ValueAnimator ofFloat2 = ValueAnimator.ofFloat(requireDimmingDelegate$default.getDimmingView().getAlpha(), 0.0f);
            ofFloat2.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
                @Override
                public final void onAnimationUpdate(ValueAnimator valueAnimator) {
                    switch (i) {
                        case 0:
                            ScreenStackFragment.onCreateAnimator$lambda$10$lambda$9(requireDimmingDelegate$default, valueAnimator);
                            break;
                        default:
                            ScreenStackFragment.onCreateAnimator$lambda$19$lambda$18(requireDimmingDelegate$default, valueAnimator);
                            break;
                    }
                }
            });
            if (this.coordinatorLayout == null) {
                r.o("coordinatorLayout");
                throw null;
            }
            ValueAnimator ofFloat3 = ValueAnimator.ofFloat(0.0f, r3.getBottom() - getScreen().getTop());
            ofFloat3.addUpdateListener(new ValueAnimator.AnimatorUpdateListener(this) {
                public final ScreenStackFragment b;

                {
                    this.b = this;
                }

                @Override
                public final void onAnimationUpdate(ValueAnimator valueAnimator) {
                    switch (i) {
                        case 0:
                            ScreenStackFragment.onCreateAnimator$lambda$15$lambda$14(this.b, valueAnimator);
                            break;
                        default:
                            ScreenStackFragment.onCreateAnimator$lambda$22$lambda$21(this.b, valueAnimator);
                            break;
                    }
                }
            });
            animatorSet.play(ofFloat2).with(ofFloat3);
        }
        animatorSet.addListener(new ScreenAnimationDelegate(this, new ScreenEventEmitter(getScreen()), enter ? ScreenAnimationDelegate.AnimationType.ENTER : ScreenAnimationDelegate.AnimationType.EXIT));
        return animatorSet;
    }

    public void onCreateOptionsMenu(@NotNull Menu menu, @NotNull MenuInflater inflater) {
        r.k(menu, "menu");
        r.k(inflater, "inflater");
        updateToolbarMenu(menu);
        super.onCreateOptionsMenu(menu, inflater);
    }

    @Override
    @NotNull
    public View onCreateView(@NotNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view;
        AppBarLayout appBarLayout;
        AppBarLayout appBarLayout2;
        r.k(inflater, "inflater");
        Context requireContext = requireContext();
        r.j(requireContext, "requireContext(...)");
        this.coordinatorLayout = new ScreensCoordinatorLayout(requireContext, this);
        Screen screen = getScreen();
        CoordinatorLayout.d dVar = new CoordinatorLayout.d(-1, -1);
        dVar.i(SheetUtilsKt.usesFormSheetPresentation(getScreen()) ? createBottomSheetBehaviour() : this.isToolbarTranslucent ? null : new AppBarLayout.ScrollingViewBehavior<>());
        screen.setLayoutParams(dVar);
        CoordinatorLayout coordinatorLayout = this.coordinatorLayout;
        if (coordinatorLayout == null) {
            r.o("coordinatorLayout");
            throw null;
        }
        coordinatorLayout.addView(ViewExtKt.recycle(getScreen()));
        if (SheetUtilsKt.usesFormSheetPresentation(getScreen())) {
            getScreen().setClipToOutline(true);
            attachShapeToScreen(getScreen());
            getScreen().setElevation(getScreen().getSheetElevation());
            SheetDelegate requireSheetDelegate = requireSheetDelegate();
            BottomSheetBehavior<Screen> sheetBehavior = getScreen().getSheetBehavior();
            r.h(sheetBehavior);
            SheetDelegate.configureBottomSheetBehaviour$react_native_screens_release$default(requireSheetDelegate, sheetBehavior, null, 0, 6, null);
            DimmingViewManager requireDimmingDelegate = requireDimmingDelegate(true);
            Screen screen2 = getScreen();
            CoordinatorLayout coordinatorLayout2 = this.coordinatorLayout;
            if (coordinatorLayout2 == null) {
                r.o("coordinatorLayout");
                throw null;
            }
            requireDimmingDelegate.onViewHierarchyCreated(screen2, coordinatorLayout2);
            Screen screen3 = getScreen();
            BottomSheetBehavior<Screen> sheetBehavior2 = getScreen().getSheetBehavior();
            r.h(sheetBehavior2);
            requireDimmingDelegate.onBehaviourAttached(screen3, sheetBehavior2);
            ScreenContainer container2 = getScreen().getContainer();
            r.h(container2);
            CoordinatorLayout coordinatorLayout3 = this.coordinatorLayout;
            if (coordinatorLayout3 == null) {
                r.o("coordinatorLayout");
                throw null;
            }
            coordinatorLayout3.measure(View.MeasureSpec.makeMeasureSpec(container2.getWidth(), 1073741824), View.MeasureSpec.makeMeasureSpec(container2.getHeight(), 1073741824));
            CoordinatorLayout coordinatorLayout4 = this.coordinatorLayout;
            if (coordinatorLayout4 == null) {
                r.o("coordinatorLayout");
                throw null;
            }
            coordinatorLayout4.layout(0, 0, container2.getWidth(), container2.getHeight());
        } else {
            Context context = getContext();
            if (context != null) {
                view = new AppBarLayout(context);
                view.setBackgroundColor(0);
                view.setLayoutParams(new AppBarLayout.LayoutParams(-1, -2));
            } else {
                view = null;
            }
            this.appBarLayout = view;
            CoordinatorLayout coordinatorLayout5 = this.coordinatorLayout;
            if (coordinatorLayout5 == null) {
                r.o("coordinatorLayout");
                throw null;
            }
            coordinatorLayout5.addView(view);
            if (this.isToolbarShadowHidden && (appBarLayout2 = this.appBarLayout) != null) {
                appBarLayout2.setTargetElevation(0.0f);
            }
            Toolbar toolbar = this.toolbar;
            if (toolbar != null && (appBarLayout = this.appBarLayout) != null) {
                appBarLayout.addView(ViewExtKt.recycle(toolbar));
            }
            setHasOptionsMenu(true);
        }
        CoordinatorLayout coordinatorLayout6 = this.coordinatorLayout;
        if (coordinatorLayout6 != null) {
            return coordinatorLayout6;
        }
        r.o("coordinatorLayout");
        throw null;
    }

    public void onPrepareOptionsMenu(@NotNull Menu menu) {
        ScreenStackHeaderConfig headerConfig;
        r.k(menu, "menu");
        if (!getScreen().isTransparent() || ((headerConfig = getScreen().getHeaderConfig()) != null && !headerConfig.getIsHeaderHidden())) {
            updateToolbarMenu(menu);
        }
        super.onPrepareOptionsMenu(menu);
    }

    public final void onSheetCornerRadiusChange$react_native_screens_release() {
        getScreen().onSheetCornerRadiusChange$react_native_screens_release();
    }

    @Override
    public void onStart() {
        View view = this.lastFocusedChild;
        if (view != null) {
            view.requestFocus();
        }
        super.onStart();
    }

    @Override
    public void onStop() {
        if (DeviceUtils.INSTANCE.isPlatformAndroidTV(getContext())) {
            this.lastFocusedChild = findLastFocusedChild();
        }
        super.onStop();
    }

    @Override
    public void onViewAnimationEnd() {
        super.onViewAnimationEnd();
        notifyViewAppearTransitionEnd();
        getScreen().endRemovalTransition();
    }

    public void onViewCreated(@NotNull View view, @Nullable Bundle savedInstanceState) {
        r.k(view, "view");
        super.onViewCreated(view, savedInstanceState);
    }

    @Override
    public void removeToolbar() {
        Toolbar toolbar;
        AppBarLayout appBarLayout = this.appBarLayout;
        if (appBarLayout != null && (toolbar = this.toolbar) != null && toolbar.getParent() == appBarLayout) {
            appBarLayout.removeView(toolbar);
        }
        this.toolbar = null;
    }

    public final void setOnSearchViewCreate(@Nullable kq.l<? super CustomSearchView, j0> lVar) {
        this.onSearchViewCreate = lVar;
    }

    public final void setSearchView(@Nullable CustomSearchView customSearchView) {
        this.searchView = customSearchView;
    }

    @Override
    public void setToolbar(@NotNull Toolbar toolbar) {
        r.k(toolbar, "toolbar");
        AppBarLayout appBarLayout = this.appBarLayout;
        if (appBarLayout != null) {
            appBarLayout.addView(toolbar);
        }
        AppBarLayout.LayoutParams layoutParams = new AppBarLayout.LayoutParams(-1, -2);
        layoutParams.c(0);
        toolbar.setLayoutParams(layoutParams);
        this.toolbar = toolbar;
    }

    @Override
    public void setToolbarShadowHidden(boolean hidden) {
        if (this.isToolbarShadowHidden != hidden) {
            AppBarLayout appBarLayout = this.appBarLayout;
            if (appBarLayout != null) {
                appBarLayout.setElevation(hidden ? 0.0f : PixelUtil.toPixelFromDIP(4.0f));
            }
            AppBarLayout appBarLayout2 = this.appBarLayout;
            if (appBarLayout2 != null) {
                appBarLayout2.setStateListAnimator(null);
            }
            this.isToolbarShadowHidden = hidden;
        }
    }

    @Override
    public void setToolbarTranslucent(boolean translucent) {
        if (this.isToolbarTranslucent != translucent) {
            CoordinatorLayout.d layoutParams = getScreen().getLayoutParams();
            r.i(layoutParams, "null cannot be cast to non-null type androidx.coordinatorlayout.widget.CoordinatorLayout.LayoutParams");
            layoutParams.i(translucent ? null : new AppBarLayout.ScrollingViewBehavior());
            this.isToolbarTranslucent = translucent;
        }
    }

    public ScreenStackFragment() {
        throw new IllegalStateException("ScreenStack fragments should never be restored. Follow instructions from https://github.com/software-mansion/react-native-screens/issues/17#issuecomment-424704067 to properly configure your main activity.");
    }

    @Metadata(d1 = {"\u0000N\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\b\n\u0002\b\b\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\b\u0002\u0018\u00002\u00020\u00012\u00020\u0002B\u001f\u0012\u0006\u0010\u0004\u001a\u00020\u0003\u0012\u0006\u0010\u0006\u001a\u00020\u0005\u0012\u0006\u0010\u0007\u001a\u00020\u0002¢\u0006\u0004\b\b\u0010\tB\u0019\b\u0016\u0012\u0006\u0010\u0004\u001a\u00020\u0003\u0012\u0006\u0010\u0006\u001a\u00020\u0005¢\u0006\u0004\b\b\u0010\nJ\u0019\u0010\r\u001a\u00020\u000b2\b\u0010\f\u001a\u0004\u0018\u00010\u000bH\u0016¢\u0006\u0004\b\r\u0010\u000eJ\u0017\u0010\u0012\u001a\u00020\u00112\u0006\u0010\u0010\u001a\u00020\u000fH\u0016¢\u0006\u0004\b\u0012\u0010\u0013J\u000f\u0010\u0014\u001a\u00020\u0011H\u0016¢\u0006\u0004\b\u0014\u0010\u0015J7\u0010\u001d\u001a\u00020\u00112\u0006\u0010\u0017\u001a\u00020\u00162\u0006\u0010\u0019\u001a\u00020\u00182\u0006\u0010\u001a\u001a\u00020\u00182\u0006\u0010\u001b\u001a\u00020\u00182\u0006\u0010\u001c\u001a\u00020\u0018H\u0014¢\u0006\u0004\b\u001d\u0010\u001eR\u0014\u0010\u0006\u001a\u00020\u00058\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b\u0006\u0010\u001fR\u0014\u0010\u0007\u001a\u00020\u00028\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b\u0007\u0010 R\u0014\u0010\"\u001a\u00020!8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b\"\u0010#R\u0014\u0010'\u001a\u00020$8\u0016X\u0096\u0005¢\u0006\u0006\u001a\u0004\b%\u0010&¨\u0006("}, d2 = {"Lcom/swmansion/rnscreens/ScreenStackFragment$ScreensCoordinatorLayout;", "Landroidx/coordinatorlayout/widget/CoordinatorLayout;", "Lcom/facebook/react/uimanager/ReactPointerEventsView;", "Landroid/content/Context;", "context", "Lcom/swmansion/rnscreens/ScreenStackFragment;", "fragment", "pointerEventsImpl", "<init>", "(Landroid/content/Context;Lcom/swmansion/rnscreens/ScreenStackFragment;Lcom/facebook/react/uimanager/ReactPointerEventsView;)V", "(Landroid/content/Context;Lcom/swmansion/rnscreens/ScreenStackFragment;)V", "Landroid/view/WindowInsets;", "insets", "onApplyWindowInsets", "(Landroid/view/WindowInsets;)Landroid/view/WindowInsets;", "Landroid/view/animation/Animation;", "animation", "Lzp/j0;", "startAnimation", "(Landroid/view/animation/Animation;)V", "clearFocus", "()V", "", "changed", "", "l", "t", StreamManagement.AckRequest.ELEMENT, "b", "onLayout", "(ZIIII)V", "Lcom/swmansion/rnscreens/ScreenStackFragment;", "Lcom/facebook/react/uimanager/ReactPointerEventsView;", "Landroid/view/animation/Animation$AnimationListener;", "animationListener", "Landroid/view/animation/Animation$AnimationListener;", "Lcom/facebook/react/uimanager/PointerEvents;", "getPointerEvents", "()Lcom/facebook/react/uimanager/PointerEvents;", "pointerEvents", "react-native-screens_release"}, k = 1, mv = {2, 0, 0}, xi = 48)
    @SourceDebugExtension({"SMAP\nScreenStackFragment.kt\nKotlin\n*S Kotlin\n*F\n+ 1 ScreenStackFragment.kt\ncom/swmansion/rnscreens/ScreenStackFragment$ScreensCoordinatorLayout\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,591:1\n1#2:592\n*E\n"})
    public static final class ScreensCoordinatorLayout extends CoordinatorLayout implements ReactPointerEventsView {

        @NotNull
        private final Animation.AnimationListener animationListener;

        @NotNull
        private final ScreenStackFragment fragment;

        @NotNull
        private final ReactPointerEventsView pointerEventsImpl;

        public ScreensCoordinatorLayout(@NotNull Context context, @NotNull ScreenStackFragment fragment, @NotNull ReactPointerEventsView pointerEventsImpl) {
            super(context);
            r.k(context, "context");
            r.k(fragment, "fragment");
            r.k(pointerEventsImpl, "pointerEventsImpl");
            this.fragment = fragment;
            this.pointerEventsImpl = pointerEventsImpl;
            this.animationListener = new Animation.AnimationListener() {
                @Override
                public void onAnimationEnd(Animation animation) {
                    ScreenStackFragment screenStackFragment;
                    r.k(animation, "animation");
                    screenStackFragment = ScreenStackFragment.ScreensCoordinatorLayout.this.fragment;
                    screenStackFragment.onViewAnimationEnd();
                }

                @Override
                public void onAnimationRepeat(Animation animation) {
                    r.k(animation, "animation");
                }

                @Override
                public void onAnimationStart(Animation animation) {
                    ScreenStackFragment screenStackFragment;
                    r.k(animation, "animation");
                    screenStackFragment = ScreenStackFragment.ScreensCoordinatorLayout.this.fragment;
                    screenStackFragment.onViewAnimationStart();
                }
            };
        }

        public void clearFocus() {
            if (getVisibility() != 4) {
                super/*android.view.View*/.clearFocus();
            }
        }

        @NotNull
        public PointerEvents getPointerEvents() {
            return this.pointerEventsImpl.getPointerEvents();
        }

        @NotNull
        public WindowInsets onApplyWindowInsets(@Nullable WindowInsets insets) {
            WindowInsets onApplyWindowInsets = super/*android.view.View*/.onApplyWindowInsets(insets);
            r.j(onApplyWindowInsets, "onApplyWindowInsets(...)");
            return onApplyWindowInsets;
        }

        public void onLayout(boolean changed, int l, int t, int r, int b) {
            super.onLayout(changed, l, t, r, b);
            if (SheetUtilsKt.usesFormSheetPresentation(this.fragment.getScreen())) {
                this.fragment.getScreen().onBottomSheetBehaviorDidLayout$react_native_screens_release(changed);
            }
        }

        public void startAnimation(@NotNull Animation animation) {
            r.k(animation, "animation");
            ScreensAnimation screensAnimation = new ScreensAnimation(this.fragment);
            screensAnimation.setDuration(animation.getDuration());
            if ((animation instanceof AnimationSet) && !this.fragment.isRemoving()) {
                AnimationSet animationSet = (AnimationSet) animation;
                animationSet.addAnimation(screensAnimation);
                animationSet.setAnimationListener(this.animationListener);
                super/*android.view.View*/.startAnimation(animationSet);
                return;
            }
            AnimationSet animationSet2 = new AnimationSet(true);
            animationSet2.addAnimation(animation);
            animationSet2.addAnimation(screensAnimation);
            animationSet2.setAnimationListener(this.animationListener);
            super/*android.view.View*/.startAnimation(animationSet2);
        }

        public ScreensCoordinatorLayout(@NotNull Context context, @NotNull ScreenStackFragment fragment) {
            this(context, fragment, new PointerEventsBoxNoneImpl());
            r.k(context, "context");
            r.k(fragment, "fragment");
        }
    }
}