导航菜单

页面标题

页面副标题

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

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

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


package com.adobe.reader.help;

import android.app.ActionBar;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.AdapterView;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.Toast;
import com.adobe.reader.R;
import com.adobe.reader.analytics.ARDCMAnalytics;
import com.adobe.reader.config.ARConstants;
import com.adobe.reader.help.ARHelpArrayAdapter;
import com.adobe.reader.misc.ARAboutActivity;
import com.adobe.reader.misc.ARApp;
import com.adobe.reader.services.auth.ARServicesAccount;
import com.adobe.reader.ui.ARBaseActivity;

public class ARHelpActivity extends ARBaseActivity {
    private ActionBar mActionBar;
    private View mLoadingPage = null;
    private final String SHARE_FEEDBACK_URLPATH = "https://www.adobe.com/go/acrobatdcmobile_forum";
    private final String WHATS_NEW_URLPATH = "file:///android_res/raw/whatsnew.html";

    class AnonymousClass3 {
        static final int[] $SwitchMap$com$adobe$reader$help$ARHelpArrayAdapter$HELP_ROW_NAME = new int[ARHelpArrayAdapter.HELP_ROW_NAME.values().length];

        static {
            try {
                $SwitchMap$com$adobe$reader$help$ARHelpArrayAdapter$HELP_ROW_NAME[ARHelpArrayAdapter.HELP_ROW_NAME.HOW_TO.ordinal()] = 1;
            } catch (NoSuchFieldError e) {
            }
            try {
                $SwitchMap$com$adobe$reader$help$ARHelpArrayAdapter$HELP_ROW_NAME[ARHelpArrayAdapter.HELP_ROW_NAME.WHATS_NEW.ordinal()] = 2;
            } catch (NoSuchFieldError e2) {
            }
            try {
                $SwitchMap$com$adobe$reader$help$ARHelpArrayAdapter$HELP_ROW_NAME[ARHelpArrayAdapter.HELP_ROW_NAME.SHARE_FEEDBACK.ordinal()] = 3;
            } catch (NoSuchFieldError e3) {
            }
            try {
                $SwitchMap$com$adobe$reader$help$ARHelpArrayAdapter$HELP_ROW_NAME[ARHelpArrayAdapter.HELP_ROW_NAME.PRIVACY_POLICY.ordinal()] = 4;
            } catch (NoSuchFieldError e4) {
            }
        }
    }

    private void clearWebView(WebView webView) {
        webView.stopLoading();
        webView.setVisibility(8);
        webView.clearHistory();
    }

    private void destroyWebView(WebView webView) {
        ((ViewGroup) webView.getParent()).removeView(webView);
        webView.removeAllViews();
        webView.destroy();
    }

    public void dismissLoadingPage() {
        this.mLoadingPage.setVisibility(8);
    }

    public WebViewClient getHelpWebViewClient() {
        return new WebViewClient() {
            @Override
            public void onPageFinished(WebView webView, String str) {
                if (ARHelpActivity.this.mLoadingPage.getVisibility() == 0) {
                    ARHelpActivity.this.dismissLoadingPage();
                }
            }

            @Override
            public boolean shouldOverrideUrlLoading(WebView webView, String str) {
                return false;
            }
        };
    }

    private boolean handleBackPressed() {
        WebView webView = (WebView) findViewById(R.id.rightPaneWebViewWN);
        WebView webView2 = (WebView) findViewById(R.id.rightPaneWebViewHT);
        WebView webView3 = (WebView) findViewById(R.id.rightPaneWebViewPP);
        if (!isHelpWebViewVisible()) {
            return false;
        }
        if (webView.isShown()) {
            webView.setContentDescription("What's New");
        } else {
            webView = webView2.isShown() ? webView2 : webView3.isShown() ? webView3 : null;
        }
        if (webView == null || !webView.canGoBack()) {
            setHelpListViewVisibility(0);
            hideHelpWebViews();
        } else {
            webView.goBack();
        }
        return true;
    }

    private void hideHelpWebViews() {
        if (!isHelpWebViewVisible()) {
            finish();
            return;
        }
        clearWebView((WebView) findViewById(R.id.rightPaneWebViewWN));
        clearWebView((WebView) findViewById(R.id.rightPaneWebViewHT));
        clearWebView((WebView) findViewById(R.id.rightPaneWebViewPP));
        dismissLoadingPage();
        setActionBarTitle();
    }

    private boolean isHelpWebViewVisible() {
        return ((WebView) findViewById(R.id.rightPaneWebViewWN)).isShown() || ((WebView) findViewById(R.id.rightPaneWebViewHT)).isShown() || ((WebView) findViewById(R.id.rightPaneWebViewPP)).isShown();
    }

    private void loadHelpView() {
        View findViewById = findViewById(R.id.helpLayout);
        if (findViewById != null) {
            ListView listView = (ListView) findViewById(R.id.help_listView);
            final ARHelpArrayAdapter aRHelpArrayAdapter = new ARHelpArrayAdapter(this);
            this.mLoadingPage = findViewById(R.id.rightPaneLoadingViewHelp);
            listView.setAdapter((ListAdapter) aRHelpArrayAdapter);
            listView.setVerticalScrollBarEnabled(false);
            findViewById.setVisibility(0);
            this.mActionBar.setTitle(R.string.IDS_HELP_COMMAND_LABEL);
            listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                @Override
                public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
                    if (aRHelpArrayAdapter.getItem(i) != null) {
                        switch (AnonymousClass3.$SwitchMap$com$adobe$reader$help$ARHelpArrayAdapter$HELP_ROW_NAME[aRHelpArrayAdapter.getItem(i).getHelpRowName().ordinal()]) {
                            case 1:
                                WebView webView = (WebView) ARHelpActivity.this.findViewById(R.id.rightPaneWebViewHT);
                                ARDCMAnalytics.getInstance().trackAction(ARDCMAnalytics.HOW_TO_TAPPED, ARDCMAnalytics.HELP, (String) null);
                                if (webView != null) {
                                    ARHelpActivity.this.mActionBar.setTitle(R.string.IDS_HOW_TO_STR);
                                    webView.setHorizontalScrollBarEnabled(false);
                                    webView.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
                                    ARHelpActivity.this.showLoadingPage();
                                    webView.getSettings().setJavaScriptEnabled(true);
                                    String string = ARHelpActivity.this.getString(R.string.IDS_HOW_TO_URL);
                                    if (ARServicesAccount.getInstance().isStageServer()) {
                                        string = string.replace("www.adobe.com", "www.stage.adobe.com");
                                    }
                                    ARHelpActivity.this.loadURL(webView, string);
                                    webView.setVisibility(0);
                                    webView.setWebChromeClient(new WebChromeClient());
                                    webView.setWebViewClient(ARHelpActivity.this.getHelpWebViewClient());
                                }
                                ARHelpActivity.this.mActionBar.setDisplayHomeAsUpEnabled(true);
                                ARHelpActivity.this.setHelpListViewVisibility(8);
                                break;
                            case 2:
                                WebView webView2 = (WebView) ARHelpActivity.this.findViewById(R.id.rightPaneWebViewWN);
                                ARDCMAnalytics.getInstance().trackAction(ARDCMAnalytics.WHATS_NEW_TAPPED, ARDCMAnalytics.HELP, (String) null);
                                if (webView2 != null) {
                                    ARHelpActivity.this.mActionBar.setTitle(R.string.IDS_WHATS_NEW_FOLDER);
                                    ARHelpActivity.this.loadURL(webView2, "file:///android_res/raw/whatsnew.html");
                                    webView2.setVisibility(0);
                                    ARHelpActivity.this.mActionBar.setDisplayHomeAsUpEnabled(true);
                                }
                                ARHelpActivity.this.setHelpListViewVisibility(8);
                                break;
                            case 3:
                                ARDCMAnalytics.getInstance().trackAction(ARDCMAnalytics.SHARE_FEEDBACK_TAPPED, ARDCMAnalytics.HELP, (String) null);
                                Intent intent = new Intent("android.intent.action.VIEW");
                                intent.setData(Uri.parse("https://www.adobe.com/go/acrobatdcmobile_forum"));
                                try {
                                    ARHelpActivity.this.startActivity(intent);
                                    break;
                                } catch (ActivityNotFoundException e) {
                                    Toast.makeText(ARApp.getAppContext(), ARHelpActivity.this.getString(R.string.IDS_NO_SUPPORTED_APP), ARConstants.TOAST_MSG_DISPLAY_TIME_IN_MS).show();
                                    return;
                                }
                            case 4:
                                ARDCMAnalytics.getInstance().trackAction(ARDCMAnalytics.PRIVACY_POLICY_TAPPED, ARDCMAnalytics.HELP, (String) null);
                                WebView webView3 = (WebView) ARHelpActivity.this.findViewById(R.id.rightPaneWebViewPP);
                                if (webView3 != null) {
                                    ARHelpActivity.this.mActionBar.setTitle(R.string.IDS_ADOBE_PRIVACY_POLICY);
                                    ARHelpActivity.this.showLoadingPage();
                                    webView3.setHorizontalScrollBarEnabled(false);
                                    webView3.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
                                    webView3.getSettings().setJavaScriptEnabled(true);
                                    ARHelpActivity.this.loadURL(webView3, ARHelpActivity.this.getString(R.string.IDS_ADOBE_PRIVACY_POLICY_URL));
                                    webView3.setVisibility(0);
                                    webView3.setWebChromeClient(new WebChromeClient());
                                    webView3.setWebViewClient(ARHelpActivity.this.getHelpWebViewClient());
                                    ARHelpActivity.this.mActionBar.setDisplayHomeAsUpEnabled(true);
                                }
                                ARHelpActivity.this.setHelpListViewVisibility(8);
                                break;
                        }
                    }
                }
            });
        }
    }

    public void loadURL(WebView webView, String str) {
        String str2 = "Loading url at " + str;
        webView.loadUrl(str);
    }

    private void setActionBarTitle() {
        if (!isHelpWebViewVisible()) {
            this.mActionBar.setTitle(R.string.IDS_HELP_COMMAND_LABEL);
            return;
        }
        WebView webView = (WebView) findViewById(R.id.rightPaneWebViewWN);
        WebView webView2 = (WebView) findViewById(R.id.rightPaneWebViewHT);
        WebView webView3 = (WebView) findViewById(R.id.rightPaneWebViewPP);
        if (webView.isShown()) {
            this.mActionBar.setTitle(R.string.IDS_WHATS_NEW_FOLDER);
        } else if (webView2.isShown()) {
            this.mActionBar.setTitle(R.string.IDS_HOW_TO_STR);
        } else if (webView3.isShown()) {
            this.mActionBar.setTitle(R.string.IDS_ADOBE_PRIVACY_POLICY);
        }
    }

    public void setHelpListViewVisibility(int i) {
        try {
            ((ListView) findViewById(R.id.help_listView)).setVisibility(i);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private void setupActionBar() {
        this.mActionBar = getActionBar();
        setActionBarTitle();
    }

    public void showLoadingPage() {
        this.mLoadingPage.setVisibility(0);
    }

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

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

    @Override
    public void onCreateRAW(Bundle bundle) {
        super.onCreateRAW(bundle);
        setContentView(R.layout.help);
        setupActionBar();
        loadHelpView();
    }

    @Override
    public void onDestroyRAW() {
        WebView webView = (WebView) findViewById(R.id.rightPaneWebViewWN);
        WebView webView2 = (WebView) findViewById(R.id.rightPaneWebViewHT);
        WebView webView3 = (WebView) findViewById(R.id.rightPaneWebViewPP);
        if (webView != null) {
            destroyWebView(webView);
        }
        if (webView2 != null) {
            destroyWebView(webView2);
        }
        if (webView3 != null) {
            destroyWebView(webView3);
        }
        super.onDestroyRAW();
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem menuItem) {
        switch (menuItem.getItemId()) {
            case android.R.id.home:
                setHelpListViewVisibility(0);
                hideHelpWebViews();
                return true;
            case R.id.help_about:
                startActivity(new Intent(this, (Class<?>) ARAboutActivity.class));
                return true;
            default:
                return super.onOptionsItemSelected(menuItem);
        }
    }

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

    @Override
    public boolean onPrepareOptionsMenu(Menu menu) {
        super.onPrepareOptionsMenu(menu);
        MenuItem findItem = menu.findItem(R.id.base_help);
        if (findItem == null) {
            return true;
        }
        findItem.setVisible(false);
        return true;
    }

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