正在查看: Oolka v2.4.42 应用的 ScreenStackFragment.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Oolka v2.4.42 应用的 ScreenStackFragment.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,284:1\n1#2:285\n*E\n"})
public final class ScreenStackFragment extends ScreenFragment implements q {
public AppBarLayout l;
public Toolbar o;
public boolean p;
public boolean q;
public View r;
public c s;
public Function1<? super c, Unit> t;
@Metadata
public static final class a extends Animation {
@NotNull
public final ScreenFragment a;
public a(@NotNull ScreenFragment mFragment) {
Intrinsics.checkNotNullParameter(mFragment, "mFragment");
this.a = mFragment;
}
@Override
public void applyTransformation(float f, @NotNull Transformation t) {
Intrinsics.checkNotNullParameter(t, "t");
super.applyTransformation(f, t);
this.a.x(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,284:1\n1#2:285\n*E\n"})
public static final class b extends CoordinatorLayout {
@NotNull
public final ScreenFragment y;
@NotNull
public final Animation.AnimationListener z;
@Metadata
public static final class a implements Animation.AnimationListener {
public a() {
}
@Override
public void onAnimationEnd(@NotNull Animation animation) {
Intrinsics.checkNotNullParameter(animation, "animation");
b.this.y.A();
}
@Override
public void onAnimationRepeat(@NotNull Animation animation) {
Intrinsics.checkNotNullParameter(animation, "animation");
}
@Override
public void onAnimationStart(@NotNull Animation animation) {
Intrinsics.checkNotNullParameter(animation, "animation");
b.this.y.B();
}
}
public b(@NotNull Context context, @NotNull ScreenFragment mFragment) {
super(context);
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(mFragment, "mFragment");
this.y = mFragment;
this.z = 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.y);
aVar.setDuration(animation.getDuration());
if ((animation instanceof AnimationSet) && !this.y.isRemoving()) {
AnimationSet animationSet = (AnimationSet) animation;
animationSet.addAnimation(aVar);
animationSet.setAnimationListener(this.z);
super/*android.view.View*/.startAnimation(animationSet);
return;
}
AnimationSet animationSet2 = new AnimationSet(true);
animationSet2.addAnimation(animation);
animationSet2.addAnimation(aVar);
animationSet2.setAnimationListener(this.z);
super/*android.view.View*/.startAnimation(animationSet2);
}
}
@SuppressLint({"ValidFragment"})
public ScreenStackFragment(@NotNull i screenView) {
super(screenView);
Intrinsics.checkNotNullParameter(screenView, "screenView");
}
@Override
public void A() {
super.A();
I();
}
public boolean F() {
k container = e().getContainer();
if (!(container instanceof p)) {
throw new IllegalStateException("ScreenStackFragment added into a non-stack container".toString());
}
if (!Intrinsics.areEqual(((p) container).getRootScreen(), e())) {
return true;
}
Fragment parentFragment = getParentFragment();
if (parentFragment instanceof ScreenStackFragment) {
return ((ScreenStackFragment) parentFragment).F();
}
return false;
}
public final View G() {
View e = e();
while (e != null) {
if (e.isFocused()) {
return e;
}
e = e instanceof ViewGroup ? ((ViewGroup) e).getFocusedChild() : null;
}
return null;
}
public final c H() {
return this.s;
}
public final void I() {
View view = getView();
ViewParent parent = view != null ? view.getParent() : null;
if (parent instanceof p) {
((p) parent).F();
}
}
public void J() {
Toolbar toolbar;
AppBarLayout appBarLayout = this.l;
if (appBarLayout != null && (toolbar = this.o) != null && toolbar.getParent() == appBarLayout) {
appBarLayout.removeView(toolbar);
}
this.o = null;
}
public final void K(Function1<? super c, Unit> function1) {
this.t = function1;
}
public void L(@NotNull Toolbar toolbar) {
Intrinsics.checkNotNullParameter(toolbar, "toolbar");
AppBarLayout appBarLayout = this.l;
if (appBarLayout != null) {
appBarLayout.addView(toolbar);
}
AppBarLayout.c cVar = new AppBarLayout.c(-1, -2);
cVar.g(0);
toolbar.setLayoutParams(cVar);
this.o = toolbar;
}
public void M(boolean z) {
if (this.p != z) {
AppBarLayout appBarLayout = this.l;
if (appBarLayout != null) {
appBarLayout.setTargetElevation(z ? 0.0f : PixelUtil.toPixelFromDIP(4.0f));
}
this.p = z;
}
}
public void N(boolean z) {
if (this.q != z) {
CoordinatorLayout.e layoutParams = e().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.q = z;
}
}
public final boolean O() {
s headerConfig = e().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;
}
public final void P(Menu menu) {
menu.clear();
if (O()) {
Context context = getContext();
if (this.s == null && context != null) {
c cVar = new c(context, this);
this.s = cVar;
Function1<? super c, Unit> function1 = this.t;
if (function1 != null) {
function1.invoke(cVar);
}
}
MenuItem add = menu.add("");
add.setShowAsAction(2);
add.setActionView((View) this.s);
}
}
public void dismiss() {
k container = e().getContainer();
if (!(container instanceof p)) {
throw new IllegalStateException("ScreenStackFragment added into a non-stack container".toString());
}
((p) container).A(this);
}
@Override
public void j() {
super.j();
s headerConfig = e().getHeaderConfig();
if (headerConfig != null) {
headerConfig.g();
}
}
public void onCreateOptionsMenu(@NotNull Menu menu, @NotNull MenuInflater inflater) {
Intrinsics.checkNotNullParameter(menu, "menu");
Intrinsics.checkNotNullParameter(inflater, "inflater");
P(menu);
super.onCreateOptionsMenu(menu, inflater);
}
@Override
public View onCreateView(@NotNull LayoutInflater inflater, ViewGroup viewGroup, Bundle bundle) {
AppBarLayout appBarLayout;
AppBarLayout appBarLayout2;
Intrinsics.checkNotNullParameter(inflater, "inflater");
Context context = getContext();
View view = null;
CoordinatorLayout bVar = context != null ? new b(context, this) : null;
i e = e();
CoordinatorLayout.e eVar = new CoordinatorLayout.e(-1, -1);
eVar.o(this.q ? null : new AppBarLayout.ScrollingViewBehavior());
e.setLayoutParams(eVar);
if (bVar != null) {
bVar.addView(ScreenFragment.C(e()));
}
Context context2 = getContext();
if (context2 != null) {
view = new AppBarLayout(context2);
view.setBackgroundColor(0);
view.setLayoutParams(new AppBarLayout.c(-1, -2));
}
this.l = view;
if (bVar != null) {
bVar.addView(view);
}
if (this.p && (appBarLayout2 = this.l) != null) {
appBarLayout2.setTargetElevation(0.0f);
}
Toolbar toolbar = this.o;
if (toolbar != null && (appBarLayout = this.l) != null) {
appBarLayout.addView(ScreenFragment.C(toolbar));
}
setHasOptionsMenu(true);
return bVar;
}
public void onPrepareOptionsMenu(@NotNull Menu menu) {
Intrinsics.checkNotNullParameter(menu, "menu");
P(menu);
super.onPrepareOptionsMenu(menu);
}
public void onStart() {
View view = this.r;
if (view != null) {
view.requestFocus();
}
super.onStart();
}
public void onStop() {
if (com.swmansion.rnscreens.utils.a.a.a(getContext())) {
this.r = G();
}
super.onStop();
}
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.");
}
}