导航菜单

页面标题

页面副标题

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

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

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


package com.beint.project.services.impl;

import android.app.Activity;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.util.TimingLogger;
import androidx.fragment.app.Fragment;
import com.beint.project.Engine;
import com.beint.project.MainActivity;
import com.beint.project.MainApplication;
import com.beint.project.ZangiEngine;
import com.beint.project.core.services.impl.BaseService;
import com.beint.project.core.services.impl.ZangiConfigurationService;
import com.beint.project.core.signal.AVSession;
import com.beint.project.core.utils.AppUserManager;
import com.beint.project.core.utils.Constants;
import com.beint.project.core.utils.Log;
import com.beint.project.core.utils.ZangiPermissionUtils;
import com.beint.project.managers.LoginManager;
import com.beint.project.screens.BaseFragmentActivity;
import com.beint.project.screens.CallingFragmentActivity;
import com.beint.project.screens.ConversationManager;
import com.beint.project.screens.EmptyActivity;
import com.beint.project.screens.HomeActivity;
import com.beint.project.screens.UpdateAppActivity;
import com.beint.project.screens.register.LoginActivity;
import com.beint.project.screens.register.RegistrationActivity;
import com.beint.project.screens.settings.passCode.UnLockAppActivity;
import com.beint.project.screens.sms.ConversationView;
import com.beint.project.screens.sms.ForwardMessageActivity;
import com.beint.project.screens.sms.ForwardMessageAndBalanceTransferFragment;
import com.beint.project.screens.sms.gallery.ZangiFileGalleryActivity;
import com.beint.project.screens.sms.gallery.ZangiImageEditActivity;
import com.beint.project.screens.sms.gallery.enums.DestinationType;
import com.beint.project.services.IScreenService;
import com.beint.project.services.PassCodeController;
import com.beint.project.utils.ProtectedAppHandlerKt;
import java.util.ArrayList;
import java.util.Timer;
import java.util.TimerTask;

public class ScreenService extends BaseService implements IScreenService {
    private static final String TAG = "com.beint.project.services.impl.ScreenService";
    private int mLastScreensIndex = -1;
    private String[] mLastScreens = {null, null, null, null};
    Bundle arguments = new Bundle();
    boolean actionHandled = false;

    private Intent checkPermissionAndInitGalleryIntent(Activity activity, DestinationType destinationType, Bundle bundle) {
        if (!ZangiPermissionUtils.hasPermission(activity, 1007, true, (ZangiPermissionUtils.OnPermissionResult) null) || activity == null) {
            return null;
        }
        Intent intent = new Intent(activity, (Class<?>) ZangiFileGalleryActivity.class);
        intent.putExtra(ZangiFileGalleryActivity.Companion.getDESTINATION_ENUM_KEY(), destinationType);
        intent.addFlags(536870912);
        if (bundle != null) {
            intent.putExtras(bundle);
        }
        return intent;
    }

    public void lambda$openZangiFileGalleryActivity$0(Activity activity, DestinationType destinationType, Bundle bundle, ArrayList arrayList, boolean z) {
        if (z) {
            activity.startActivity(checkPermissionAndInitGalleryIntent(activity, destinationType, bundle));
        }
    }

    public static void lambda$openZangiImageEditActivity$1(Activity activity, Bundle bundle, ArrayList arrayList, boolean z) {
        if (z) {
            Intent intent = new Intent(activity, (Class<?>) ZangiImageEditActivity.class);
            intent.addFlags(536870912);
            if (bundle != null) {
                intent.putExtras(bundle);
            }
            activity.startActivity(intent);
        }
    }

    public static void lambda$openZangiImageEditActivityForResult$2(Activity activity, Bundle bundle, int i, ArrayList arrayList, boolean z) {
        if (z) {
            Intent intent = new Intent(activity, (Class<?>) ZangiImageEditActivity.class);
            intent.addFlags(536870912);
            if (bundle != null) {
                intent.putExtras(bundle);
            }
            activity.startActivityForResult(intent, i);
        }
    }

    public static void lambda$openZangiImageGalleryActivityForResult$3(Activity activity, Bundle bundle, Fragment fragment, int i, ArrayList arrayList, boolean z) {
        if (z) {
            Intent intent = new Intent(activity, (Class<?>) ZangiImageEditActivity.class);
            intent.addFlags(536870912);
            if (bundle != null) {
                intent.putExtras(bundle);
            }
            if (fragment == null) {
                activity.startActivityForResult(intent, i);
            } else {
                fragment.startActivityForResult(intent, i);
            }
        }
    }

    @Override
    public boolean bringToFront(int i, String[]... strArr) {
        Intent intent = new Intent(MainApplication.Companion.getMainContext(), (Class<?>) MainActivity.class);
        try {
            intent.addFlags(268435456);
            intent.putExtra("action", i);
            for (String[] strArr2 : strArr) {
                if (strArr2.length == 2) {
                    intent.putExtra(strArr2[0], strArr2[1]);
                }
            }
            MainApplication.Companion.getMainContext().startActivity(intent);
            return true;
        } catch (Exception e) {
            Log.e(TAG, e.getMessage(), e);
            return false;
        }
    }

    @Override
    public void checkEmailIsSuccessAndShowHomeScreen() {
        AppUserManager appUserManager = AppUserManager.INSTANCE;
        if (appUserManager.isHaveEmail() && !appUserManager.isProfileSuccess()) {
            startRegistrationScreen(RegistrationActivity.StackEnum.ADD_PROFILE_SCREEN);
            return;
        }
        if (!LoginManager.INSTANCE.getAutoLogin()) {
            startRegistrationScreen(RegistrationActivity.StackEnum.ENTER_USER_ID);
            return;
        }
        MainApplication.Companion companion = MainApplication.Companion;
        if (!companion.getNeedToUpdateApp()) {
            showFragment(HomeActivity.class);
            return;
        }
        Intent intent = new Intent(companion.getMainContext(), (Class<?>) UpdateAppActivity.class);
        intent.setFlags(268468224);
        companion.getMainContext().startActivity(intent);
    }

    @Override
    public Bundle getArguments() {
        return this.arguments;
    }

    @Override
    public String getCurrentScreen(int i) {
        if (i > 0) {
            int i7 = this.mLastScreensIndex;
            return i7 >= 1 ? this.mLastScreens[i7 - i] : "";
        }
        int i8 = this.mLastScreensIndex;
        return i8 < 0 ? "" : this.mLastScreens[i8 - i];
    }

    @Override
    public boolean isActionHandled() {
        return this.actionHandled;
    }

    @Override
    public void openZangiFileGalleryActivity(final Activity activity, final DestinationType destinationType, final Bundle bundle) {
        Engine.getInstance();
        if (ZangiPermissionUtils.hasPermission(ZangiEngine.getCurrentActivity(), 1007, true, new ZangiPermissionUtils.OnPermissionResult() {
            public final void onResult(ArrayList arrayList, boolean z) {
                ScreenService.this.lambda$openZangiFileGalleryActivity$0(activity, destinationType, bundle, arrayList, z);
            }
        })) {
            activity.startActivity(checkPermissionAndInitGalleryIntent(activity, destinationType, bundle));
        }
    }

    @Override
    public void openZangiFileGalleryActivityForResult(Activity activity, DestinationType destinationType, int i, Bundle bundle) {
        Intent checkPermissionAndInitGalleryIntent = checkPermissionAndInitGalleryIntent(activity, destinationType, bundle);
        if (checkPermissionAndInitGalleryIntent == null) {
            return;
        }
        activity.startActivityForResult(checkPermissionAndInitGalleryIntent, i);
    }

    @Override
    public void openZangiImageEditActivity(final Activity activity, final Bundle bundle) {
        Engine.getInstance();
        if (ZangiPermissionUtils.hasPermission(ZangiEngine.getCurrentActivity(), 1007, true, new ZangiPermissionUtils.OnPermissionResult() {
            public final void onResult(ArrayList arrayList, boolean z) {
                ScreenService.lambda$openZangiImageEditActivity$1(activity, bundle, arrayList, z);
            }
        })) {
            Intent intent = new Intent(activity, (Class<?>) ZangiImageEditActivity.class);
            intent.addFlags(536870912);
            if (bundle != null) {
                intent.putExtras(bundle);
            }
            activity.startActivity(intent);
        }
    }

    @Override
    public void openZangiImageEditActivityForResult(final Activity activity, final int i, final Bundle bundle) {
        Engine.getInstance();
        if (ZangiPermissionUtils.hasPermission(ZangiEngine.getCurrentActivity(), 1007, true, new ZangiPermissionUtils.OnPermissionResult() {
            public final void onResult(ArrayList arrayList, boolean z) {
                ScreenService.lambda$openZangiImageEditActivityForResult$2(activity, bundle, i, arrayList, z);
            }
        })) {
            Intent intent = new Intent(activity, (Class<?>) ZangiImageEditActivity.class);
            intent.addFlags(536870912);
            if (bundle != null) {
                intent.putExtras(bundle);
            }
            activity.startActivityForResult(intent, i);
        }
    }

    @Override
    public void openZangiImageGalleryActivityForResult(final Activity activity, final Fragment fragment, final int i, final Bundle bundle) {
        Engine.getInstance();
        if (ZangiPermissionUtils.hasPermission(ZangiEngine.getCurrentActivity(), 1007, true, new ZangiPermissionUtils.OnPermissionResult() {
            public final void onResult(ArrayList arrayList, boolean z) {
                ScreenService.lambda$openZangiImageGalleryActivityForResult$3(activity, bundle, fragment, i, arrayList, z);
            }
        })) {
            Intent intent = new Intent(activity, (Class<?>) ZangiImageEditActivity.class);
            intent.addFlags(536870912);
            if (bundle != null) {
                intent.putExtras(bundle);
            }
            if (fragment == null) {
                activity.startActivityForResult(intent, i);
            } else {
                fragment.startActivityForResult(intent, i);
            }
        }
    }

    @Override
    public void removeLastScreen() {
        int i = this.mLastScreensIndex;
        if (i < 0) {
            return;
        }
        this.mLastScreens[i] = null;
        this.mLastScreensIndex = i - 1;
    }

    @Override
    public void runOnUiThread(Runnable runnable) {
        Engine.getInstance();
        if (ZangiEngine.getCurrentActivity() == null) {
            Log.e(getClass().getCanonicalName(), "No Main activity");
        } else {
            Engine.getInstance();
            ZangiEngine.getCurrentActivity().runOnUiThread(runnable);
        }
    }

    @Override
    public void setActionHandled(boolean z) {
        this.actionHandled = z;
    }

    @Override
    public void setArguments(Bundle bundle) {
        this.arguments = bundle;
    }

    @Override
    public void setCurrentScreen(String str) {
        if (getCurrentScreen(0).equals(str)) {
            return;
        }
        String[] strArr = this.mLastScreens;
        int i = this.mLastScreensIndex + 1;
        this.mLastScreensIndex = i;
        strArr[i % strArr.length] = str;
        this.mLastScreensIndex = i % strArr.length;
    }

    @Override
    public void setProgressInfoText(String str) {
    }

    @Override
    public boolean showCallScreen() {
        MainApplication.Companion companion = MainApplication.Companion;
        Intent intent = new Intent(companion.getMainContext(), (Class<?>) CallingFragmentActivity.class);
        try {
            intent.addFlags(268435456);
            intent.addFlags(67108864);
            intent.putExtras(new Bundle());
            String str = TAG;
            Log.i(str, "!!!!!showCallScreen ");
            if (CallingFragmentActivity.getInstance() != null && CallingFragmentActivity.getInstance().isBusyScreen()) {
                CallingFragmentActivity.getInstance().finish();
            }
            CallingFragmentActivity.intent = intent;
            if (CallingFragmentActivity.getInstance() != null) {
                companion.getMainContext().startActivity(intent);
                return true;
            }
            if (Build.VERSION.SDK_INT >= 31) {
                Log.i(str, "FLAG_IMMUTABLE 17");
                PendingIntent.getActivity(companion.getMainContext(), 98765, intent, 33554432).send();
            } else {
                PendingIntent.getActivity(companion.getMainContext(), 98765, intent, 0).send();
            }
            if (!ProtectedAppHandlerKt.isMIUI()) {
                return true;
            }
            new Timer().schedule(new TimerTask() {
                @Override
                public void run() {
                    if (CallingFragmentActivity.getInstance() != null || AVSession.Companion.getActiveSession() == null) {
                        return;
                    }
                    Log.i(ScreenService.TAG, "tag");
                    ZangiConfigurationService.INSTANCE.putBoolean("com.beint.project.XIA0MI_PERMISSION_CHECK", false);
                }
            }, CallingFragmentActivity.CALL_RESULT_MESSAGE_WAITING_TIMEOUT);
            return true;
        } catch (Exception e) {
            Log.e(TAG, e.getMessage(), e);
            return false;
        }
    }

    @Override
    public boolean showFragment(Class<?> cls) {
        return showFragment(cls, new Intent(MainApplication.Companion.getMainContext(), (Class<?>) BaseFragmentActivity.class), (Activity) null, Boolean.FALSE);
    }

    @Override
    public boolean showFragmentFromSplash(Class<?> cls, Intent intent, Activity activity) {
        Intent intent2;
        MainApplication.Companion companion = MainApplication.Companion;
        Context mainContext = companion.getMainContext();
        if (cls.equals(HomeActivity.class)) {
            intent2 = new Intent(mainContext, (Class<?>) HomeActivity.class);
        } else {
            if (cls.equals(ConversationView.class)) {
                ConversationManager.INSTANCE.openConversationWithIntent(intent, null, null);
                setCurrentScreen(cls.getCanonicalName());
                return true;
            }
            intent2 = new Intent(mainContext, (Class<?>) BaseFragmentActivity.class);
        }
        if (intent.getExtras() != null) {
            intent2.putExtras(intent.getExtras());
            intent2.addFlags(intent.getFlags());
        }
        intent2.addFlags(268435456);
        intent2.putExtra("com.beint.project.FragmentName", cls);
        Log.i(TAG, "Show fragment!!!!!" + cls.getCanonicalName());
        companion.getMainContext().startActivity(intent2);
        setCurrentScreen(cls.getCanonicalName());
        return true;
    }

    public boolean start() {
        Log.d(TAG, "starting...");
        this.mLastScreensIndex = -1;
        this.mLastScreens = new String[]{null, null, null, null};
        return true;
    }

    @Override
    public void startRegistrationScreen(RegistrationActivity.StackEnum stackEnum) {
        MainApplication.Companion companion = MainApplication.Companion;
        Intent intent = new Intent(companion.getMainContext(), (Class<?>) LoginActivity.class);
        Engine.getInstance();
        Activity mainActivity = ZangiEngine.getMainActivity();
        if (mainActivity != null) {
            mainActivity.startActivityForResult(intent, RegistrationActivity.HTTP_REGISTRATION_ACTIVITY_REQUEST_CODE);
        } else {
            intent.addFlags(268435456);
            companion.getMainContext().startActivity(intent);
        }
    }

    @Override
    public void startRegistrationScreenForToSignInToAnotherAccount() {
        MainApplication.Companion companion = MainApplication.Companion;
        Intent intent = new Intent(companion.getMainContext(), (Class<?>) LoginActivity.class);
        intent.putExtra(RegistrationActivity.IS_SIGN_IN_TO_ANOTHER_ACCOUNT, true);
        Engine.getInstance();
        Activity mainActivity = ZangiEngine.getMainActivity();
        if (mainActivity != null) {
            mainActivity.startActivityForResult(intent, RegistrationActivity.HTTP_REGISTRATION_ACTIVITY_REQUEST_CODE);
        } else {
            intent.addFlags(268435456);
            companion.getMainContext().startActivity(intent);
        }
    }

    public boolean stop() {
        Log.d(TAG, "stopping...");
        return true;
    }

    @Override
    public boolean showFragment(String str) {
        try {
            return showFragment(Class.forName(str), new Intent(MainApplication.Companion.getMainContext(), (Class<?>) BaseFragmentActivity.class), (Activity) null, Boolean.FALSE);
        } catch (ClassNotFoundException e) {
            Log.e(TAG, e.getMessage());
            return false;
        }
    }

    @Override
    public void openZangiFileGalleryActivityForResult(Fragment fragment, DestinationType destinationType, int i, Bundle bundle) {
        Intent checkPermissionAndInitGalleryIntent = checkPermissionAndInitGalleryIntent(fragment.getActivity(), destinationType, bundle);
        if (checkPermissionAndInitGalleryIntent == null) {
            return;
        }
        fragment.startActivityForResult(checkPermissionAndInitGalleryIntent, i);
    }

    @Override
    public boolean showFragment(Class<?> cls, Bundle bundle) {
        Intent intent = new Intent(MainApplication.Companion.getMainContext(), (Class<?>) BaseFragmentActivity.class);
        if (cls.equals(ConversationView.class) && (!PassCodeController.INSTANCE.passCodeIsEnable() || UnLockAppActivity.Companion.getInstance() == null)) {
            intent.addFlags(67108864);
        }
        intent.putExtras(bundle);
        return showFragment(cls, intent, (Activity) null, Boolean.FALSE);
    }

    @Override
    public boolean showFragment(Class<?> cls, String str) {
        Intent intent = new Intent(MainApplication.Companion.getMainContext(), (Class<?>) BaseFragmentActivity.class);
        intent.putExtra("id", str);
        return showFragment(cls, intent, (Activity) null, Boolean.FALSE);
    }

    @Override
    public boolean showFragment(Class<?> cls, Activity activity, Intent intent, int i) {
        if (activity == null) {
            return false;
        }
        activity.startActivityForResult(intent, i);
        return true;
    }

    @Override
    public boolean showFragment(Class<?> cls, Intent intent, Activity activity, Boolean bool) {
        Intent intent2;
        TimingLogger timingLogger = new TimingLogger("AAA", "pf -> showFragment");
        timingLogger.addSplit("A");
        String str = TAG;
        Log.i(str, "!!!!! Showing " + cls);
        Log.i(str, "Current Screen!!!!!" + getCurrentScreen(0));
        MainApplication.Companion companion = MainApplication.Companion;
        Context mainContext = companion.getMainContext();
        if (cls.equals(HomeActivity.class)) {
            intent2 = new Intent(mainContext, (Class<?>) HomeActivity.class);
            intent2.addFlags(536870912);
            intent2.addFlags(67108864);
            if (BaseFragmentActivity.sInstance != null && HomeActivity.getInstance() != null) {
                Log.i(str, "BaseActivity finished!!!!!");
            }
        } else if (cls.equals(ConversationView.class)) {
            timingLogger.addSplit("B");
            intent2 = new Intent(mainContext, (Class<?>) EmptyActivity.class);
            intent2.addFlags(536870912);
            if (CallingFragmentActivity.getInstance() != null) {
                intent2.addFlags(16777216);
                if (HomeActivity.getInstance() == null) {
                    intent2.addFlags(67108864);
                }
            }
        } else {
            intent2 = cls.equals(ForwardMessageAndBalanceTransferFragment.class) ? new Intent(mainContext, (Class<?>) ForwardMessageActivity.class) : new Intent(mainContext, (Class<?>) BaseFragmentActivity.class);
        }
        if (intent.getExtras() != null) {
            intent2.putExtras(intent.getExtras());
            intent2.addFlags(intent.getFlags());
            intent2.putExtra(Constants.ZANGI_ACTION, intent.getExtras().getInt(Constants.ZANGI_ACTION));
        }
        Log.i(str, "Show fragment!!!!!" + cls.getCanonicalName());
        intent2.putExtra("com.beint.project.FragmentName", cls);
        intent2.addFlags(268435456);
        intent.addFlags(65536);
        companion.getMainContext().startActivity(intent2);
        setCurrentScreen(cls.getCanonicalName());
        timingLogger.dumpToLog();
        return true;
    }
}