package com.just.library;

import android.webkit.WebView;

/**
 * Created by cenxiaozhong on 2017/12/6.
 * 该类统一控制了与用户交互的一些UI
 */
public abstract class AgentWebUIController {


    protected void onJsAlert(WebView view, String url, String message) {

    }


    protected void onJsConfirm(WebView view, String url, String message) {

    }


    public void onJsPrompt(WebView view, String url, String message, String defaultValue) {

    }
}

@@ -168,16 +168,488 @@
 ller %7B%0A%0A
+    private static boolean hasDesignLib = false;%0A%0A    static %7B%0A        try %7B%0A            Class.forName(%22android.support.design.widget.Snackbar%22);%0A            hasDesignLib = true;%0A        %7D catch (Throwable ignore) %7B%0A            hasDesignLib = false;%0A        %7D%0A    %7D%0A%0A    private AgentWebUIController mAgentWebUIControllerDelegate;%0A%0A    public AgentWebUIController create() %7B%0A        return hasDesignLib ? new DefaultDesignUIController() : new DefaultUIController();%0A    %7D%0A
 %0A    pro
@@ -707,32 +707,85 @@
 ing message) %7B%0A%0A
+        getDelegate().onJsAlert(view, url, message);%0A
     %7D%0A%0A%0A    prot
@@ -847,25 +847,79 @@
  message) %7B%0A
+        getDelegate().onJsConfirm(view, url, message);
 %0A
-
     %7D%0A%0A%0A    
@@ -1002,21 +1002,408 @@
 ultValue) %7B%0A
+        getDelegate().onJsPrompt(view, url, message, defaultValue);%0A    %7D%0A%0A    public AgentWebUIController getDelegate() %7B%0A        AgentWebUIController mAgentWebUIController = this.mAgentWebUIControllerDelegate;%0A        if (mAgentWebUIController == null) %7B%0A            this.mAgentWebUIControllerDelegate = mAgentWebUIController = create();%0A        %7D%0A        return mAgentWebUIController;
 %0A    %7D%0A%7D%0A

update AgentWebUIController