Java Code Examples for android.webkit.JsPromptResult#confirm()
The following examples show how to use
android.webkit.JsPromptResult#confirm() .
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: SystemWebChromeClient.java From BigDataPlatform with GNU General Public License v3.0 | 6 votes |
/** * 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 2
Source File: SystemWebChromeClient.java From chappiecast with Mozilla Public License 2.0 | 6 votes |
/** * 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 cordova-plugin-intent with MIT License | 6 votes |
/** * 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: SystemWebChromeClient.java From a2cardboard with Apache License 2.0 | 6 votes |
/** * 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 5
Source File: SystemWebChromeClient.java From cordova-plugin-app-update-demo with MIT License | 6 votes |
/** * 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: SystemWebChromeClient.java From countly-sdk-cordova with MIT License | 6 votes |
/** * 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 7
Source File: SystemWebChromeClient.java From app-icon with MIT License | 6 votes |
/** * 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 8
Source File: SystemWebChromeClient.java From keemob with MIT License | 6 votes |
/** * 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: SystemWebChromeClient.java From keemob with MIT License | 6 votes |
/** * 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 10
Source File: SystemWebChromeClient.java From lona with GNU General Public License v3.0 | 6 votes |
/** * 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 11
Source File: RobotiumWebClient.java From AndroidRipper with GNU Affero General Public License v3.0 | 6 votes |
/** * 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 12
Source File: AgentWebView.java From AgentWeb with Apache License 2.0 | 6 votes |
@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 13
Source File: SystemWebChromeClient.java From ultimate-cordova-webview-app with MIT License | 6 votes |
/** * 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 xmall with MIT License | 6 votes |
/** * 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: MobclickAgentJSInterface.java From letv with Apache License 2.0 | 5 votes |
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; }
Example 16
Source File: KCWebChromeClient.java From kerkee_android with GNU General Public License v3.0 | 5 votes |
@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 17
Source File: CBrowserMainFrame.java From appcan-android with GNU Lesser General Public License v3.0 | 5 votes |
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 18
Source File: NoteDetailsActivity.java From DevHeadLine with Apache License 2.0 | 4 votes |
@Override public boolean onJsPrompt(WebView view, String url, String message, String defaultValue, JsPromptResult result) { result.confirm(); return super.onJsPrompt(view, url, message, message, result); }
Example 19
Source File: InAppBrowser.java From cordova-android-chromeview with Apache License 2.0 | 4 votes |
/** * 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. * * The prompt bridge provided for the InAppBrowser is capable of executing any * oustanding callback belonging to the InAppBrowser plugin. Care has been * taken that other callbacks cannot be triggered, and that no other code * execution is possible. * * To trigger the bridge, the prompt default value should be of the form: * * gap-iab://<callbackId> * * where <callbackId> is the string id of the callback to trigger (something * like "InAppBrowser0123456789") * * If present, the prompt message is expected to be a JSON-encoded value to * pass to the callback. A JSON_EXCEPTION is returned if the JSON is invalid. * * @param view * @param url * @param message * @param defaultValue * @param result */ @Override public boolean onJsPrompt(WebView view, String url, String message, String defaultValue, JsPromptResult result) { // See if the prompt string uses the 'gap-iab' protocol. If so, the remainder should be the id of a callback to execute. if (defaultValue != null && defaultValue.startsWith("gap-iab://")) { PluginResult scriptResult; String scriptCallbackId = defaultValue.substring(10); if (scriptCallbackId.startsWith("InAppBrowser")) { if(message == null || message.length() == 0) { scriptResult = new PluginResult(PluginResult.Status.OK, new JSONArray()); } else { try { scriptResult = new PluginResult(PluginResult.Status.OK, new JSONArray(message)); } catch(JSONException e) { scriptResult = new PluginResult(PluginResult.Status.JSON_EXCEPTION, e.getMessage()); } } this.webView.sendPluginResult(scriptResult, scriptCallbackId); result.confirm(""); return true; } } return false; }
Example 20
Source File: QuickWebChromeClient.java From quickhybrid-android with BSD 3-Clause "New" or "Revised" License | 2 votes |
/** * JSBridge协议入口 * * @param view * @param url * @param message * @param defaultValue * @param result * @return */ @Override public boolean onJsPrompt(WebView view, String url, String message, String defaultValue, JsPromptResult result) { result.confirm(JSBridge.callJava(loadPage.getFragment(), message,loadPage.hasConfig())); return true; }