导航菜单

页面标题

页面副标题

FanCode v7.24.0 - q.java 源代码

正在查看: FanCode v7.24.0 应用的 q.java JAVA 源代码文件

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


package com.swmansion.rnscreens;

import android.annotation.SuppressLint;
import android.content.Context;
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.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.Fragment;
import com.facebook.react.uimanager.PixelUtil;
import com.google.android.material.appbar.AppBarLayout;
import com.swmansion.rnscreens.t;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.SourceDebugExtension;
import org.jetbrains.annotations.NotNull;

@Metadata
@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,258:1\n1#2:259\n*E\n"})
public final class q extends n {
    private AppBarLayout p;
    private Toolbar q;
    private boolean r;
    private boolean s;
    private c t;
    private Function1<? super c, Unit> u;

    @Metadata
    private static final class a extends Animation {

        @NotNull
        private final n a;

        public a(@NotNull n nVar) {
            Intrinsics.checkNotNullParameter(nVar, "mFragment");
            this.a = nVar;
        }

        @Override
        protected void applyTransformation(float f, @NotNull Transformation transformation) {
            Intrinsics.checkNotNullParameter(transformation, "t");
            super.applyTransformation(f, transformation);
            this.a.j(f, !r3.isResumed());
        }
    }

    @Metadata
    @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,258:1\n1#2:259\n*E\n"})
    private static final class b extends CoordinatorLayout {

        @NotNull
        private final n F;

        @NotNull
        private final Animation.AnimationListener G;

        @Metadata
        public static final class a implements Animation.AnimationListener {
            a() {
            }

            @Override
            public void onAnimationEnd(@NotNull Animation animation) {
                Intrinsics.checkNotNullParameter(animation, "animation");
                b.this.F.p();
            }

            @Override
            public void onAnimationRepeat(@NotNull Animation animation) {
                Intrinsics.checkNotNullParameter(animation, "animation");
            }

            @Override
            public void onAnimationStart(@NotNull Animation animation) {
                Intrinsics.checkNotNullParameter(animation, "animation");
                b.this.F.q();
            }
        }

        public b(@NotNull Context context, @NotNull n nVar) {
            super(context);
            Intrinsics.checkNotNullParameter(context, "context");
            Intrinsics.checkNotNullParameter(nVar, "mFragment");
            this.F = nVar;
            this.G = new a();
        }

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

        public void startAnimation(@NotNull Animation animation) {
            Intrinsics.checkNotNullParameter(animation, "animation");
            a aVar = new a(this.F);
            aVar.setDuration(animation.getDuration());
            if ((animation instanceof AnimationSet) && !this.F.isRemoving()) {
                AnimationSet animationSet = (AnimationSet) animation;
                animationSet.addAnimation(aVar);
                animationSet.setAnimationListener(this.G);
                super/*android.view.View*/.startAnimation(animationSet);
                return;
            }
            AnimationSet animationSet2 = new AnimationSet(true);
            animationSet2.addAnimation(animation);
            animationSet2.addAnimation(aVar);
            animationSet2.setAnimationListener(this.G);
            super/*android.view.View*/.startAnimation(animationSet2);
        }
    }

    @SuppressLint({"ValidFragment"})
    public q(@NotNull j jVar) {
        super(jVar);
        Intrinsics.checkNotNullParameter(jVar, "screenView");
    }

    private final void B() {
        View view = getView();
        ViewParent parent = view != null ? view.getParent() : null;
        if (parent instanceof p) {
            ((p) parent).E();
        }
    }

    private final boolean H() {
        s headerConfig = n().getHeaderConfig();
        int configSubviewsCount = headerConfig != null ? headerConfig.getConfigSubviewsCount() : 0;
        if (headerConfig != null && configSubviewsCount > 0) {
            for (int i = 0; i < configSubviewsCount; i++) {
                if (headerConfig.d(i).getType() == t.a.SEARCH_BAR) {
                    return true;
                }
            }
        }
        return false;
    }

    private final void I(Menu menu) {
        menu.clear();
        if (H()) {
            Context context = getContext();
            if (this.t == null && context != null) {
                c cVar = new c(context, this);
                this.t = cVar;
                Function1<? super c, Unit> function1 = this.u;
                if (function1 != null) {
                    function1.invoke(cVar);
                }
            }
            MenuItem add = menu.add("");
            add.setShowAsAction(2);
            add.setActionView((View) this.t);
        }
    }

    public final c A() {
        return this.t;
    }

    public final void C() {
        Toolbar toolbar;
        AppBarLayout appBarLayout = this.p;
        if (appBarLayout != null && (toolbar = this.q) != null && toolbar.getParent() == appBarLayout) {
            appBarLayout.removeView(toolbar);
        }
        this.q = null;
    }

    public final void D(Function1<? super c, Unit> function1) {
        this.u = function1;
    }

    public final void E(@NotNull Toolbar toolbar) {
        Intrinsics.checkNotNullParameter(toolbar, "toolbar");
        AppBarLayout appBarLayout = this.p;
        if (appBarLayout != null) {
            appBarLayout.addView(toolbar);
        }
        AppBarLayout.e eVar = new AppBarLayout.e(-1, -2);
        eVar.g(0);
        toolbar.setLayoutParams(eVar);
        this.q = toolbar;
    }

    public final void F(boolean z) {
        if (this.r != z) {
            AppBarLayout appBarLayout = this.p;
            if (appBarLayout != null) {
                appBarLayout.setTargetElevation(z ? 0.0f : PixelUtil.toPixelFromDIP(4.0f));
            }
            this.r = z;
        }
    }

    public final void G(boolean z) {
        if (this.s != z) {
            CoordinatorLayout.f layoutParams = n().getLayoutParams();
            Intrinsics.checkNotNull(layoutParams, "null cannot be cast to non-null type androidx.coordinatorlayout.widget.CoordinatorLayout.LayoutParams");
            layoutParams.o(z ? null : new AppBarLayout.ScrollingViewBehavior());
            this.s = z;
        }
    }

    public final void dismiss() {
        l<?> container = n().getContainer();
        if (!(container instanceof p)) {
            throw new IllegalStateException("ScreenStackFragment added into a non-stack container".toString());
        }
        ((p) container).z(this);
    }

    @Override
    public void o() {
        s headerConfig = n().getHeaderConfig();
        if (headerConfig != null) {
            headerConfig.g();
        }
    }

    public void onCreateOptionsMenu(@NotNull Menu menu, @NotNull MenuInflater menuInflater) {
        Intrinsics.checkNotNullParameter(menu, "menu");
        Intrinsics.checkNotNullParameter(menuInflater, "inflater");
        I(menu);
        super.onCreateOptionsMenu(menu, menuInflater);
    }

    @Override
    public View onCreateView(@NotNull LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        AppBarLayout appBarLayout;
        AppBarLayout appBarLayout2;
        Intrinsics.checkNotNullParameter(layoutInflater, "inflater");
        Context context = getContext();
        View view = null;
        CoordinatorLayout bVar = context != null ? new b(context, this) : null;
        j n = n();
        CoordinatorLayout.f fVar = new CoordinatorLayout.f(-1, -1);
        fVar.o(this.s ? null : new AppBarLayout.ScrollingViewBehavior());
        n.setLayoutParams(fVar);
        if (bVar != null) {
            bVar.addView(n.r(n()));
        }
        Context context2 = getContext();
        if (context2 != null) {
            view = new AppBarLayout(context2);
            view.setBackgroundColor(0);
            view.setLayoutParams(new AppBarLayout.e(-1, -2));
        }
        this.p = view;
        if (bVar != null) {
            bVar.addView(view);
        }
        if (this.r && (appBarLayout2 = this.p) != null) {
            appBarLayout2.setTargetElevation(0.0f);
        }
        Toolbar toolbar = this.q;
        if (toolbar != null && (appBarLayout = this.p) != null) {
            appBarLayout.addView(n.r(toolbar));
        }
        setHasOptionsMenu(true);
        return bVar;
    }

    public void onPrepareOptionsMenu(@NotNull Menu menu) {
        Intrinsics.checkNotNullParameter(menu, "menu");
        I(menu);
        super.onPrepareOptionsMenu(menu);
    }

    @Override
    public void p() {
        super.p();
        B();
    }

    public final boolean z() {
        l<?> container = n().getContainer();
        if (!(container instanceof p)) {
            throw new IllegalStateException("ScreenStackFragment added into a non-stack container".toString());
        }
        if (!Intrinsics.areEqual(((p) container).getRootScreen(), n())) {
            return true;
        }
        Fragment parentFragment = getParentFragment();
        if (parentFragment instanceof q) {
            return ((q) parentFragment).z();
        }
        return false;
    }

    public q() {
        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.");
    }
}