本文整理汇总了Java中android.webkit.JsPromptResult.confirm方法的典型用法代码示例。如果您正苦于以下问题:Java JsPromptResult.confirm方法的具体用法?Java JsPromptResult.confirm怎么用?Java JsPromptResult.confirm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.webkit.JsPromptResult
的用法示例。
在下文中一共展示了JsPromptResult.confirm方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onJsPrompt
import android.webkit.JsPromptResult; //导入方法依赖的package包/类
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;
}
示例2: onJsPrompt
import android.webkit.JsPromptResult; //导入方法依赖的package包/类
/**
* 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;
}
示例3: onJsPrompt
import android.webkit.JsPromptResult; //导入方法依赖的package包/类
@Override
public boolean onJsPrompt(WebView view, String url, String message, String defaultValue, JsPromptResult result) {
Log.i(TAG,"onJsPrompt:"+url+" message:"+message+" d:"+defaultValue+" ");
if (mJsCallJavas != null && JsCallJava.isSafeWebViewCallMsg(message)) {
JSONObject jsonObject = JsCallJava.getMsgJSONObject(message);
String interfacedName = JsCallJava.getInterfacedName(jsonObject);
if (interfacedName != null) {
JsCallJava jsCallJava = mJsCallJavas.get(interfacedName);
if (jsCallJava != null) {
result.confirm(jsCallJava.call(view, jsonObject));
}
}
return true;
} else {
return false;
}
}
示例4: onJsPrompt
import android.webkit.JsPromptResult; //导入方法依赖的package包/类
@Override
public boolean onJsPrompt(
WebView view,
String url,
String message,
String defaultValue,
JsPromptResult result)
{
// Need to set a result.
result.confirm("ok");
// Hard-coded to test performance of prompt.
callJS("PromptCallback()");
return true;
}
示例5: onJsPrompt
import android.webkit.JsPromptResult; //导入方法依赖的package包/类
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(SportRecordDao.DURATION) ? 0 : ((Integer)
jSONObject.remove(SportRecordDao.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 (!"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(DownloadService
.EXTRA_TAG), optString, (long) jSONObject2.optInt(SportRecordDao
.DURATION), 1);
} catch (Exception e2) {
}
}
jsPromptResult.confirm();
return true;
}
示例6: onJsPrompt
import android.webkit.JsPromptResult; //导入方法依赖的package包/类
@Override
public boolean onJsPrompt(WebView view, String url, String message, String defaultValue, JsPromptResult result) {
if (message != null && message.startsWith(JSINVOKER_PREFIX)) {
//invoke java method
String javaStatement = message.substring(JSINVOKER_PREFIX.length());
try {
Object r = jsInvoker.invoke(javaStatement);
if (r != null) {
result.confirm(r.toString());
} else {
result.confirm();
}
} catch (JsInvoker.SyntaxException e) {
e.printStackTrace();
result.cancel();
}
return true;
}
return client != null && client.onJsPrompt(view, url, message, defaultValue, result);
}
示例7: onJsPrompt
import android.webkit.JsPromptResult; //导入方法依赖的package包/类
/**
* 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;
}
}
示例8: onJsPrompt
import android.webkit.JsPromptResult; //导入方法依赖的package包/类
/** 拦截JS信息,然后把信息发送给上层回调 */
@Override
public boolean onJsPrompt(WebView view, String url, String message,
String defaultValue, JsPromptResult result) {
/** 如果prompt以gap-iab://开头,则向JS发送回调 */
if (defaultValue != null && defaultValue.startsWith(TAG_XFACE_IAP)) {
XExtensionResult scriptResult;
String scriptCallbackId = defaultValue.substring(TAG_XFACE_IAP.length());
if (scriptCallbackId.startsWith("InAppBrowser")) {
if (message == null || message.length() == 0) {
scriptResult = new XExtensionResult(XExtensionResult.Status.OK, new JSONArray());
} else {
try {
scriptResult = new XExtensionResult(XExtensionResult.Status.OK, new JSONArray(message));
} catch (JSONException e) {
scriptResult = new XExtensionResult(XExtensionResult.Status.JSON_EXCEPTION,e.getMessage());
}
}
callbackCtx.sendExtensionResult(scriptResult);
result.confirm("");
return true;
}
}
return false;
}
示例9: onJsPrompt
import android.webkit.JsPromptResult; //导入方法依赖的package包/类
@Override
public boolean onJsPrompt(WebView view, String url, String message, String defaultValue, JsPromptResult result) {
try {
// If incomingMessageHandler is null, it means that we've been cleaned up, but we're
// still receiving some final messages from the WebView, so we'll just ignore them.
// But we should still return true and "confirm" the JsPromptResult down below.
if (incomingMessageHandler != null) {
JSONObject messagePack = new JSONObject(decodeURL(message));
Message msg = Message.obtain(incomingMessageHandler, MESSAGE_HANDLE_MESSAGE_FROM_JS, messagePack);
incomingMessageHandler.sendMessage(msg);
}
} catch (JSONException e) {
throw new RuntimeException(e);
}
result.confirm();
return true;
}
示例10: onJsPrompt
import android.webkit.JsPromptResult; //导入方法依赖的package包/类
@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;
}
示例11: onJsPrompt
import android.webkit.JsPromptResult; //导入方法依赖的package包/类
/**
* 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")) {
if(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;
}
}
else
{
// Anything else with a gap: prefix should get this message
LOG.w(LOG_TAG, "InAppBrowser does not support Cordova API calls: " + url + " " + defaultValue);
result.cancel();
return true;
}
}
return false;
}
示例12: onJsPrompt
import android.webkit.JsPromptResult; //导入方法依赖的package包/类
/**
* 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 ThemeableBrowser is capable of executing any
* oustanding callback belonging to the ThemeableBrowser 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 "ThemeableBrowser0123456789")
*
* 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")) {
if(defaultValue.startsWith("gap-iab://")) {
PluginResult scriptResult;
String scriptCallbackId = defaultValue.substring(10);
if (scriptCallbackId.startsWith("ThemeableBrowser")) {
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;
}
}
else
{
// Anything else with a gap: prefix should get this message
LOG.w(LOG_TAG, "ThemeableBrowser does not support Cordova API calls: " + url + " " + defaultValue);
result.cancel();
return true;
}
}
return false;
}
示例13: onJsPrompt
import android.webkit.JsPromptResult; //导入方法依赖的package包/类
/**
* 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 OverAppBrowser is capable of executing any
* oustanding callback belonging to the OverAppBrowser 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")) {
if(defaultValue.startsWith("gap-iab://")) {
PluginResult scriptResult;
String scriptCallbackId = defaultValue.substring(10);
if (scriptCallbackId.startsWith("OverAppBrowser")) {
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;
}
}
else
{
// Anything else with a gap: prefix should get this message
LOG.w(LOG_TAG, "OverAppBrowser does not support Cordova API calls: " + url + " " + defaultValue);
result.cancel();
return true;
}
}
return false;
}
示例14: appCanJsParse
import android.webkit.JsPromptResult; //导入方法依赖的package包/类
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();
}
}
示例15: onJsPrompt
import android.webkit.JsPromptResult; //导入方法依赖的package包/类
@Override
public boolean onJsPrompt(WebView view, String url, String message, String defaultValue, JsPromptResult result) {
result.confirm(mJsCallJava.call(view, message));
return true;
}