android.webkit.JsPromptResult Java Examples

The following examples show how to use android.webkit.JsPromptResult. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CustomWebViewActivity.java    From JsBridge with Apache License 2.0 6 votes vote down vote up
public CustomWebView(Context context) {
    super(context);
    this.webView = new WebView(context);
    this.webView.getSettings().setJavaScriptEnabled(true);
    addView(this.webView);
    this.webView.setWebChromeClient(new WebChromeClient() {
        @Override
        public boolean onJsPrompt(WebView view, String url,
                                  String message, String defaultValue, JsPromptResult result) {
            if (callback != null) {
                callback.onResult(message, new PromptResultImpl(result));
            }
            return true;
        }

        @Override
        public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
            Log.d(JsBridge.TAG, consoleMessage.message());
            return true;
        }
    });
}
 
Example #2
Source File: SystemWebChromeClient.java    From keemob with MIT License 6 votes vote down vote up
/**
 * Tell the client to display a prompt dialog to the user.
 * If the client returns true, WebView will assume that the client will
 * handle the prompt dialog and call the appropriate JsPromptResult method.
 *
 * Since we are hacking prompts for our own purposes, we should not be using them for
 * this purpose, perhaps we should hack console.log to do this instead!
 */
@Override
public boolean onJsPrompt(WebView view, String origin, String message, String defaultValue, final JsPromptResult result) {
    // Unlike the @JavascriptInterface bridge, this method is always called on the UI thread.
    String handledRet = parentEngine.bridge.promptOnJsPrompt(origin, message, defaultValue);
    if (handledRet != null) {
        result.confirm(handledRet);
    } else {
        dialogsHelper.showPrompt(message, defaultValue, new CordovaDialogsHelper.Result() {
            @Override
            public void gotResult(boolean success, String value) {
                if (success) {
                    result.confirm(value);
                } else {
                    result.cancel();
                }
            }
        });
    }
    return true;
}
 
Example #3
Source File: SystemWebChromeClient.java    From keemob with MIT License 6 votes vote down vote up
/**
 * Tell the client to display a prompt dialog to the user.
 * If the client returns true, WebView will assume that the client will
 * handle the prompt dialog and call the appropriate JsPromptResult method.
 *
 * Since we are hacking prompts for our own purposes, we should not be using them for
 * this purpose, perhaps we should hack console.log to do this instead!
 */
@Override
public boolean onJsPrompt(WebView view, String origin, String message, String defaultValue, final JsPromptResult result) {
    // Unlike the @JavascriptInterface bridge, this method is always called on the UI thread.
    String handledRet = parentEngine.bridge.promptOnJsPrompt(origin, message, defaultValue);
    if (handledRet != null) {
        result.confirm(handledRet);
    } else {
        dialogsHelper.showPrompt(message, defaultValue, new CordovaDialogsHelper.Result() {
            @Override
            public void gotResult(boolean success, String value) {
                if (success) {
                    result.confirm(value);
                } else {
                    result.cancel();
                }
            }
        });
    }
    return true;
}
 
Example #4
Source File: BridgeWebChromeClient.java    From OsmGo with MIT License 6 votes vote down vote up
/**
 * Show the browser prompt modal
 * @param view
 * @param url
 * @param message
 * @param defaultValue
 * @param result
 * @return
 */
@Override
public boolean onJsPrompt(WebView view, String url, String message, String defaultValue, final JsPromptResult result) {
  if (bridge.getActivity().isFinishing()) {
    return true;
  }

  Dialogs.prompt(view.getContext(), message, new Dialogs.OnResultListener() {
    @Override
    public void onResult(boolean value, boolean didCancel, String inputValue) {
      if(value) {
        result.confirm(inputValue);
      } else {
        result.cancel();
      }
    }
  });

  return true;
}
 
Example #5
Source File: SystemWebChromeClient.java    From app-icon with MIT License 6 votes vote down vote up
/**
 * Tell the client to display a prompt dialog to the user.
 * If the client returns true, WebView will assume that the client will
 * handle the prompt dialog and call the appropriate JsPromptResult method.
 *
 * Since we are hacking prompts for our own purposes, we should not be using them for
 * this purpose, perhaps we should hack console.log to do this instead!
 */
@Override
public boolean onJsPrompt(WebView view, String origin, String message, String defaultValue, final JsPromptResult result) {
    // Unlike the @JavascriptInterface bridge, this method is always called on the UI thread.
    String handledRet = parentEngine.bridge.promptOnJsPrompt(origin, message, defaultValue);
    if (handledRet != null) {
        result.confirm(handledRet);
    } else {
        dialogsHelper.showPrompt(message, defaultValue, new CordovaDialogsHelper.Result() {
            @Override
            public void gotResult(boolean success, String value) {
                if (success) {
                    result.confirm(value);
                } else {
                    result.cancel();
                }
            }
        });
    }
    return true;
}
 
Example #6
Source File: WebPlayerView.java    From unity-ads-android with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onJsPrompt(WebView view, String url, String message, String defaultValue, JsPromptResult result) {
	Boolean returnValue = false;

	if (shouldCallSuper("onJsPrompt")) {
		returnValue = super.onJsPrompt(view, url, message, defaultValue, result);
	}
	if (shouldSendEvent("onJsPrompt")) {
		WebViewApp.getCurrentApp().sendEvent(WebViewEventCategory.WEBPLAYER, WebPlayerEvent.JS_PROMPT, url, message, defaultValue, viewId);
	}
	if (hasReturnValue("onJsPrompt")) {
		returnValue = getReturnValue("onJsPrompt", java.lang.Boolean.class, true);
	}

	return returnValue;
}
 
Example #7
Source File: MainActivity.java    From SimplicityBrowser with MIT License 6 votes vote down vote up
@Override
public boolean onJsPrompt(WebView view, String url, final String message, final String defaultValue, final JsPromptResult result) {
    if (!isDestroyed()) {
        AlertDialog.Builder builder1 = new AlertDialog.Builder(MainActivity.this);
        builder1.setTitle(message);
        builder1.setCancelable(true);
        builder1.setPositiveButton(R.string.ok, (dialog, id) -> {
            result.confirm();
            dialog.dismiss();
        });
        builder1.setNegativeButton(R.string.cancel, (dialog, id) -> {
            result.cancel();
            dialog.dismiss();
        });
        AlertDialog alert11 = builder1.create();
        alert11.show();
    }
    return true;

}
 
Example #8
Source File: SystemWebChromeClient.java    From cordova-plugin-app-update-demo with MIT License 6 votes vote down vote up
/**
 * Tell the client to display a prompt dialog to the user.
 * If the client returns true, WebView will assume that the client will
 * handle the prompt dialog and call the appropriate JsPromptResult method.
 *
 * Since we are hacking prompts for our own purposes, we should not be using them for
 * this purpose, perhaps we should hack console.log to do this instead!
 */
@Override
public boolean onJsPrompt(WebView view, String origin, String message, String defaultValue, final JsPromptResult result) {
    // Unlike the @JavascriptInterface bridge, this method is always called on the UI thread.
    String handledRet = parentEngine.bridge.promptOnJsPrompt(origin, message, defaultValue);
    if (handledRet != null) {
        result.confirm(handledRet);
    } else {
        dialogsHelper.showPrompt(message, defaultValue, new CordovaDialogsHelper.Result() {
            @Override
            public void gotResult(boolean success, String value) {
                if (success) {
                    result.confirm(value);
                } else {
                    result.cancel();
                }
            }
        });
    }
    return true;
}
 
Example #9
Source File: WebFragment.java    From Android_framework with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
public boolean onJsPrompt(WebView view, String url, String message, String defaultValue, final JsPromptResult result) {
    final View v = View.inflate(getActivity(), R.layout.dialog_js_prompt_message_layout, null);
    ((TextView)(v.findViewById(R.id.tv_message))).setText(message);
    ((EditText)(v.findViewById(R.id.et_content))).setText(defaultValue);
    Dialog dialog = DialogCreator.createDialog(null, v, getString(R.string.confirm), getString(R.string.cancel))
            .setOnButtonClickListener(new BaseDialog.ButtonClickListener() {
                @Override
                public void onButtonClick(int button_id) {
                    if (button_id == 0) {
                        result.confirm(((EditText) (v.findViewById(R.id.et_content))).getText().toString());
                    } else {
                        result.cancel();
                    }
                }
            });
    dialog.setCanceledOnTouchOutside(false);
    dialog.show();
    return true;
}
 
Example #10
Source File: PrivateActivity.java    From SimplicityBrowser with MIT License 6 votes vote down vote up
@Override
public boolean onJsPrompt(WebView view, String url, final String message, final String defaultValue, final JsPromptResult result) {
    if (!isDestroyed()) {
        AlertDialog.Builder builder1 = new AlertDialog.Builder(PrivateActivity.this);
        builder1.setTitle(message);
        builder1.setCancelable(true);
        builder1.setPositiveButton(R.string.ok, (dialog, id) -> {
            result.confirm();
            dialog.dismiss();
        });
        builder1.setNegativeButton(R.string.cancel, (dialog, id) -> {
            result.cancel();
            dialog.dismiss();
        });
        AlertDialog alert11 = builder1.create();
        alert11.show();
    }
    return true;

}
 
Example #11
Source File: JsBridgeImpl.java    From JsBridge with Apache License 2.0 6 votes vote down vote up
/**
 * 设置 prompt 回调结果
 *
 * @param promptResult JsPromptResult
 * @param success      bool 是否执行成功
 * @param msg          返回结果
 */
private void setJsPromptResult(Object promptResult, boolean success, Object msg) {
    JSONObject ret = new JSONObject();
    try {
        ret.put("success", success);
        ret.put("msg", msg);
    } catch (JSONException e) {
        e.printStackTrace();
    }
    if (promptResult instanceof JsPromptResult) {
        ((JsPromptResult) promptResult).confirm(ret.toString());
    } else if (promptResult instanceof IPromptResult) {
        ((IPromptResult) promptResult).confirm(ret.toString());
    } else {
        throw new IllegalArgumentException("JsPromptResult Type Error: " + msg);
    }
}
 
Example #12
Source File: SystemWebChromeClient.java    From a2cardboard with Apache License 2.0 6 votes vote down vote up
/**
 * Tell the client to display a prompt dialog to the user.
 * If the client returns true, WebView will assume that the client will
 * handle the prompt dialog and call the appropriate JsPromptResult method.
 *
 * Since we are hacking prompts for our own purposes, we should not be using them for
 * this purpose, perhaps we should hack console.log to do this instead!
 */
@Override
public boolean onJsPrompt(WebView view, String origin, String message, String defaultValue, final JsPromptResult result) {
    // Unlike the @JavascriptInterface bridge, this method is always called on the UI thread.
    String handledRet = parentEngine.bridge.promptOnJsPrompt(origin, message, defaultValue);
    if (handledRet != null) {
        result.confirm(handledRet);
    } else {
        dialogsHelper.showPrompt(message, defaultValue, new CordovaDialogsHelper.Result() {
            @Override
            public void gotResult(boolean success, String value) {
                if (success) {
                    result.confirm(value);
                } else {
                    result.cancel();
                }
            }
        });
    }
    return true;
}
 
Example #13
Source File: SystemWebChromeClient.java    From cordova-plugin-intent with MIT License 6 votes vote down vote up
/**
 * Tell the client to display a prompt dialog to the user.
 * If the client returns true, WebView will assume that the client will
 * handle the prompt dialog and call the appropriate JsPromptResult method.
 *
 * Since we are hacking prompts for our own purposes, we should not be using them for
 * this purpose, perhaps we should hack console.log to do this instead!
 */
@Override
public boolean onJsPrompt(WebView view, String origin, String message, String defaultValue, final JsPromptResult result) {
    // Unlike the @JavascriptInterface bridge, this method is always called on the UI thread.
    String handledRet = parentEngine.bridge.promptOnJsPrompt(origin, message, defaultValue);
    if (handledRet != null) {
        result.confirm(handledRet);
    } else {
        dialogsHelper.showPrompt(message, defaultValue, new CordovaDialogsHelper.Result() {
            @Override
            public void gotResult(boolean success, String value) {
                if (success) {
                    result.confirm(value);
                } else {
                    result.cancel();
                }
            }
        });
    }
    return true;
}
 
Example #14
Source File: SystemWebChromeClient.java    From chappiecast with Mozilla Public License 2.0 6 votes vote down vote up
/**
 * Tell the client to display a prompt dialog to the user.
 * If the client returns true, WebView will assume that the client will
 * handle the prompt dialog and call the appropriate JsPromptResult method.
 *
 * Since we are hacking prompts for our own purposes, we should not be using them for
 * this purpose, perhaps we should hack console.log to do this instead!
 */
@Override
public boolean onJsPrompt(WebView view, String origin, String message, String defaultValue, final JsPromptResult result) {
    // Unlike the @JavascriptInterface bridge, this method is always called on the UI thread.
    String handledRet = parentEngine.bridge.promptOnJsPrompt(origin, message, defaultValue);
    if (handledRet != null) {
        result.confirm(handledRet);
    } else {
        dialogsHelper.showPrompt(message, defaultValue, new CordovaDialogsHelper.Result() {
            @Override
            public void gotResult(boolean success, String value) {
                if (success) {
                    result.confirm(value);
                } else {
                    result.cancel();
                }
            }
        });
    }
    return true;
}
 
Example #15
Source File: SystemWebChromeClient.java    From pychat with MIT License 6 votes vote down vote up
/**
 * Tell the client to display a prompt dialog to the user.
 * If the client returns true, WebView will assume that the client will
 * handle the prompt dialog and call the appropriate JsPromptResult method.
 *
 * Since we are hacking prompts for our own purposes, we should not be using them for
 * this purpose, perhaps we should hack console.log to do this instead!
 */
@Override
public boolean onJsPrompt(WebView view, String origin, String message, String defaultValue, final JsPromptResult result) {
    // Unlike the @JavascriptInterface bridge, this method is always called on the UI thread.
    String handledRet = parentEngine.bridge.promptOnJsPrompt(origin, message, defaultValue);
    if (handledRet != null) {
        result.confirm(handledRet);
    } else {
        dialogsHelper.showPrompt(message, defaultValue, new CordovaDialogsHelper.Result() {
            @Override
            public void gotResult(boolean success, String value) {
                if (success) {
                    result.confirm(value);
                } else {
                    result.cancel();
                }
            }
        });
    }
    return true;
}
 
Example #16
Source File: SystemWebChromeClient.java    From lona with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Tell the client to display a prompt dialog to the user.
 * If the client returns true, WebView will assume that the client will
 * handle the prompt dialog and call the appropriate JsPromptResult method.
 *
 * Since we are hacking prompts for our own purposes, we should not be using them for
 * this purpose, perhaps we should hack console.log to do this instead!
 */
@Override
public boolean onJsPrompt(WebView view, String origin, String message, String defaultValue, final JsPromptResult result) {
    // Unlike the @JavascriptInterface bridge, this method is always called on the UI thread.
    String handledRet = parentEngine.bridge.promptOnJsPrompt(origin, message, defaultValue);
    if (handledRet != null) {
        result.confirm(handledRet);
    } else {
        dialogsHelper.showPrompt(message, defaultValue, new CordovaDialogsHelper.Result() {
            @Override
            public void gotResult(boolean success, String value) {
                if (success) {
                    result.confirm(value);
                } else {
                    result.cancel();
                }
            }
        });
    }
    return true;
}
 
Example #17
Source File: DialogWebChromeClient.java    From EhViewer with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onJsPrompt(WebView view, String url, String message, String defaultValue, JsPromptResult result) {
  LayoutInflater inflater = LayoutInflater.from(context);
  View promptView = inflater.inflate(R.layout.dialog_js_prompt, null, false);
  TextView messageView = promptView.findViewById(R.id.message);
  messageView.setText(message);
  final EditText valueView = promptView.findViewById(R.id.value);
  valueView.setText(defaultValue);

  new AlertDialog.Builder(context)
      .setView(promptView)
      .setPositiveButton(android.R.string.ok, (dialog, which) -> result.confirm(valueView.getText().toString()))
      .setOnCancelListener(dialog -> result.cancel())
      .show();

  return true;
}
 
Example #18
Source File: SystemWebChromeClient.java    From countly-sdk-cordova with MIT License 6 votes vote down vote up
/**
 * Tell the client to display a prompt dialog to the user.
 * If the client returns true, WebView will assume that the client will
 * handle the prompt dialog and call the appropriate JsPromptResult method.
 *
 * Since we are hacking prompts for our own purposes, we should not be using them for
 * this purpose, perhaps we should hack console.log to do this instead!
 */
@Override
public boolean onJsPrompt(WebView view, String origin, String message, String defaultValue, final JsPromptResult result) {
    // Unlike the @JavascriptInterface bridge, this method is always called on the UI thread.
    String handledRet = parentEngine.bridge.promptOnJsPrompt(origin, message, defaultValue);
    if (handledRet != null) {
        result.confirm(handledRet);
    } else {
        dialogsHelper.showPrompt(message, defaultValue, new CordovaDialogsHelper.Result() {
            @Override
            public void gotResult(boolean success, String value) {
                if (success) {
                    result.confirm(value);
                } else {
                    result.cancel();
                }
            }
        });
    }
    return true;
}
 
Example #19
Source File: SystemWebChromeClient.java    From BigDataPlatform with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Tell the client to display a prompt dialog to the user.
 * If the client returns true, WebView will assume that the client will
 * handle the prompt dialog and call the appropriate JsPromptResult method.
 *
 * Since we are hacking prompts for our own purposes, we should not be using them for
 * this purpose, perhaps we should hack console.log to do this instead!
 */
@Override
public boolean onJsPrompt(WebView view, String origin, String message, String defaultValue, final JsPromptResult result) {
    // Unlike the @JavascriptInterface bridge, this method is always called on the UI thread.
    String handledRet = parentEngine.bridge.promptOnJsPrompt(origin, message, defaultValue);
    if (handledRet != null) {
        result.confirm(handledRet);
    } else {
        dialogsHelper.showPrompt(message, defaultValue, new CordovaDialogsHelper.Result() {
            @Override
            public void gotResult(boolean success, String value) {
                if (success) {
                    result.confirm(value);
                } else {
                    result.cancel();
                }
            }
        });
    }
    return true;
}
 
Example #20
Source File: SystemWebChromeClient.java    From xmall with MIT License 6 votes vote down vote up
/**
 * Tell the client to display a prompt dialog to the user.
 * If the client returns true, WebView will assume that the client will
 * handle the prompt dialog and call the appropriate JsPromptResult method.
 *
 * Since we are hacking prompts for our own purposes, we should not be using them for
 * this purpose, perhaps we should hack console.log to do this instead!
 */
@Override
public boolean onJsPrompt(WebView view, String origin, String message, String defaultValue, final JsPromptResult result) {
    // Unlike the @JavascriptInterface bridge, this method is always called on the UI thread.
    String handledRet = parentEngine.bridge.promptOnJsPrompt(origin, message, defaultValue);
    if (handledRet != null) {
        result.confirm(handledRet);
    } else {
        dialogsHelper.showPrompt(message, defaultValue, new CordovaDialogsHelper.Result() {
            @Override
            public void gotResult(boolean success, String value) {
                if (success) {
                    result.confirm(value);
                } else {
                    result.cancel();
                }
            }
        });
    }
    return true;
}
 
Example #21
Source File: DialogWebChromeClient.java    From MHViewer with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onJsPrompt(WebView view, String url, String message, String defaultValue, JsPromptResult result) {
  LayoutInflater inflater = LayoutInflater.from(context);
  View promptView = inflater.inflate(R.layout.dialog_js_prompt, null, false);
  TextView messageView = promptView.findViewById(R.id.message);
  messageView.setText(message);
  final EditText valueView = promptView.findViewById(R.id.value);
  valueView.setText(defaultValue);

  new AlertDialog.Builder(context)
      .setView(promptView)
      .setPositiveButton(android.R.string.ok, (dialog, which) -> result.confirm(valueView.getText().toString()))
      .setOnCancelListener(dialog -> result.cancel())
      .show();

  return true;
}
 
Example #22
Source File: SystemWebChromeClient.java    From ultimate-cordova-webview-app with MIT License 6 votes vote down vote up
/**
 * Tell the client to display a prompt dialog to the user.
 * If the client returns true, WebView will assume that the client will
 * handle the prompt dialog and call the appropriate JsPromptResult method.
 *
 * Since we are hacking prompts for our own purposes, we should not be using them for
 * this purpose, perhaps we should hack console.log to do this instead!
 */
@Override
public boolean onJsPrompt(WebView view, String origin, String message, String defaultValue, final JsPromptResult result) {
    // Unlike the @JavascriptInterface bridge, this method is always called on the UI thread.
    String handledRet = parentEngine.bridge.promptOnJsPrompt(origin, message, defaultValue);
    if (handledRet != null) {
        result.confirm(handledRet);
    } else {
        dialogsHelper.showPrompt(message, defaultValue, new CordovaDialogsHelper.Result() {
            @Override
            public void gotResult(boolean success, String value) {
                if (success) {
                    result.confirm(value);
                } else {
                    result.cancel();
                }
            }
        });
    }
    return true;
}
 
Example #23
Source File: RobotiumWebClient.java    From AndroidRipper with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Overrides onJsPrompt in order to create {@code WebElement} objects based on the web elements attributes prompted by the injections of JavaScript
 */

@Override
public boolean onJsPrompt(WebView view, String url, String message,	String defaultValue, JsPromptResult r) {
	
	if(message != null && (message.contains(";,") || message.contains("robotium-finished"))){

		if(message.equals("robotium-finished")){
			webElementCreator.setFinished(true);
		}
		else{
			webElementCreator.createWebElementAndAddInList(message, view);
		}
		r.confirm();
		return true;
	}
	else {
		if(originalWebChromeClient != null) {
			return originalWebChromeClient.onJsPrompt(view, url, message, defaultValue, r); 
		}
		return true;
	}

}
 
Example #24
Source File: AgentWebView.java    From AgentWeb with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onJsPrompt(WebView view, String url, String message, String defaultValue, JsPromptResult result) {
    Log.i(TAG, "onJsPrompt:" + url + "  message:" + message + "  d:" + defaultValue + "  ");
    if (this.mAgentWebView.mJsCallJavas != null && JsCallJava.isSafeWebViewCallMsg(message)) {
        JSONObject jsonObject = JsCallJava.getMsgJSONObject(message);
        String interfacedName = JsCallJava.getInterfacedName(jsonObject);
        if (interfacedName != null) {
            JsCallJava mJsCallJava = this.mAgentWebView.mJsCallJavas.get(interfacedName);
            if (mJsCallJava != null) {
                result.confirm(mJsCallJava.call(view, jsonObject));
            }
        }
        return true;
    } else {
        return super.onJsPrompt(view, url, message, defaultValue, result);
    }
}
 
Example #25
Source File: WebChromeClientDelegate.java    From AgentWeb with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onJsPrompt(WebView view, String url, String message,
                          String defaultValue, JsPromptResult result) {
    if (this.mDelegate != null) {
        return this.mDelegate.onJsPrompt(view, url, message, defaultValue, result);
    }
    return super.onJsPrompt(view, url, message, defaultValue, result);
}
 
Example #26
Source File: PopWebViewChromeClient.java    From PoupoLayer with MIT License 5 votes vote down vote up
@Override
public boolean onJsPrompt(WebView view, String url, String message, String defaultValue, JsPromptResult result) {
    String postJson=message.replaceAll("\\\\", "");//格式化字符串
    if (!TextUtils.isEmpty(postJson)) {
        if(mHybirdImpl!=null){
            mHybirdImpl.invokeAppServices(postJson);
        }
        //防止prompt阻塞交互
        result.confirm();
        return true;
    }
    return super.onJsPrompt(view, url, message, defaultValue, result);
}
 
Example #27
Source File: CBrowserMainFrame.java    From appcan-android with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void appCanJsParse(final JsPromptResult result, WebView view, String parseStr) {
    try {
        if (!(view instanceof EBrowserView)) {
            return;
        }
        EBrowserView browserView = (EBrowserView) view;
        final EUExManager uexManager = browserView.getEUExManager();
        if (uexManager != null) {
             result.confirm(uexManager.dispatch(parseStr));
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example #28
Source File: KCWebChromeClient.java    From kerkee_android with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onJsPrompt(WebView view, String url, String message, String defaultValue, JsPromptResult result)
{
	if(view instanceof KCWebView) {
		result.confirm(KCApiBridge.callNative((KCWebView) view, message));
	}
    return true;

}
 
Example #29
Source File: SafeWebChromeClient.java    From JianshuApp with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onJsPrompt(WebView view, String url, String message, String defaultValue, JsPromptResult result) {
    if (mJsCallJava != null) {
        result.confirm(mJsCallJava.call(view, message));
    }
    return true;
}
 
Example #30
Source File: MobclickAgentJSInterface.java    From letv with Apache License 2.0 5 votes vote down vote up
public boolean onJsPrompt(WebView webView, String str, String str2, String str3, JsPromptResult jsPromptResult) {
    if ("ekv".equals(str2)) {
        try {
            JSONObject jSONObject = new JSONObject(str3);
            Map hashMap = new HashMap();
            String str4 = (String) jSONObject.remove("id");
            int intValue = jSONObject.isNull(DownloadVideoTable.COLUMN_DURATION) ? 0 : ((Integer) jSONObject.remove(DownloadVideoTable.COLUMN_DURATION)).intValue();
            Iterator keys = jSONObject.keys();
            while (keys.hasNext()) {
                String str5 = (String) keys.next();
                hashMap.put(str5, jSONObject.getString(str5));
            }
            MobclickAgent.getAgent().a(this.b.a, str4, hashMap, (long) intValue);
        } catch (Exception e) {
            e.printStackTrace();
        }
    } else if (!NotificationCompat.CATEGORY_EVENT.equals(str2)) {
        return this.a.onJsPrompt(webView, str, str2, str3, jsPromptResult);
    } else {
        try {
            JSONObject jSONObject2 = new JSONObject(str3);
            String optString = jSONObject2.optString("label");
            if ("".equals(optString)) {
                optString = null;
            }
            MobclickAgent.getAgent().a(this.b.a, jSONObject2.getString("tag"), optString, (long) jSONObject2.optInt(DownloadVideoTable.COLUMN_DURATION), 1);
        } catch (Exception e2) {
        }
    }
    jsPromptResult.confirm();
    return true;
}