导航菜单

页面标题

页面副标题

Hyouka private v5.8.9 - MainActivity.java 源代码

正在查看: Hyouka private v5.8.9 应用的 MainActivity.java JAVA 源代码文件

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


package com.beint.project;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.AssetManager;
import android.content.res.Resources;
import android.os.Bundle;
import android.view.KeyEvent;
import android.widget.FrameLayout;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.c;
import androidx.fragment.app.FragmentActivity;
import com.beint.project.MainApplication;
import com.beint.project.core.managers.SystemServiceManager;
import com.beint.project.core.services.impl.ZangiConfigurationService;
import com.beint.project.core.utils.Constants;
import com.beint.project.core.utils.Log;
import com.beint.project.core.utils.NotificationCenter;
import com.beint.project.core.utils.ZangiConfigurationEntry;
import com.beint.project.core.wrapper.ProjectWrapperHolder;
import com.beint.project.enums.ActivityAction;
import com.beint.project.enums.ActivityNavigation;
import com.beint.project.managers.CrashLiticsManager;
import com.beint.project.managers.LoginManager;
import com.beint.project.screens.BaseScreen;
import com.beint.project.screens.CallingFragmentActivity;
import com.beint.project.screens.ConversationManager;
import com.beint.project.screens.HomeActivity;
import com.beint.project.screens.register.RegistrationActivity;
import com.beint.project.screens.settings.more.settings.ChooseLanguageFragment;
import com.beint.project.screens.utils.ImageLoader;
import java.io.Serializable;

public final class MainActivity extends AppCompatActivity {
    private final int RC_SPLASH;
    private final String TAG;
    private FrameLayout fragmentLayout;
    private boolean fromPush;
    private boolean isFinishActivityOnResum;
    private BroadcastReceiver mRingToneStateReceiver;

    public class WhenMappings {
        public static final int[] $EnumSwitchMapping$0;
        public static final int[] $EnumSwitchMapping$1;

        static {
            int[] iArr = new int[ActivityNavigation.values().length];
            try {
                iArr[ActivityNavigation.SHOW_HOME_SCREEN.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            $EnumSwitchMapping$0 = iArr;
            int[] iArr2 = new int[BaseScreen.SCREEN_TYPE.values().length];
            try {
                iArr2[BaseScreen.SCREEN_TYPE.SETUPSPLASH_T.ordinal()] = 1;
            } catch (NoSuchFieldError unused2) {
            }
            $EnumSwitchMapping$1 = iArr2;
        }
    }

    public MainActivity() {
        String canonicalName = MainActivity.class.getCanonicalName();
        this.TAG = canonicalName;
        Log.i(canonicalName, "MainAppActivity Constructor!!!!!");
    }

    private final android.os.Bundle getDeepLinkFromIntent(android.content.Intent r19, android.os.Bundle r20) {
        throw new UnsupportedOperationException("Method not decompiled: com.beint.project.MainActivity.getDeepLinkFromIntent(android.content.Intent, android.os.Bundle):android.os.Bundle");
    }

    private final void handleAction(Bundle bundle) {
        Log.i(this.TAG, "!!!!!Bundle" + bundle);
        int i2 = bundle.getInt("action", ActivityAction.ACTION_NONE.ordinal());
        if (i2 == ActivityAction.ACTION_RESTORE_LAST_STATE.ordinal()) {
            bundle.getString("screen-id");
            String currentScreen = Engine.getInstance().getScreenService().getCurrentScreen(0);
            String str = this.TAG;
            StringBuilder sb = new StringBuilder();
            sb.append("!!!!!ACTION_RESTORE_LAST_STATE");
            kotlin.jvm.internal.k.c(currentScreen);
            sb.append(currentScreen);
            Log.d(str, sb.toString());
            if (CallingFragmentActivity.getInstance() != null) {
                BaseScreen.getScreenService().showCallScreen();
                return;
            } else {
                BaseScreen.getScreenService().showFragment(currentScreen);
                return;
            }
        }
        if (i2 == ActivityAction.ACTION_SHOW_SMS.ordinal()) {
            String string = bundle.getString(Constants.CONV_JID);
            if (string != null) {
                ConversationManager.openConversationWithJid$default(ConversationManager.INSTANCE, string, (String) null, (FragmentActivity) null, ExtensionsKt.isGroup(string), (String) null, (String) null, (Integer) null, false, 128, (Object) null);
            }
            Log.i(this.TAG, "Run from notification!!!!!");
            Engine.getInstance().getScreenService().setActionHandled(true);
            return;
        }
        if (i2 == ActivityAction.ACTION_SHOW_MISSED_CALL.ordinal()) {
            Log.i(this.TAG, "Missed notification!!!!!" + CallingFragmentActivity.getInstance());
            if (CallingFragmentActivity.getInstance() != null) {
                BaseScreen.getScreenService().showCallScreen();
                this.fromPush = true;
                return;
            } else {
                MainApplication.Companion.getMainContext().sendBroadcast(new Intent(Constants.SCREEN_RECENT_BADGE));
                Engine.getInstance().getScreenService().getArguments().putInt(Constants.CURRENT_TAB_POSITION, 1);
                Engine.getInstance().getScreenService().checkEmailIsSuccessAndShowHomeScreen();
                return;
            }
        }
        if (i2 == ActivityAction.ACTION_SHOW_AVSCREEN.ordinal()) {
            Log.d(this.TAG, "Main.ACTION_SHOW_AVSCREEN");
            BaseScreen.getScreenService().showCallScreen();
            Engine.getInstance().getScreenService().setActionHandled(true);
            return;
        }
        if (i2 == ActivityAction.ACTION_SHOW_CONTSHARE_SCREEN.ordinal()) {
            Engine.getInstance().getScreenService().getArguments().putInt(Constants.CURRENT_TAB_POSITION, 2);
            Engine.getInstance().getScreenService().checkEmailIsSuccessAndShowHomeScreen();
            return;
        }
        if (i2 == ActivityAction.ACTION_SHOW_VIRTUAL_NETWORK_SCREEN.ordinal()) {
            Engine.getInstance().getScreenService().getArguments().putInt(Constants.CURRENT_TAB_POSITION, 0);
            Engine.getInstance().getScreenService().getArguments().putString("id", bundle.getString("id"));
            Engine.getInstance().getScreenService().getArguments().putBoolean(Constants.IS_SHOW_VIRTUAL_NETWORK_VIEW, true);
            Engine.getInstance().getScreenService().checkEmailIsSuccessAndShowHomeScreen();
            return;
        }
        if (i2 == ActivityAction.ACTION_SHOW_SERVICES_SCREEN.ordinal()) {
            Engine.getInstance().getScreenService().getArguments().putInt(Constants.CURRENT_TAB_POSITION, 0);
            Engine.getInstance().getScreenService().getArguments().putString("id", bundle.getString("id"));
            Engine.getInstance().getScreenService().getArguments().putBoolean(Constants.IS_SHOW_SERVICES_VIEW, true);
            Engine.getInstance().getScreenService().checkEmailIsSuccessAndShowHomeScreen();
            return;
        }
        if (i2 == ActivityAction.ACTION_SHOW_SIGN_IN_TO_ANOTHER_ACCOUNT.ordinal()) {
            Engine.getInstance().getScreenService().startRegistrationScreenForToSignInToAnotherAccount();
            return;
        }
        Log.i(this.TAG, "MainActivity handleAction default: case");
        Log.i(this.TAG, "Missed notification!!!!!" + CallingFragmentActivity.getInstance());
        if (CallingFragmentActivity.getInstance() != null) {
            BaseScreen.getScreenService().showCallScreen();
            this.fromPush = true;
        } else {
            MainApplication.Companion.getMainContext().sendBroadcast(new Intent(Constants.SCREEN_RECENT_BADGE));
            Engine.getInstance().getScreenService().getArguments().putInt(Constants.CURRENT_TAB_POSITION, 1);
            Engine.getInstance().getScreenService().checkEmailIsSuccessAndShowHomeScreen();
        }
    }

    public static final void onCreate$lambda$0(MainActivity mainActivity) {
        kotlin.jvm.internal.k.f(mainActivity, "this$0");
        ImageLoader.addImageCache(mainActivity.getSupportFragmentManager(), 0.05f);
        MainActivity$onCreate$1$1 mainActivity$onCreate$1$1 = new MainActivity$onCreate$1$1();
        mainActivity.mRingToneStateReceiver = mainActivity$onCreate$1$1;
        mainActivity.registerReceiver(mainActivity$onCreate$1$1, new IntentFilter("android.media.RINGER_MODE_CHANGED"));
        mainActivity.setVolumeControlStream(2);
        CrashLiticsManager.INSTANCE.setInfoToCrashLitics();
        ConversationManager.INSTANCE.loadDefaultBackgroundRunnable();
    }

    private final void showAlertWithMessage(int i2) {
        c.a aVar = new c.a(this, 2131951629);
        aVar.r(2131887550);
        aVar.h(i2);
        aVar.d(false);
        aVar.o(2131887640, new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i3) {
                MainActivity.showAlertWithMessage$lambda$1(MainActivity.this, dialogInterface, i3);
            }
        });
        androidx.appcompat.app.c a2 = aVar.a();
        kotlin.jvm.internal.k.e(a2, "builder.create()");
        a2.setOnKeyListener(new DialogInterface.OnKeyListener() {
            @Override
            public final boolean onKey(DialogInterface dialogInterface, int i3, KeyEvent keyEvent) {
                boolean showAlertWithMessage$lambda$2;
                showAlertWithMessage$lambda$2 = MainActivity.showAlertWithMessage$lambda$2(MainActivity.this, dialogInterface, i3, keyEvent);
                return showAlertWithMessage$lambda$2;
            }
        });
        a2.show();
    }

    public static final void showAlertWithMessage$lambda$1(MainActivity mainActivity, DialogInterface dialogInterface, int i2) {
        kotlin.jvm.internal.k.f(mainActivity, "this$0");
        mainActivity.signOutClickHandler();
    }

    public static final boolean showAlertWithMessage$lambda$2(MainActivity mainActivity, DialogInterface dialogInterface, int i2, KeyEvent keyEvent) {
        kotlin.jvm.internal.k.f(mainActivity, "this$0");
        Log.d(mainActivity.TAG, "DUMMY AlertDialog onKey keyCode = " + i2);
        return true;
    }

    private final void signOutClickHandler() {
        LoginManager.afterLogout$default(LoginManager.INSTANCE, this, false, 2, null);
    }

    @Override
    protected void attachBaseContext(Context context) {
        Context locale;
        ZangiConfigurationService zangiConfigurationService = ZangiConfigurationService.INSTANCE;
        String str = Constants.LANGUAGE_CODE;
        kotlin.jvm.internal.k.e(str, "LANGUAGE_CODE");
        String string = zangiConfigurationService.getString(str, "default");
        if (string == null) {
            string = "";
        }
        String str2 = string;
        if (kotlin.jvm.internal.k.b(str2, "default")) {
            SystemServiceManager systemServiceManager = SystemServiceManager.INSTANCE;
            String language = Resources.getSystem().getConfiguration().locale.getLanguage();
            kotlin.jvm.internal.k.e(language, "getSystem().configuration.locale.language");
            locale = systemServiceManager.setLocale(context, language, Resources.getSystem().getConfiguration().locale);
        } else {
            locale = SystemServiceManager.setLocale$default(SystemServiceManager.INSTANCE, context, str2, null, 4, null);
        }
        super.attachBaseContext(locale);
    }

    @Override
    public void onActivityResult(int i2, int i3, Intent intent) {
        super.onActivityResult(i2, i3, intent);
        Log.d(this.TAG, "onActivityResult(" + i2 + ',' + i3 + ')');
        if (i3 == -1) {
            if (i2 == this.RC_SPLASH) {
                Log.d(this.TAG, "Result from splash screen");
                return;
            }
            if (i2 == 4854) {
                boolean z2 = false;
                if (intent != null && intent.hasExtra("BUNDLE_REGISTRATION_FINISH_RESULT_KEY")) {
                    z2 = true;
                }
                if (z2) {
                    Serializable serializableExtra = intent.getSerializableExtra("BUNDLE_REGISTRATION_FINISH_RESULT_KEY");
                    kotlin.jvm.internal.k.d(serializableExtra, "null cannot be cast to non-null type com.beint.project.enums.ActivityNavigation");
                    ActivityNavigation activityNavigation = (ActivityNavigation) serializableExtra;
                    Log.d(this.TAG, "onActivityResult() ActivityNavigation = " + activityNavigation.name());
                    if (WhenMappings.$EnumSwitchMapping$0[activityNavigation.ordinal()] == 1) {
                        Engine.getInstance().getScreenService().checkEmailIsSuccessAndShowHomeScreen();
                    }
                }
            }
        }
    }

    @Override
    protected void onCreate(Bundle bundle) {
        setTheme(2131952413);
        super.onCreate(bundle);
        Log.i(this.TAG, "MainActivity onCreate!!!!!");
        MainApplication.Companion companion = MainApplication.Companion;
        Context applicationContext = getApplicationContext();
        kotlin.jvm.internal.k.e(applicationContext, "this.applicationContext");
        companion.setMainContext(applicationContext);
        ZangiConfigurationService zangiConfigurationService = ZangiConfigurationService.INSTANCE;
        String str = Constants.IS_LANGUAGE_CHANGE;
        kotlin.jvm.internal.k.e(str, "IS_LANGUAGE_CHANGE");
        if (zangiConfigurationService.getBoolean(str, false)) {
            zangiConfigurationService.putBoolean(Constants.IS_LANGUAGE_CHANGE, false, true);
        }
        String str2 = Constants.IS_LANGUAGE_CHANGE;
        kotlin.jvm.internal.k.e(str2, "IS_LANGUAGE_CHANGE");
        if (zangiConfigurationService.getBoolean(str2, false)) {
            zangiConfigurationService.putBoolean(Constants.IS_LANGUAGE_CHANGE, false, true);
            Engine.getInstance().getScreenService().showFragment(ChooseLanguageFragment.class);
        }
        Intent intent = getIntent();
        Bundle deepLinkFromIntent = getDeepLinkFromIntent(intent, intent.getExtras());
        if (!(HomeActivity.getInstance() == null && ZangiEngine.getMainActivity() == null) && deepLinkFromIntent == null) {
            finish();
            return;
        }
        ZangiEngine.setMainActivity(this);
        if ((deepLinkFromIntent != null ? deepLinkFromIntent.get("action") : null) != null) {
            handleAction(deepLinkFromIntent);
        } else if (Engine.getInstance().isStarted()) {
            Log.v(this.TAG, "!!!!!!!!!!!!ENGINE STARTED");
            Engine.getInstance().getScreenService().checkEmailIsSuccessAndShowHomeScreen();
        } else {
            ProjectWrapperHolder projectWrapperHolder = ProjectWrapperHolder.INSTANCE;
            AssetManager assets = getApplicationContext().getAssets();
            kotlin.jvm.internal.k.e(assets, "applicationContext.assets");
            projectWrapperHolder.createPcmLogs(assets);
            LoginManager loginManager = LoginManager.INSTANCE;
            if (!loginManager.getAutoLogin() || zangiConfigurationService.getBoolean("REGISTRATION_NOT_COMPLETE", false)) {
                String str3 = this.TAG;
                StringBuilder sb = new StringBuilder();
                sb.append("!!!!!!!!!!!!CONTINUE STATE");
                String str4 = ZangiConfigurationEntry.PROPERTY_REG_ID;
                kotlin.jvm.internal.k.e(str4, "PROPERTY_REG_ID");
                sb.append(zangiConfigurationService.getString(str4, "!!!!!NO GCM REG ID"));
                Log.v(str3, sb.toString());
                Engine.getInstance().getScreenService().startRegistrationScreen(RegistrationActivity.StackEnum.ENTER_USER_ID);
                loginManager.setFirstLogin(true);
            } else {
                Log.v(this.TAG, "!!!!!!!!!!!!AUTOLOGIN STATE");
                Engine.getInstance().getScreenService().checkEmailIsSuccessAndShowHomeScreen();
            }
        }
        if (this.isFinishActivityOnResum) {
            finish();
        }
        new Thread(new Runnable() {
            @Override
            public final void run() {
                MainActivity.onCreate$lambda$0(MainActivity.this);
            }
        }).start();
    }

    @Override
    protected void onDestroy() {
        BroadcastReceiver broadcastReceiver = this.mRingToneStateReceiver;
        if (broadcastReceiver != null) {
            unregisterReceiver(broadcastReceiver);
            this.mRingToneStateReceiver = null;
        }
        super.onDestroy();
        Log.i(this.TAG, "!!!!! onDestroy");
        if (this == ZangiEngine.getMainActivity()) {
            ZangiEngine.setMainActivity(null);
        }
        NotificationCenter.INSTANCE.removeObserver(this);
    }

    @Override
    public void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        Log.i(this.TAG, "MAIN NEW INTENT!!!!!" + intent);
        Bundle deepLinkFromIntent = getDeepLinkFromIntent(intent, intent != null ? intent.getExtras() : null);
        if (deepLinkFromIntent != null) {
            Class cls = (Class) (intent != null ? intent.getSerializableExtra(Constants.FRAGMENT_NAME) : null);
            if (cls == null || !kotlin.jvm.internal.k.b(cls, HomeActivity.class)) {
                handleAction(deepLinkFromIntent);
                return;
            } else {
                Engine.getInstance().getScreenService().checkEmailIsSuccessAndShowHomeScreen();
                Log.v(this.TAG, "FROM BUNDLE !!!!!");
                return;
            }
        }
        if (intent == null || intent.getCategories() == null || !intent.getCategories().contains("android.intent.category.LAUNCHER")) {
            Engine.getInstance().getScreenService().checkEmailIsSuccessAndShowHomeScreen();
            Log.v(this.TAG, "FROM BUNDLE 3333333333!!!!!");
            return;
        }
        String currentScreen = BaseScreen.getScreenService().getCurrentScreen(0);
        if (currentScreen != null && !kotlin.jvm.internal.k.b(HomeActivity.class.getCanonicalName(), currentScreen)) {
            BaseScreen.getScreenService().showFragment(currentScreen);
        } else {
            Engine.getInstance().getScreenService().checkEmailIsSuccessAndShowHomeScreen();
            Log.v(this.TAG, "FROM BUNDLE 2222222!!!!!");
        }
    }

    @Override
    protected void onResume() {
        super.onResume();
        ZangiEngine.setCurrentActivity(this);
        if (this.fromPush && CallingFragmentActivity.getInstance() == null) {
            Engine.getInstance().getScreenService().checkEmailIsSuccessAndShowHomeScreen();
            this.fromPush = false;
        }
    }
}