正在查看: BAM Crawford v6.14.1 应用的 ScreenStackFragment.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: BAM Crawford v6.14.1 应用的 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.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.material.appbar.AppBarLayout;
import com.swmansion.rnscreens.u;
import okhttp3.HttpUrl;
public final class ScreenStackFragment extends ScreenFragment implements r {
private AppBarLayout mAppBarLayout;
private boolean mIsTranslucent;
private View mLastFocusedChild;
private boolean mShadowHidden;
private Toolbar mToolbar;
private fk.l onSearchViewCreate;
private c searchView;
private static final class a extends Animation {
private final ScreenFragment p;
public a(ScreenFragment mFragment) {
kotlin.jvm.internal.k.e(mFragment, "mFragment");
this.p = mFragment;
}
@Override
protected void applyTransformation(float f, Transformation t) {
kotlin.jvm.internal.k.e(t, "t");
super.applyTransformation(f, t);
this.p.dispatchTransitionProgressEvent(f, !r3.isResumed());
}
}
private static final class b extends CoordinatorLayout {
private final ScreenFragment N;
private final Animation.AnimationListener O;
public static final class a implements Animation.AnimationListener {
a() {
}
@Override
public void onAnimationEnd(Animation animation) {
kotlin.jvm.internal.k.e(animation, "animation");
b.this.N.onViewAnimationEnd();
}
@Override
public void onAnimationRepeat(Animation animation) {
kotlin.jvm.internal.k.e(animation, "animation");
}
@Override
public void onAnimationStart(Animation animation) {
kotlin.jvm.internal.k.e(animation, "animation");
b.this.N.onViewAnimationStart();
}
}
public b(Context context, ScreenFragment mFragment) {
super(context);
kotlin.jvm.internal.k.e(context, "context");
kotlin.jvm.internal.k.e(mFragment, "mFragment");
this.N = mFragment;
this.O = new a();
}
public void clearFocus() {
if (getVisibility() != 4) {
super/*android.view.View*/.clearFocus();
}
}
public void startAnimation(Animation animation) {
kotlin.jvm.internal.k.e(animation, "animation");
a aVar = new a(this.N);
aVar.setDuration(animation.getDuration());
if ((animation instanceof AnimationSet) && !this.N.isRemoving()) {
AnimationSet animationSet = (AnimationSet) animation;
animationSet.addAnimation(aVar);
animationSet.setAnimationListener(this.O);
super/*android.view.View*/.startAnimation(animationSet);
return;
}
AnimationSet animationSet2 = new AnimationSet(true);
animationSet2.addAnimation(animation);
animationSet2.addAnimation(aVar);
animationSet2.setAnimationListener(this.O);
super/*android.view.View*/.startAnimation(animationSet2);
}
}
@SuppressLint({"ValidFragment"})
public ScreenStackFragment(j screenView) {
super(screenView);
kotlin.jvm.internal.k.e(screenView, "screenView");
}
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 void notifyViewAppearTransitionEnd() {
View view = getView();
ViewParent parent = view != null ? view.getParent() : null;
if (parent instanceof q) {
((q) parent).F();
}
}
private final boolean shouldShowSearchBar() {
t headerConfig = getScreen().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() == u.a.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) {
c cVar = new c(context, this);
this.searchView = cVar;
fk.l lVar = this.onSearchViewCreate;
if (lVar != null) {
lVar.invoke(cVar);
}
}
MenuItem add = menu.add(HttpUrl.FRAGMENT_ENCODE_SET);
add.setShowAsAction(2);
add.setActionView((View) this.searchView);
}
}
public boolean canNavigateBack() {
l container = getScreen().getContainer();
if (!(container instanceof q)) {
throw new IllegalStateException("ScreenStackFragment added into a non-stack container".toString());
}
if (!kotlin.jvm.internal.k.a(((q) container).getRootScreen(), getScreen())) {
return true;
}
Fragment parentFragment = getParentFragment();
if (parentFragment instanceof ScreenStackFragment) {
return ((ScreenStackFragment) parentFragment).canNavigateBack();
}
return false;
}
public void dismiss() {
l container = getScreen().getContainer();
if (!(container instanceof q)) {
throw new IllegalStateException("ScreenStackFragment added into a non-stack container".toString());
}
((q) container).A(this);
}
@Override
public n0.a getDefaultViewModelCreationExtras() {
return super/*androidx.lifecycle.e*/.getDefaultViewModelCreationExtras();
}
public final fk.l getOnSearchViewCreate() {
return this.onSearchViewCreate;
}
public final c getSearchView() {
return this.searchView;
}
@Override
public void onContainerUpdate() {
super.onContainerUpdate();
t headerConfig = getScreen().getHeaderConfig();
if (headerConfig != null) {
headerConfig.g();
}
}
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
kotlin.jvm.internal.k.e(menu, "menu");
kotlin.jvm.internal.k.e(inflater, "inflater");
updateToolbarMenu(menu);
super.onCreateOptionsMenu(menu, inflater);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup viewGroup, Bundle bundle) {
AppBarLayout appBarLayout;
AppBarLayout appBarLayout2;
kotlin.jvm.internal.k.e(inflater, "inflater");
Context context = getContext();
AppBarLayout appBarLayout3 = null;
CoordinatorLayout bVar = context != null ? new b(context, this) : null;
j screen = getScreen();
CoordinatorLayout.f fVar = new CoordinatorLayout.f(-1, -1);
fVar.o(this.mIsTranslucent ? null : new AppBarLayout.ScrollingViewBehavior());
screen.setLayoutParams(fVar);
if (bVar != null) {
bVar.addView(ScreenFragment.recycleView(getScreen()));
}
Context context2 = getContext();
if (context2 != null) {
appBarLayout3 = new AppBarLayout(context2);
appBarLayout3.setBackgroundColor(0);
appBarLayout3.setLayoutParams(new AppBarLayout.e(-1, -2));
}
this.mAppBarLayout = appBarLayout3;
if (bVar != null) {
bVar.addView(appBarLayout3);
}
if (this.mShadowHidden && (appBarLayout2 = this.mAppBarLayout) != null) {
appBarLayout2.setTargetElevation(BitmapDescriptorFactory.HUE_RED);
}
Toolbar toolbar = this.mToolbar;
if (toolbar != null && (appBarLayout = this.mAppBarLayout) != null) {
appBarLayout.addView(ScreenFragment.recycleView(toolbar));
}
setHasOptionsMenu(true);
return bVar;
}
public void onPrepareOptionsMenu(Menu menu) {
kotlin.jvm.internal.k.e(menu, "menu");
updateToolbarMenu(menu);
super.onPrepareOptionsMenu(menu);
}
public void onStart() {
View view = this.mLastFocusedChild;
if (view != null) {
view.requestFocus();
}
super.onStart();
}
public void onStop() {
if (fj.a.a.a(getContext())) {
this.mLastFocusedChild = findLastFocusedChild();
}
super.onStop();
}
@Override
public void onViewAnimationEnd() {
super.onViewAnimationEnd();
notifyViewAppearTransitionEnd();
}
public void removeToolbar() {
Toolbar toolbar;
AppBarLayout appBarLayout = this.mAppBarLayout;
if (appBarLayout != null && (toolbar = this.mToolbar) != null && toolbar.getParent() == appBarLayout) {
appBarLayout.removeView(toolbar);
}
this.mToolbar = null;
}
public final void setOnSearchViewCreate(fk.l lVar) {
this.onSearchViewCreate = lVar;
}
public final void setSearchView(c cVar) {
this.searchView = cVar;
}
public void setToolbar(Toolbar toolbar) {
kotlin.jvm.internal.k.e(toolbar, "toolbar");
AppBarLayout appBarLayout = this.mAppBarLayout;
if (appBarLayout != null) {
appBarLayout.addView(toolbar);
}
AppBarLayout.e eVar = new AppBarLayout.e(-1, -2);
eVar.g(0);
toolbar.setLayoutParams(eVar);
this.mToolbar = toolbar;
}
public void setToolbarShadowHidden(boolean z) {
if (this.mShadowHidden != z) {
AppBarLayout appBarLayout = this.mAppBarLayout;
if (appBarLayout != null) {
appBarLayout.setTargetElevation(z ? BitmapDescriptorFactory.HUE_RED : com.facebook.react.uimanager.y.d(4.0f));
}
this.mShadowHidden = z;
}
}
public void setToolbarTranslucent(boolean z) {
if (this.mIsTranslucent != z) {
CoordinatorLayout.f layoutParams = getScreen().getLayoutParams();
kotlin.jvm.internal.k.c(layoutParams, "null cannot be cast to non-null type androidx.coordinatorlayout.widget.CoordinatorLayout.LayoutParams");
layoutParams.o(z ? null : new AppBarLayout.ScrollingViewBehavior());
this.mIsTranslucent = z;
}
}
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.");
}
}