导航菜单

页面标题

页面副标题

爱心e站 v1.0.0 - WebViewActivity.java 源代码

正在查看: 爱心e站 v1.0.0 应用的 WebViewActivity.java JAVA 源代码文件

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


package com.newheyd.JZKFcanjiren.Activity;

import android.content.DialogInterface;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebChromeClient;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
import android.webkit.WebView;
import android.widget.ProgressBar;
import com.newheyd.JZKFcanjiren.BaseActivity;
import com.newheyd.JZKFcanjiren.R;
import com.newheyd.JZKFcanjiren.View.NewWebView;
import com.newheyd.JZKFcanjiren.View.TitleView;
import com.newheyd.JZKFcanjiren.model.BaseResult;
import com.newheyd.JZKFcanjiren.net.NewHYTask;

public class WebViewActivity extends BaseActivity implements NewWebView.OnWebViewCallBackImpl {
    private ProgressBar mBar = null;
    private TitleView title_ysxy;
    private String type;
    private NewWebView webview;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        setContentView(R.layout.page_mine_xsxieyi);
        super.onCreate(savedInstanceState);
        if ("1".equals(this.type)) {
            this.webview.loadUrl("file:///android_asset/xieyi.html");
        } else if ("2".equals(this.type)) {
            this.webview.loadUrl("file:///android_asset/reg.html");
        }
    }

    public void initWebView() {
        this.webview.setWebChromeClient(new WebChromeClient() {
            @Override
            public void onProgressChanged(WebView view, int newProgress) {
                if (newProgress == 100) {
                    WebViewActivity.this.mBar.setVisibility(8);
                } else {
                    WebViewActivity.this.mBar.setVisibility(0);
                    WebViewActivity.this.mBar.setProgress(newProgress);
                }
                super.onProgressChanged(view, newProgress);
            }
        });
        this.webview.setOnLongClickListener(new View.OnLongClickListener() {
            @Override
            public boolean onLongClick(View v) {
                return true;
            }
        });
    }

    @Override
    public void initViews() {
        this.mBar = (ProgressBar) findViewById(R.id.myProgressBar);
        this.title_ysxy = (TitleView) findViewById(R.id.titleview_mine_ysxy);
        this.webview = (NewWebView) findViewById(R.id.webview);
        initWebView();
    }

    @Override
    public void getExtraParam() {
        this.type = getIntent().getStringExtra("type");
    }

    @Override
    public void setListener() {
        if ("1".equals(this.type)) {
            this.title_ysxy.setTextName("隐私协议");
        } else if ("2".equals(this.type)) {
            this.title_ysxy.setTextName("注册声明");
        }
        this.title_ysxy.setOnTitleClik(new TitleView.BackListenner() {
            @Override
            public void BackSet() {
                WebViewActivity.this.finish();
            }
        }, null);
    }

    @Override
    public void onResponseBefore(NewHYTask task) {
    }

    @Override
    public void onResponseAfter(NewHYTask task) {
    }

    @Override
    public void onResponseSuccessful(NewHYTask task, BaseResult object) {
    }

    @Override
    public void onResponseError(NewHYTask task, BaseResult object) {
    }

    @Override
    public void onServerError(NewHYTask task, int failedType) {
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (4 == event.getKeyCode() && "3".equals(this.type)) {
            ChoiceTishiDialog("确定退出需求调查?", false, new BaseActivity.OnChoiceDialogYes() {
                @Override
                public void onChoiceDialogYes(DialogInterface dialogInterface, int i) {
                    WebViewActivity.this.setResult(-1);
                    WebViewActivity.this.finish();
                }
            }, new BaseActivity.OnChoiceDialogNo() {
                @Override
                public void onChoiceDialogNo(DialogInterface dialogInterface, int i) {
                }
            });
        }
        return super.onKeyDown(keyCode, event);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        if (this.webview != null) {
            this.webview.removeAllViews();
            ((ViewGroup) this.webview.getParent()).removeView(this.webview);
            this.webview.setTag(null);
            this.webview.clearHistory();
            this.webview.destroy();
            this.webview = null;
        }
    }

    @Override
    public void onSuccess(WebView view, String url) {
    }

    @Override
    public void onError(WebView view, WebResourceRequest request, WebResourceError error) {
    }
}