Giter Site home page Giter Site logo

justson / agentweb Goto Github PK

View Code? Open in Web Editor NEW
9.1K 170.0 1.6K 28.35 MB

AgentWeb is a powerful library based on Android WebView.

Home Page: https://www.jianshu.com/p/fc7909e24178

License: Apache License 2.0

Java 100.00%
webview agentweb-android-webview webview-agentweb-web cookie android-webview wechat-pay hybrid

agentweb's Introduction

github

agentweb's People

Contributors

clanaid avatar desfate avatar hujinqiang avatar justson avatar leondevlifelog avatar liyujiang-gzu avatar spenceacc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

agentweb's Issues

onDestroy()的是要做处理吗?

    public void onDestroy() {
        mAgentWeb.getWebLifeCycle().onDestroy();
        super.onDestroy();
    }

我这样调,发现退出activity的时候会崩溃

Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.os.Handler.removeCallbacksAndMessages(java.lang.Object)' on a null object reference

我之前 看过很多webview的文章,提到退出时最后在onDestroy()做webview的置空操作,可以尽可能避免内存溢出
之前我是这样做的:

    protected void onDestroy() {
        super.onDestroy();
        if (mWebView != null) {
            mWebView.clearHistory();
            ((ViewGroup) mWebView.getParent()).removeView(mWebView);
            mWebView.loadUrl("about:blank");
            mWebView.stopLoading();
            mWebView.setWebChromeClient(null);
            mWebView.setWebViewClient(null);
            mWebView.destroy();
            mWebView = null;
        }
    }

现在agentWeb是否需要做类似的操作

onShowFileChooser 报错

E/dalvikvm: Could not find class 'android.webkit.WebChromeClient$FileChooserParams', referenced from method com.just.library.DefaultChromeClient.onShowFileChooser
E/dalvikvm: Could not find class 'org.greenrobot.greendao.database.DatabaseOpenHelper$EncryptedHelper', referenced from method org.greenrobot.greendao.database.DatabaseOpenHelper.checkEncryptedHelper
E/dalvikvm: Could not find class 'android.graphics.drawable.RippleDrawable', referenced from method android.support.v7.widget.AppCompatImageHelper.hasOverlappingRendering

建议颜色那些加注解

比如:useDefaultIndicator(@ColorInt int color)
R.color.xx 也是int 但是是@ColorRes的,不加注解不好区分

下载安装判断版本有问题

AgentWebUtils里面getIntentCompat方法 if (Build.VERSION.SDK_INT >= 24) 这样才没问题。你之前的写法是在夜神模拟器上点击安装崩溃。
public static Intent getIntentCompat(Context context, File file) {
Intent mIntent = null;
LogUtils.i("Info", "getIntentCompat :" + context.getApplicationInfo().targetSdkVersion);
if (Build.VERSION.SDK_INT >= 24) {

        mIntent = new Intent(Intent.ACTION_VIEW);
        mIntent.setDataAndType(FileProvider.getUriForFile(context, context.getPackageName() + ".AgentWebFileProvider", file), "application/vnd.android.package-archive");
        mIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
    } else {

        mIntent = AgentWebUtils.getFileIntent(file);
    }

    return mIntent;
}

反馈问题

  1. 如何修改通过WebView下载文件的路径?
  2. 我重复调用OnCreat下的方法想实现刷新界面不起作用,如何刷新当前WebView界面?

闪退

运行一段时间会自动闪退,是h5写的太烂嘛?

SSL Error Handler error by google play team

Hi,
I using agent web and when upload app to google, i have email alert:

Vulnerability APK Version(s)
SSL Error Handler
For more information on how to address WebView SSL Error Handler alerts, please see this Google Help Center article.

I try google and fix this in AgentWebFragment.java (My app base on your example app), but when update app again, error still orccur, please help!

private WebViewClient mWebViewClient = new WebViewClient() {

        @Override
        public void onReceivedSslError(WebView view, final SslErrorHandler handler, SslError error) {
            //final AlertDialog.Builder builder = new AlertDialog.Builder(OnlinePayment.this);
            String msg="";
            if(error.getPrimaryError()==SslError.SSL_DATE_INVALID
                    || error.getPrimaryError()== SslError.SSL_EXPIRED
                    || error.getPrimaryError()== SslError.SSL_IDMISMATCH
                    || error.getPrimaryError()== SslError.SSL_INVALID
                    || error.getPrimaryError()== SslError.SSL_NOTYETVALID
                    || error.getPrimaryError()==SslError.SSL_UNTRUSTED) {
                if(error.getPrimaryError()==SslError.SSL_DATE_INVALID){
                    msg="The date of the certificate is invalid";
                }else if(error.getPrimaryError()==SslError.SSL_INVALID){
                    msg="A generic error occurred";
                }
                else if(error.getPrimaryError()== SslError.SSL_EXPIRED){
                    msg="The certificate has expired";
                }else if(error.getPrimaryError()== SslError.SSL_IDMISMATCH){
                    msg="Hostname mismatch";
                }
                else if(error.getPrimaryError()== SslError.SSL_NOTYETVALID){
                    msg="The certificate is not yet valid";
                }
                else if(error.getPrimaryError()==SslError.SSL_UNTRUSTED){
                    msg="The certificate authority is not trusted";
                }
            }

            msg += ". We will cancel the request.";

            final AlertDialog.Builder builder = new AlertDialog.Builder(AgentWebFragment.this.getActivity());
            builder.setMessage(msg);
            builder.setPositiveButton("", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    handler.cancel();
                }
            });
            final AlertDialog dialog = builder.create();
            dialog.show();

        }
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {

            Log.i("Info","shouldOverrideUrlLoading");
            return false;
        }

        @Override
        public void onPageStarted(WebView view, String url, Bitmap favicon) {

            Log.i("Info","url:"+url);
            if(url.equals(getUrl())){
                pageNavigator(View.GONE);
            }else{
                pageNavigator(View.VISIBLE);
            }

        }

    };

Android17以下不支持回调

@Override
public void callJs(String js, final ValueCallback<String> callback) {
    if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR1) {
        this.evaluateJs(js, callback);
    } else {
        this.loadJs(js);
    }
}

Select form field can't popup window, and jsconfirm crashed

1 . A basic form with select field, click no popup window, and monitor error as next:
webview show mWindowManager.addView RuntimeException

2 .Javascript confirm will crash the webview

I used AgentWeb with fragment.

AgentWeb is very nice!!

js 调用java

我看到代码中,java 调用js,可以使用quickCallJs();那么 js 调用java,需要在那里做设置呢

关于js交互问题

感谢您的分享,刚看到Javascript 调 Java的方法,是window.android.这种方式调用的.这种调用方法只有在android中使用AgentWeb才能调用成功吗?
因为一般公司的项目都是两个端的(ios和android),之前js直接用JavaScriptClient.方法 两个端的方法就都能调用了

反馈AgentWeb功能建议

有三个功能我觉得挺不错的,AgentWeb库当前里面有吗?
第一个功能:如果网站的标题颜色的绿色,可以自动获取到网站标题的颜色,并设置标题栏颜色和网站标题颜色为一致绿色
第二个功能:可以像QQ浏览器那样设置UA标识吗,就是可以根据设置来决定打开的页面为(Android页面还是电脑端页面)的网页
第三个功能:当点击网页中的图片时,可以实现自动跳转到图片预览界面,图片预览界面库推荐使用此库很不错https://github.com/Hitomis/transferee

建议sample工程和library工程做拆分,拆分为两个Repository

最近需要使用webview做一些复杂点的展示,就发现了您的开源工程。首先感谢您的分享!我想把您的library工程作为一个module嵌入到我的工程中,但是我发现我拷贝后就比较难与您的代码同步。还有一种选择是使用compile,但是这样的话一旦遇到问题不能及时修改。如果把library作为一个单独的module(一个单独的repository),再在sample repository中通过忽略library repository的git消除冲突的git校验。这样如果使用过程中发现问题可以及时修改,如果解决问题也可以把解决方案反馈给您

文件上传时的requestCode

你好,文件上传时,选择一个文件比如图片后,会在onActivityResult里调用uploadFileResult上传图片,那这个requestCode是多少呢?是否可以暴露出来?

不支持 accept="image/*" capture="camera" 打开相机

大概看了下代码,发现onShowFileChooser 里的 FileChooserParams 也没有capture属性,只有个captureEnabled。这种的不能打开相机的要怎么处理,我看用UC浏览器可以打开,是不是跟浏览器内核有关?

sample跑不上

Error:Execution failed for task ':sample:validateSigningDebug'.

Keystore file F:\Download\AgentWeb-master\sample\keystore\keystore.jks not found for signing config 'release'.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.