导航菜单

页面标题

页面副标题

Bedrock Radio v1.1.1 - ChromeTabsManagerActivity.java 源代码

正在查看: Bedrock Radio v1.1.1 应用的 ChromeTabsManagerActivity.java JAVA 源代码文件

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


package com.proyecto26.inappbrowser;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import org.greenrobot.eventbus.EventBus;

public class ChromeTabsManagerActivity extends Activity {
    static final String BROWSER_RESULT_TYPE = "browserResultType";
    static final String DEFAULT_RESULT_TYPE = "dismiss";
    static final String KEY_BROWSER_INTENT = "browserIntent";
    private boolean mOpened = false;
    private String resultType = null;
    private boolean isError = false;

    public static Intent createStartIntent(Context context, Intent intent) {
        Intent createBaseIntent = createBaseIntent(context);
        createBaseIntent.putExtra(KEY_BROWSER_INTENT, intent);
        return createBaseIntent;
    }

    public static Intent createDismissIntent(Context context) {
        Intent createBaseIntent = createBaseIntent(context);
        createBaseIntent.addFlags(67108864);
        return createBaseIntent;
    }

    private static Intent createBaseIntent(Context context) {
        return new Intent(context, (Class<?>) ChromeTabsManagerActivity.class);
    }

    @Override
    protected void onCreate(Bundle bundle) {
        try {
            super.onCreate(bundle);
            if (getIntent().hasExtra(KEY_BROWSER_INTENT) && (bundle == null || bundle.getString(BROWSER_RESULT_TYPE) == null)) {
                Intent intent = (Intent) getIntent().getParcelableExtra(KEY_BROWSER_INTENT);
                intent.addFlags(67108864);
                startActivity(intent);
                this.resultType = DEFAULT_RESULT_TYPE;
                return;
            }
            finish();
        } catch (Exception e) {
            this.isError = true;
            EventBus.getDefault().post(new ChromeTabsDismissedEvent("Unable to open url.", this.resultType, Boolean.valueOf(this.isError)));
            finish();
            e.printStackTrace();
        }
    }

    @Override
    protected void onResume() {
        super.onResume();
        if (!this.mOpened) {
            this.mOpened = true;
        } else {
            this.resultType = "cancel";
            finish();
        }
    }

    @Override
    protected void onDestroy() {
        String str = this.resultType;
        if (str != null) {
            str.hashCode();
            if (str.equals("cancel")) {
                EventBus.getDefault().post(new ChromeTabsDismissedEvent("chrome tabs activity closed", this.resultType, Boolean.valueOf(this.isError)));
            } else {
                EventBus.getDefault().post(new ChromeTabsDismissedEvent("chrome tabs activity destroyed", DEFAULT_RESULT_TYPE, Boolean.valueOf(this.isError)));
            }
            this.resultType = null;
        }
        super.onDestroy();
    }

    @Override
    protected void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        setIntent(intent);
    }

    @Override
    protected void onRestoreInstanceState(Bundle bundle) {
        super.onRestoreInstanceState(bundle);
        this.resultType = bundle.getString(BROWSER_RESULT_TYPE);
    }

    @Override
    protected void onSaveInstanceState(Bundle bundle) {
        bundle.putString(BROWSER_RESULT_TYPE, DEFAULT_RESULT_TYPE);
        super.onSaveInstanceState(bundle);
    }
}