导航菜单

页面标题

页面副标题

Adobe Acrobat v15.3 - ARUserAccountsActivity.java 源代码

正在查看: Adobe Acrobat v15.3 应用的 ARUserAccountsActivity.java JAVA 源代码文件

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


package com.adobe.reader.services;

import android.app.ActionBar;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Resources;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager;
import android.telephony.TelephonyManager;
import android.text.Html;
import android.text.method.LinkMovementMethod;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.ViewFlipper;
import com.adobe.libs.buildingblocks.a.a;
import com.adobe.libs.buildingblocks.a.b;
import com.adobe.libs.services.a.u;
import com.adobe.libs.services.ag;
import com.adobe.libs.services.ah;
import com.adobe.libs.services.auth.SVServicesLoginActivity;
import com.adobe.libs.services.auth.d;
import com.adobe.libs.services.d.ae;
import com.adobe.libs.services.d.k;
import com.adobe.libs.services.f.h;
import com.adobe.libs.services.f.i;
import com.adobe.libs.services.g.e;
import com.adobe.libs.services.h.g;
import com.adobe.libs.services.n;
import com.adobe.reader.R;
import com.adobe.reader.analytics.ARDCMAnalytics;
import com.adobe.reader.misc.ARAlert;
import com.adobe.reader.misc.ARApp;
import com.adobe.reader.mobileLink.ARMobileLinkUIManager;
import com.adobe.reader.services.auth.ARServicesAccount;
import com.adobe.reader.services.cpdf.ARFetchUsersSubscriptionsAsyncTask;
import com.adobe.reader.ui.ARBaseActivity;
import com.adobe.reader.viewer.ARAlertDialog;
import com.android.vending.billing.Purchase;
import java.util.HashMap;

public class ARUserAccountsActivity extends ARBaseActivity {
    static final boolean $assertionsDisabled;
    public static final String USER_SIGNED_OUT_FROM_USER_ACCOUNTS = "com.adobe.reader.services.ARUserAccountsActivity.userSignedOut";
    private static boolean sProgressViewAlreadyShown;
    private ActionBar mActionBar;
    private Menu mActionBarMenu;
    private FrameLayout mMyAccountsMainFrameLayout;
    private View mMyAccountsView;
    private a mProgressDialog;
    private n mWebView;

    class AnonymousClass1 implements View.OnClickListener {
        AnonymousClass1() {
        }

        @Override
        public void onClick(View view) {
            String str;
            int i;
            Purchase purchaseInfo;
            ARDCMAnalytics.getInstance().trackAction(ARDCMAnalytics.RESTORE_PURCHASES_TAPPED, ARDCMAnalytics.MY_ACCOUNT, (String) null);
            if (ARServicesAccount.getInstance().isSignedIn()) {
                g[] values = g.values();
                int length = values.length;
                int i2 = 0;
                int i3 = 0;
                while (i2 < length) {
                    g gVar = values[i2];
                    com.adobe.libs.services.f.a a2 = com.adobe.libs.services.f.a.a();
                    i iVar = new i() {
                        @Override
                        public void failure(int i4) {
                            if (ARUserAccountsActivity.this.mProgressDialog != null) {
                                ARUserAccountsActivity.this.mProgressDialog.dismiss();
                                ARUserAccountsActivity.this.mProgressDialog = null;
                            }
                            Resources resources = ARUserAccountsActivity.this.getResources();
                            ARAlert.displayErrorDlg(ARUserAccountsActivity.this, resources.getString(R.string.IDS_SERVICE_RESTORE_PURCHASES_STR), i4 == -1 ? resources.getString(R.string.IDS_NETWORK_UNAVAILABLE_ERROR) : resources.getString(R.string.IDS_NO_PURCHASES_RESTORE), null);
                            ARDCMAnalytics.getInstance().trackAction(ARDCMAnalytics.RESTORE_PURCHASES_FAILED, ARDCMAnalytics.MY_ACCOUNT, (String) null);
                        }

                        @Override
                        public void success() {
                            new ARFetchUsersSubscriptionsAsyncTask(ARUserAccountsActivity.this, false, new ae() {
                                @Override
                                public void execute(boolean z) {
                                    ARUserAccountsActivity.this.refreshMyAccountsView();
                                }
                            }).taskExecute(new Void[0]);
                            if (ARUserAccountsActivity.this.mProgressDialog != null) {
                                ARUserAccountsActivity.this.mProgressDialog.dismiss();
                                ARUserAccountsActivity.this.mProgressDialog = null;
                            }
                            Resources resources = ARUserAccountsActivity.this.getResources();
                            ARAlert.displayErrorDlg(ARUserAccountsActivity.this, resources.getString(R.string.IDS_SERVICE_RESTORE_PURCHASES_STR), resources.getString(R.string.IDS_PURCHASES_RESTORED_SUCCESSFULLY), null);
                            ARDCMAnalytics.getInstance().trackAction(ARDCMAnalytics.RESTORE_PURCHASES_SUCCESS, ARDCMAnalytics.MY_ACCOUNT, (String) null);
                        }
                    };
                    switch (gVar) {
                        case CREATE_PDF_SUBSCRIPTION:
                            str = "com.adobe.reader.pdfpack.android.1month";
                            break;
                        case PDF_PACK_SUBSCRIPTION:
                            str = "com.adobe.reader.pdfpack.android.1year";
                            break;
                        case EXPORT_PDF_SUBSCRIPTION:
                            str = "com.adobe.reader.exportpdf.android.1yr";
                            break;
                        case ACROBAT_PRO_SUBSCRIPTION:
                            str = "com.adobe.reader.acrobatpronew.android.1month";
                            break;
                        default:
                            str = null;
                            break;
                    }
                    com.adobe.libs.services.f.g gVar2 = com.adobe.libs.services.f.g.CLAIM_NOT_STARTED;
                    if (str != null && (purchaseInfo = a2.c.getPurchaseInfo(str)) != null) {
                        if (com.adobe.libs.services.f.a.a(purchaseInfo)) {
                            new h(a2, purchaseInfo.getPackageName(), purchaseInfo.getOriginalJson(), purchaseInfo.getSignature(), iVar).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new String[0]);
                            gVar2 = com.adobe.libs.services.f.g.CLAIM_STARTED;
                        } else {
                            gVar2 = com.adobe.libs.services.f.g.CLAIM_AGAINST_DIFFERENT_ADOBEID;
                        }
                    }
                    String str2 = "SVInAppBillingUtils::claimAlreadyPurchasedProduct() returned " + gVar2 + " for skuId:" + str;
                    if (gVar2 == com.adobe.libs.services.f.g.CLAIM_STARTED) {
                        i = i3 + 1;
                    } else {
                        if (gVar2 == com.adobe.libs.services.f.g.CLAIM_AGAINST_DIFFERENT_ADOBEID) {
                            ARDCMAnalytics.getInstance().trackAction(ARDCMAnalytics.RESTORE_PURCHASES_FAILED_WITH_DIFFERENT_ADOBEID, ARDCMAnalytics.MY_ACCOUNT, (String) null);
                        }
                        i = i3;
                    }
                    i2++;
                    i3 = i;
                }
                if (i3 == 0) {
                    Resources resources = ARUserAccountsActivity.this.getResources();
                    ARAlert.displayErrorDlg(ARUserAccountsActivity.this, resources.getString(R.string.IDS_SERVICE_RESTORE_PURCHASES_STR), resources.getString(R.string.IDS_NO_PURCHASES_AVAILABLE_FOR_RESTORE), null);
                } else if (ARUserAccountsActivity.this.mProgressDialog == null) {
                    ARUserAccountsActivity.this.mProgressDialog = new a(ARUserAccountsActivity.this, null);
                    ARUserAccountsActivity.this.mProgressDialog.show();
                }
            }
        }
    }

    static {
        $assertionsDisabled = !ARUserAccountsActivity.class.desiredAssertionStatus();
        sProgressViewAlreadyShown = false;
    }

    private String getDetailText(g gVar) {
        Context appContext = ARApp.getAppContext();
        switch (gVar) {
            case ADC_SUBSCRIPTION:
                return ARServicesAccount.getInstance().isSubscriptionAvailableForService(g.CREATE_PDF_SUBSCRIPTION) ? appContext.getString(R.string.IDS_ADC_POST_SCPDF_SUBSCRIPTION_DESCRIPTION) : ARServicesAccount.getInstance().isSubscriptionAvailableForService(g.PDF_PACK_SUBSCRIPTION) ? appContext.getString(R.string.IDS_ADC_POST_CPDF_SUBSCRIPTION_DESCRIPTION) : ARServicesAccount.getInstance().isSubscriptionAvailableForService(g.EXPORT_PDF_SUBSCRIPTION) ? appContext.getString(R.string.IDS_ADC_POST_EPDF_SUBSCRIPTION_DESCRIPTION) : appContext.getString(R.string.IDS_ADC_PRE_SERVICE_SUBSCRIPTION_DESCRIPTION);
            case EXPORT_PDF_SUBSCRIPTION:
                return appContext.getString(R.string.IDS_EPDF_SERVICE_DESCRIPTION);
            case PDF_PACK_SUBSCRIPTION:
                return appContext.getString(R.string.IDS_CPDF_SERVICE_DESCRIPTION);
            case ACROBAT_PRO_SUBSCRIPTION:
                return appContext.getString(R.string.IDS_ACROBAT_PRO_SERVICE_DESCRIPTION);
            case CREATE_PDF_SUBSCRIPTION:
                return appContext.getString(R.string.IDS_SCPDF_SERVICE_DESCRIPTION);
            default:
                if ($assertionsDisabled) {
                    return null;
                }
                throw new AssertionError();
        }
    }

    public String getTopBarTitle() {
        return isMyAccountWebViewVisible() ? this.mWebView.getWebViewTitle() : ((ViewFlipper) this.mMyAccountsMainFrameLayout.findViewById(R.id.myAccountsViewFlipper)).getCurrentView().getId() == 2131493098 ? getString(R.string.IDS_RFE_MARKETING_BANNER_TITLE) : getString(R.string.IDS_MY_ACCOUNT_TITLE);
    }

    private boolean handleBackPressed() {
        boolean z;
        ViewFlipper viewFlipper = (ViewFlipper) this.mMyAccountsMainFrameLayout.findViewById(R.id.myAccountsViewFlipper);
        View currentView = viewFlipper.getCurrentView();
        if (isMyAccountWebViewVisible()) {
            hideMyAccountWebView();
            z = true;
        } else if (currentView.getId() == 2131493098) {
            viewFlipper.showPrevious();
            TextView textView = (TextView) this.mMyAccountsView.findViewById(R.id.myAccountsRFEViewStatus);
            if (ARServicesAccount.getInstance().isMobileLinkOn()) {
                textView.setText(R.string.IDS_MOBILE_LINK_ON_STR);
                z = true;
            } else {
                textView.setText(R.string.IDS_MOBILE_LINK_OFF_STR);
                z = true;
            }
        } else {
            z = false;
        }
        updateActionBar();
        setActionBarTitle(getTopBarTitle());
        return z;
    }

    private void initializeMyAccountEntries() {
        View findViewById;
        int i;
        int i2;
        final String str;
        for (final g gVar : g.values()) {
            switch (gVar) {
                case ADC_SUBSCRIPTION:
                    i2 = 2131230752;
                    i = 2130837891;
                    findViewById = this.mMyAccountsView.findViewById(R.id.myAccountsADC);
                    str = ARDCMAnalytics.DOCUMENT_CLOUD_TAPPED;
                    break;
                case EXPORT_PDF_SUBSCRIPTION:
                    findViewById = this.mMyAccountsView.findViewById(R.id.myAccountsEPDF);
                    i = 2130837893;
                    i2 = 2131230763;
                    str = ARDCMAnalytics.EXPORT_PDF_TAPPED;
                    break;
                case PDF_PACK_SUBSCRIPTION:
                    findViewById = this.mMyAccountsView.findViewById(R.id.myAccountsAcrobatBasic);
                    i = 2130837892;
                    i2 = 2131230764;
                    str = ARDCMAnalytics.PDF_PACK_TAPPED;
                    break;
                case ACROBAT_PRO_SUBSCRIPTION:
                    findViewById = this.mMyAccountsView.findViewById(R.id.myAccountsAcrobatPro);
                    i = 2130837890;
                    i2 = 2131230765;
                    str = ARDCMAnalytics.ACROBAT_PRO_TAPPED;
                    break;
                default:
                    i2 = 2131230752;
                    i = 2130837891;
                    findViewById = null;
                    str = ARDCMAnalytics.DOCUMENT_CLOUD_TAPPED;
                    break;
            }
            if (findViewById != null) {
                ((ImageView) findViewById.findViewById(R.id.serviceIcon)).setImageResource(i);
                ((TextView) findViewById.findViewById(R.id.serviceDetail)).setText(getDetailText(gVar));
                ((TextView) findViewById.findViewById(R.id.serviceName)).setText(i2);
                findViewById.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        ARDCMAnalytics.getInstance().trackAction(str, ARDCMAnalytics.MY_ACCOUNT, (String) null);
                        ARUserAccountsActivity.this.showServicesPurchaseWebView(gVar);
                    }
                });
            }
        }
    }

    public void initializeRFECheckBoxes() {
        boolean z;
        CheckBox checkBox = (CheckBox) this.mMyAccountsMainFrameLayout.findViewById(R.id.RFESettingsSwitch);
        final ProgressBar progressBar = (ProgressBar) this.mMyAccountsMainFrameLayout.findViewById(R.id.RFECellularDataProgressBar);
        final View findViewById = this.mMyAccountsMainFrameLayout.findViewById(R.id.RFESettingsCellularSwitchView);
        progressBar.setVisibility(8);
        findViewById.setVisibility(8);
        boolean isMobileLinkOn = ARServicesAccount.getInstance().isMobileLinkOn();
        checkBox.setOnCheckedChangeListener(null);
        checkBox.setChecked(isMobileLinkOn);
        if (isMobileLinkOn) {
            findViewById.setVisibility(0);
            ((CheckBox) this.mMyAccountsMainFrameLayout.findViewById(R.id.RFECellularDataSwitch)).setChecked(ARServicesAccount.getInstance().isCellularDataForAutoUploadEnabled());
        } else {
            findViewById.setVisibility(8);
        }
        checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton compoundButton, boolean z2) {
                if (((ViewFlipper) ARUserAccountsActivity.this.mMyAccountsMainFrameLayout.findViewById(R.id.myAccountsViewFlipper)).getCurrentView().getId() == 2131493098) {
                    if (z2) {
                        progressBar.setVisibility(0);
                        findViewById.setVisibility(8);
                    } else {
                        progressBar.setVisibility(8);
                        findViewById.setVisibility(8);
                    }
                    if (ARServicesAccount.getInstance().isSignedIn()) {
                        ARUserAccountsActivity.this.setRFEEnabledPrefs(z2);
                        return;
                    }
                    Intent intent = new Intent(ARUserAccountsActivity.this, (Class<?>) SVServicesLoginActivity.class);
                    intent.putExtra("service_variant", g.ADC_SUBSCRIPTION.ordinal());
                    intent.putExtra("is_entitlement_check_required_bofore_subscription_check", true);
                    ARUserAccountsActivity.this.startActivityForResult(intent, 100);
                }
            }
        });
        CheckBox checkBox2 = (CheckBox) this.mMyAccountsMainFrameLayout.findViewById(R.id.RFECellularDataSwitch);
        checkBox2.setOnCheckedChangeListener(null);
        View findViewById2 = this.mMyAccountsMainFrameLayout.findViewById(R.id.RFECellularDataSwitchText);
        TelephonyManager telephonyManager = (TelephonyManager) ARApp.getAppContext().getSystemService("phone");
        int phoneType = telephonyManager.getPhoneType();
        if (phoneType == 2) {
            z = true;
        } else {
            z = phoneType == 1 && telephonyManager.getSimState() == 5;
        }
        if (z) {
            checkBox2.setEnabled(true);
            findViewById2.setEnabled(true);
            checkBox2.setChecked(ARServicesAccount.getInstance().isCellularDataForAutoUploadEnabled());
            checkBox2.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
                @Override
                public void onCheckedChanged(CompoundButton compoundButton, boolean z2) {
                    if (z2) {
                        ARDCMAnalytics.getInstance().trackAction(ARDCMAnalytics.AUTO_UPLOAD_ENABLED_OVER_DATA_PLAN, ARDCMAnalytics.MOBILE_LINK, (String) null);
                    } else {
                        ARDCMAnalytics.getInstance().trackAction(ARDCMAnalytics.AUTO_UPLOAD_DISABLED_OVER_DATA_PLAN, ARDCMAnalytics.MOBILE_LINK, (String) null);
                    }
                    ARServicesAccount.getInstance().setCellularDataEnabled(z2);
                }
            });
            return;
        }
        checkBox2.setChecked(false);
        checkBox2.setEnabled(false);
        findViewById2.setEnabled(false);
        ARServicesAccount.getInstance().setCellularDataEnabled(false);
    }

    private void loadMyAccountsView() {
        if (this.mMyAccountsView != null) {
            if (isMyAccountWebViewVisible()) {
                setActionBarTitle(getTopBarTitle());
                return;
            }
            refreshMyAccountsView();
            k.p();
            if (d.getInstance().isSharedCloudAccessible()) {
                new ARFetchUsersSubscriptionsAsyncTask(this, !sProgressViewAlreadyShown, new ae() {
                    @Override
                    public void execute(boolean z) {
                        ARUserAccountsActivity.this.refreshMyAccountsView();
                    }
                }).taskExecute(new Void[0]);
            }
            sProgressViewAlreadyShown = true;
        }
    }

    public void refreshMyAccountsView() {
        View findViewById;
        if (this.mMyAccountsView != null) {
            this.mMyAccountsMainFrameLayout.setVisibility(0);
            for (g gVar : g.values()) {
                switch (gVar) {
                    case ADC_SUBSCRIPTION:
                        View findViewById2 = this.mMyAccountsView.findViewById(R.id.myAccountsADC);
                        ((TextView) findViewById2.findViewById(R.id.serviceDetail)).setText(getDetailText(gVar));
                        findViewById = findViewById2;
                        break;
                    case EXPORT_PDF_SUBSCRIPTION:
                        findViewById = this.mMyAccountsView.findViewById(R.id.myAccountsEPDF);
                        break;
                    case PDF_PACK_SUBSCRIPTION:
                        findViewById = this.mMyAccountsView.findViewById(R.id.myAccountsAcrobatBasic);
                        break;
                    case ACROBAT_PRO_SUBSCRIPTION:
                        findViewById = this.mMyAccountsView.findViewById(R.id.myAccountsAcrobatPro);
                        break;
                    default:
                        findViewById = null;
                        break;
                }
                if (findViewById != null) {
                    TextView textView = (TextView) findViewById.findViewById(R.id.serviceStatus);
                    Context appContext = ARApp.getAppContext();
                    findViewById.setVisibility(0);
                    if (ARServicesAccount.getInstance().isSubscriptionAvailableForService(gVar)) {
                        textView.setText(appContext.getString(R.string.IDS_SERVICE_SUBSCRIBED_STR));
                        textView.setTextColor(appContext.getResources().getColor(R.color.account_subscribed_text_color));
                        findViewById.setClickable(false);
                    } else if (k.a(gVar)) {
                        textView.setText(appContext.getString(R.string.IDS_PROCESSING_STR));
                        textView.setTextColor(appContext.getResources().getColorStateList(R.color.account_entry_subscribe_text_color_selector));
                        findViewById.setClickable(true);
                    } else {
                        textView.setText(appContext.getString(R.string.IDS_SERVICE_SUBSCRIBE_NOW));
                        textView.setTextColor(appContext.getResources().getColorStateList(R.color.account_entry_subscribe_text_color_selector));
                        findViewById.setClickable(true);
                    }
                    findViewById.setContentDescription(((TextView) findViewById.findViewById(R.id.serviceName)).getText().toString() + " " + ((TextView) findViewById.findViewById(R.id.serviceDetail)).getText().toString() + " " + textView.getText().toString());
                }
            }
            TextView textView2 = (TextView) this.mMyAccountsView.findViewById(R.id.myAccountsRFEViewStatus);
            if (ARServicesAccount.getInstance().isMobileLinkOn()) {
                textView2.setText(R.string.IDS_MOBILE_LINK_ON_STR);
            } else {
                textView2.setText(R.string.IDS_MOBILE_LINK_OFF_STR);
            }
        }
        if (isMyAccountWebViewVisible()) {
            this.mMyAccountsMainFrameLayout.removeView(this.mWebView);
            this.mWebView = null;
        }
        this.mMyAccountsMainFrameLayout.findViewById(R.id.myAccountsRFEView).setVisibility(ARServicesAccount.getInstance().shouldShowRFEUI() ? 0 : 8);
        initializeRFECheckBoxes();
        updateActionBar();
        setActionBarTitle(getTopBarTitle());
        ((TextView) this.mMyAccountsView.findViewById(R.id.myAccountsRestorePurchasesTextView)).setVisibility(ARServicesAccount.getInstance().isSignedIn() && com.adobe.libs.services.f.a.a().e() ? 0 : 8);
    }

    public void setActionBarTitle(String str) {
        this.mActionBar.setSubtitle(ARServicesAccount.getInstance().getUserAdobeID());
        this.mActionBar.setTitle(str);
    }

    public void setRFEDescriptionString() {
        TextView textView = (TextView) this.mMyAccountsMainFrameLayout.findViewById(R.id.RFESettingsMobileLinkDescriptionView);
        textView.setText(Html.fromHtml(textView.getContext().getString(R.string.IDS_RFE_SETTINGS_MOBILE_LINK_DESCRIPTION_ANDROID_STR, textView.getContext().getString(R.string.IDS_LEARN_MORE_URL))));
        textView.setMovementMethod(LinkMovementMethod.getInstance());
    }

    private void setupActionBar() {
        this.mActionBar = getActionBar();
        setActionBarTitle(getResources().getString(R.string.IDS_MY_ACCOUNT_TITLE));
    }

    private boolean shouldShowSignoutButtonInActionBar() {
        return (!ARServicesAccount.getInstance().isSignedIn() || isMyAccountWebViewVisible() || ((ViewFlipper) this.mMyAccountsMainFrameLayout.findViewById(R.id.myAccountsViewFlipper)).getCurrentView().getId() == 2131493098) ? false : true;
    }

    public void showServicesPurchaseWebView(g gVar) {
        ag agVar = new ag() {
            @Override
            public void onFailure(String str, ah ahVar) {
                ARUserAccountsActivity.this.refreshMyAccountsView();
                ARAlert.displayErrorDlg(ARUserAccountsActivity.this, null, str, null);
            }

            @Override
            public void onSuccess() {
                ARUserAccountsActivity.this.refreshMyAccountsView();
            }
        };
        b bVar = new b() {
            @Override
            public void handleBackPress() {
                ARUserAccountsActivity.this.hideMyAccountWebView();
            }
        };
        hideMyAccountWebView();
        com.adobe.libs.a.b analyticsHelper = ARDCMAnalytics.getAnalyticsHelper();
        switch (gVar) {
            case ADC_SUBSCRIPTION:
                this.mWebView = new u(this, agVar, bVar, analyticsHelper);
                break;
            case EXPORT_PDF_SUBSCRIPTION:
            case PDF_PACK_SUBSCRIPTION:
            case ACROBAT_PRO_SUBSCRIPTION:
                this.mWebView = new k(this, agVar, bVar, gVar, analyticsHelper, false);
                break;
            case CREATE_PDF_SUBSCRIPTION:
                if (!$assertionsDisabled) {
                    throw new AssertionError();
                }
                break;
        }
        showWebView(this.mWebView);
        setActionBarTitle(getTopBarTitle());
    }

    private void showWebView(n nVar) {
        this.mMyAccountsMainFrameLayout.addView(this.mWebView);
        updateActionBar();
    }

    public void updateActionBar() {
        if (this.mActionBarMenu != null) {
            onPrepareOptionsMenu(this.mActionBarMenu);
        }
    }

    public void cancelRFEPrefsUpdate() {
        CheckBox checkBox = (CheckBox) this.mMyAccountsMainFrameLayout.findViewById(R.id.RFESettingsSwitch);
        checkBox.setOnCheckedChangeListener(null);
        checkBox.setChecked(!checkBox.isChecked());
        initializeRFECheckBoxes();
    }

    public void hideMyAccountWebView() {
        if (isMyAccountWebViewVisible()) {
            this.mMyAccountsMainFrameLayout.removeView(this.mWebView);
            this.mWebView = null;
            refreshMyAccountsView();
        }
    }

    public boolean isMyAccountWebViewVisible() {
        return this.mWebView != null && this.mWebView.isShown();
    }

    public boolean isMyAccountsViewVisible() {
        return this.mMyAccountsView != null && this.mMyAccountsView.isShown();
    }

    @Override
    public void onActivityResultRAW(int i, int i2, Intent intent) {
        super.onActivityResultRAW(i, i2, intent);
        switch (i) {
            case 100:
                if (i2 != -1) {
                    cancelRFEPrefsUpdate();
                    break;
                } else {
                    setRFEEnabledPrefs(intent.getBooleanExtra(ARMobileLinkUIManager.RFE_TOGGLE_STATUS_KEY, ARServicesAccount.getInstance().isMobileLinkOn()));
                    break;
                }
            case 10101:
                com.adobe.libs.services.f.a.a().a(i, i2, intent);
                break;
        }
    }

    @Override
    public void onBackPressed() {
        if (handleBackPressed()) {
            return;
        }
        finish();
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.user_accounts_menu, menu);
        this.mActionBarMenu = menu;
        super.onCreateOptionsMenu(menu);
        return true;
    }

    @Override
    public void onCreateRAW(Bundle bundle) {
        super.onCreateRAW(bundle);
        setContentView(R.layout.myaccounts);
        this.mMyAccountsView = findViewById(R.id.myAccountsLayout);
        this.mMyAccountsMainFrameLayout = (FrameLayout) findViewById(R.id.myAccountsMainLayout);
        if (this.mMyAccountsView != null) {
            initializeMyAccountEntries();
            final ProgressBar progressBar = (ProgressBar) this.mMyAccountsMainFrameLayout.findViewById(R.id.RFECellularDataProgressBar);
            View findViewById = this.mMyAccountsMainFrameLayout.findViewById(R.id.RFESettingsCellularSwitchView);
            progressBar.setVisibility(8);
            findViewById.setVisibility(8);
            ((TextView) this.mMyAccountsView.findViewById(R.id.myAccountsRestorePurchasesTextView)).setOnClickListener(new AnonymousClass1());
            this.mMyAccountsView.findViewById(R.id.myAccountsRFEStatusView).setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    ARUserAccountsActivity.this.initializeRFECheckBoxes();
                    progressBar.setVisibility(8);
                    ARUserAccountsActivity.this.setRFEDescriptionString();
                    ((ViewFlipper) ARUserAccountsActivity.this.mMyAccountsMainFrameLayout.findViewById(R.id.myAccountsViewFlipper)).showNext();
                    ARUserAccountsActivity.this.updateActionBar();
                    ARUserAccountsActivity.this.setActionBarTitle(ARUserAccountsActivity.this.getTopBarTitle());
                }
            });
        }
        setupActionBar();
        loadMyAccountsView();
    }

    @Override
    public void onDestroyRAW() {
        if (this.mWebView != null) {
            ((ViewGroup) this.mWebView.getParent()).removeView(this.mWebView);
            this.mWebView.removeAllViews();
            this.mWebView.destroy();
            this.mWebView = null;
        }
        super.onDestroyRAW();
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem menuItem) {
        switch (menuItem.getItemId()) {
            case android.R.id.home:
                if (handleBackPressed()) {
                    return true;
                }
                finish();
                return true;
            case R.id.user_accounts_cloud_signout:
                toggleUserSignedInState();
                return true;
            default:
                return super.onOptionsItemSelected(menuItem);
        }
    }

    @Override
    public void onPauseRAW() {
        super.onPauseRAW();
        ARDCMAnalytics.getInstance().collectLifecycleData();
    }

    @Override
    public boolean onPrepareOptionsMenu(Menu menu) {
        super.onPrepareOptionsMenu(menu);
        menu.findItem(R.id.user_accounts_cloud_signout).setVisible(shouldShowSignoutButtonInActionBar());
        return true;
    }

    @Override
    public void onResumeRAW() {
        super.onResumeRAW();
        ARDCMAnalytics.getInstance().pauseCollectingLifecycleData();
    }

    public void setRFEEnabledPrefs(final boolean z) {
        final CheckBox checkBox = (CheckBox) this.mMyAccountsMainFrameLayout.findViewById(R.id.RFESettingsSwitch);
        final ProgressBar progressBar = (ProgressBar) this.mMyAccountsMainFrameLayout.findViewById(R.id.RFECellularDataProgressBar);
        final View findViewById = this.mMyAccountsMainFrameLayout.findViewById(R.id.RFESettingsCellularSwitchView);
        com.adobe.libs.services.g.d.a(z, new e() {
            @Override
            public void failure() {
                checkBox.setOnCheckedChangeListener(null);
                if (z) {
                    checkBox.setChecked(false);
                    progressBar.setVisibility(8);
                    findViewById.setVisibility(8);
                } else {
                    checkBox.setChecked(true);
                    progressBar.setVisibility(8);
                    findViewById.setVisibility(0);
                }
                ARUserAccountsActivity.this.refreshMyAccountsView();
                ARUserAccountsActivity.this.initializeRFECheckBoxes();
            }

            @Override
            public void success() {
                ARDCMAnalytics.getInstance().trackMobileLinkStatusChange(ARDCMAnalytics.MOBILE_LINK_SOURCE_ACCOUNTS_VIEW);
                progressBar.setVisibility(8);
                ARUserAccountsActivity.this.refreshMyAccountsView();
            }
        });
    }

    public void toggleUserSignedInState() {
        if (ARServicesAccount.getInstance().isSignedIn()) {
            new ARAlert(this, new ARAlert.DialogProvider() {
                @Override
                public Dialog getDialog() {
                    Context appContext = ARApp.getAppContext();
                    ARAlertDialog aRAlertDialog = new ARAlertDialog(ARUserAccountsActivity.this);
                    aRAlertDialog.setTitle(R.string.IDS_SIGN_OUT_STR);
                    aRAlertDialog.setMessage(appContext.getString(R.string.IDS_SIGN_OUT_DESCRIPTION_STR));
                    aRAlertDialog.setButton(-1, appContext.getString(R.string.IDS_SIGN_OUT_STR), new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialogInterface, int i) {
                            LocalBroadcastManager.getInstance(ARUserAccountsActivity.this).sendBroadcastSync(new Intent(ARUserAccountsActivity.USER_SIGNED_OUT_FROM_USER_ACCOUNTS));
                            dialogInterface.dismiss();
                            ARServicesAccount.getInstance().removeAccount();
                            ARDCMAnalytics.getInstance().trackAction("Service Marketing Page Logout Success:Document Cloud", (HashMap<String, Object>) null);
                            ARUserAccountsActivity.this.finish();
                        }
                    });
                    aRAlertDialog.setButton(-2, appContext.getString(2131230745), new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialogInterface, int i) {
                            dialogInterface.dismiss();
                        }
                    });
                    return aRAlertDialog;
                }
            }).show();
        }
    }
}