导航菜单

页面标题

页面副标题

BAM Crawford v6.14.1 - FragmentHostActivity.java 源代码

正在查看: BAM Crawford v6.14.1 应用的 FragmentHostActivity.java JAVA 源代码文件

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


package com.subsplash.thechurchapp;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.view.KeyEvent;
import android.view.View;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.l;
import androidx.fragment.app.t;
import com.subsplash.thechurchapp.dataObjects.BackNavigation;
import com.subsplash.thechurchapp.dataObjects.Constants;
import com.subsplash.thechurchapp.handlers.common.HandlerFragment;
import com.subsplash.thechurchapp.handlers.common.NavigationHandler;
import com.subsplash.thechurchapp.handlers.common.ReactNativeHandlerFragment;
import com.subsplash.thechurchapp.handlers.common.a;
import com.subsplash.util.r;
import com.subsplash.util.r0;
import com.subsplash.widgets.FadingTextView;
import pi.n;
import pi.o;

public class FragmentHostActivity extends BaseActivity {
    protected NavigationHandler T = null;

    class a implements Runnable {
        final boolean p;

        a(boolean z) {
            this.p = z;
        }

        @Override
        public void run() {
            if (this.p) {
                FragmentHostActivity.this.getWindow().addFlags(128);
            } else {
                FragmentHostActivity.this.getWindow().clearFlags(128);
            }
        }
    }

    class b implements View.OnClickListener {
        final FragmentHostActivity p;
        final FadingTextView q;

        b(FragmentHostActivity fragmentHostActivity, FadingTextView fadingTextView) {
            this.p = fragmentHostActivity;
            this.q = fadingTextView;
        }

        @Override
        public void onClick(View view) {
            NavigationHandler navigationHandler = this.p.T;
            if (navigationHandler != null) {
                navigationHandler.onActionItemClicked(this.q.getId());
            }
        }
    }

    private boolean u0() {
        String stringExtra = getIntent().getStringExtra("sapTimestamp");
        return stringExtra != null && System.currentTimeMillis() - new Long(stringExtra).longValue() > 3000;
    }

    private void v0(NavigationHandler navigationHandler) {
        HandlerFragment handlerFragment;
        if (navigationHandler != null) {
            handlerFragment = navigationHandler.getFragment();
            navigationHandler.loadData();
            h0(navigationHandler.supportsActionItem(Constants.INSTANCE.getACTIONBAR_TITLE_ID()));
        } else {
            handlerFragment = null;
        }
        q0(handlerFragment);
        g0();
    }

    @Override
    protected View.OnClickListener X(FadingTextView fadingTextView) {
        if (fadingTextView == null) {
            return null;
        }
        return new b(this, fadingTextView);
    }

    @Override
    public r0.a a0() {
        HandlerFragment handlerFragment = (HandlerFragment) A().j0("FragmentContent");
        return handlerFragment != null ? handlerFragment.getThemeBuilderForBottomBar() : super.a0();
    }

    @Override
    public r0.a b0() {
        HandlerFragment handlerFragment = (HandlerFragment) A().j0("FragmentContent");
        return handlerFragment != null ? handlerFragment.getThemeBuilderForTopBar() : super.b0();
    }

    @Override
    public NavigationHandler c0() {
        return s0();
    }

    public boolean dispatchKeyEvent(KeyEvent keyEvent) {
        HandlerFragment handlerFragment = (HandlerFragment) A().j0("FragmentContent");
        return (handlerFragment instanceof ReactNativeHandlerFragment ? ((ReactNativeHandlerFragment) handlerFragment).dispatchKeyEvent(keyEvent) : false) || super.dispatchKeyEvent(keyEvent);
    }

    public void finish() {
        NavigationHandler navigationHandler;
        BackNavigation backNavigation;
        super/*android.app.Activity*/.finish();
        boolean z = false;
        if (getIntent() != null && getIntent().getBooleanExtra(NavigationHandler.KEY_INTENT_SUPPRESS_CUSTOM_BACK_NAVIGATION, false)) {
            z = true;
        }
        if (z || (navigationHandler = this.T) == null || (backNavigation = navigationHandler.backNavigation) == null) {
            return;
        }
        NavigationHandler lastNavigationHandler = backNavigation.getLastNavigationHandler();
        if (this.T != null) {
            NavigationHandler.navigate("home", (String) null, (Context) this);
            lastNavigationHandler.navigate(this);
        }
    }

    @Override
    public void onActivityResult(int i, int i2, Intent intent) {
        super.onActivityResult(i, i2, intent);
        HandlerFragment handlerFragment = (HandlerFragment) A().j0("FragmentContent");
        if (handlerFragment != null) {
            handlerFragment.onActivityResult(i, i2, intent);
        }
    }

    @Override
    public void onCreate(Bundle bundle) {
        if (t0(bundle)) {
            super.onCreate(bundle);
            getWindow().setFormat(1);
            setContentView(r0());
            k0();
            v0(this.T);
        }
    }

    @Override
    public void onDestroy() {
        NavigationHandler navigationHandler;
        super.onDestroy();
        if (isChangingConfigurations() || (navigationHandler = this.T) == null) {
            return;
        }
        navigationHandler.destroy();
    }

    public boolean onKeyDown(int i, KeyEvent keyEvent) {
        if (i != 4) {
            return super.onKeyDown(i, keyEvent);
        }
        HandlerFragment handlerFragment = (HandlerFragment) A().j0("FragmentContent");
        if (handlerFragment == null || handlerFragment.onBackKeyPressed()) {
            return true;
        }
        finish();
        return true;
    }

    protected void onNewIntent(Intent intent) {
        super/*androidx.fragment.app.d*/.onNewIntent(intent);
        NavigationHandler navigationHandler = (NavigationHandler) intent.getParcelableExtra(NavigationHandler.KEY_HANDLER_PARCEL);
        if (navigationHandler != null) {
            this.T = navigationHandler;
            v0(navigationHandler);
        }
    }

    @Override
    public void onRequestPermissionsResult(int i, String[] strArr, int[] iArr) {
        super.onRequestPermissionsResult(i, strArr, iArr);
        HandlerFragment handlerFragment = (HandlerFragment) A().j0("FragmentContent");
        if (handlerFragment != null) {
            handlerFragment.handleRequestPermissionsResult(i, strArr, iArr);
        }
    }

    @Override
    public void onResume() {
        super.onResume();
        if (r.m()) {
            return;
        }
        NavigationHandler navigationHandler = this.T;
        HandlerFragment fragment = navigationHandler != null ? navigationHandler.getFragment() : null;
        if (r.a()) {
            if (fragment != null) {
                setRequestedOrientation(fragment.getSupportedOrientations());
            }
        } else if (fragment == null || fragment.getSupportedOrientations() != 2) {
            setRequestedOrientation(7);
        }
    }

    protected void onSaveInstanceState(Bundle bundle) {
        NavigationHandler navigationHandler = this.T;
        if (navigationHandler != null) {
            navigationHandler.dataState = a.e.NOT_LOADED;
            bundle.putParcelable(NavigationHandler.KEY_HANDLER_PARCEL, navigationHandler);
        }
        super/*androidx.activity.ComponentActivity*/.onSaveInstanceState(bundle);
    }

    protected void q0(HandlerFragment handlerFragment) {
        if (handlerFragment != null) {
            l A = A();
            t m = A.m();
            Fragment j0 = A.j0("FragmentContent");
            if (handlerFragment.equals(j0)) {
                m.g(j0);
            } else if (j0 != null) {
                m.q(n.fragment_container, handlerFragment, "FragmentContent");
            } else {
                m.c(n.fragment_container, handlerFragment, "FragmentContent");
            }
            m.h();
            n0(!(handlerFragment.suppressesMainToolbarElevation() || ((handlerFragment.getParentFragment() instanceof HandlerFragment) && ((HandlerFragment) handlerFragment.getParentFragment()).suppressesMainToolbarElevation())));
        }
    }

    protected int r0() {
        return o.fragment_host_activity;
    }

    public NavigationHandler s0() {
        return this.T;
    }

    protected boolean t0(Bundle bundle) {
        Intent intent = getIntent();
        NavigationHandler navigationHandler = (NavigationHandler) r();
        this.T = navigationHandler;
        if (navigationHandler == null && u0()) {
            TheChurchApp.C(this);
            return false;
        }
        if (this.T == null && bundle != null) {
            this.T = (NavigationHandler) bundle.getParcelable(NavigationHandler.KEY_HANDLER_PARCEL);
        }
        if (this.T != null) {
            return true;
        }
        this.T = (NavigationHandler) intent.getParcelableExtra(NavigationHandler.KEY_HANDLER_PARCEL);
        return true;
    }

    public Object w() {
        return this.T;
    }

    public void w0(boolean z) {
        new Handler(Looper.getMainLooper()).post(new a(z));
    }
}