当前位置: 首页>>代码示例>>Java>>正文


Java JsPromptResult类代码示例

本文整理汇总了Java中android.webkit.JsPromptResult的典型用法代码示例。如果您正苦于以下问题:Java JsPromptResult类的具体用法?Java JsPromptResult怎么用?Java JsPromptResult使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


JsPromptResult类属于android.webkit包,在下文中一共展示了JsPromptResult类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:33,代码来源:MobclickAgentJSInterface.java

示例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;
}
 
开发者ID:Andy-Ta,项目名称:COB,代码行数:29,代码来源:SystemWebChromeClient.java

示例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;
    }

}
 
开发者ID:Justson,项目名称:AgentWeb,代码行数:19,代码来源:AgentWebView.java

示例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;
}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:17,代码来源:JavaScriptWebView.java

示例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;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:37,代码来源:MobclickAgentJSInterface.java

示例6: 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;
}
 
开发者ID:gnosygnu,项目名称:xowa_android,代码行数:18,代码来源:CommunicationBridge.java

示例7: onJsPrompt

import android.webkit.JsPromptResult; //导入依赖的package包/类
@Override
public boolean onJsPrompt(WebView view, String url, String message, String defaultValue,
        final JsPromptResult jsPromptResult)
{
    return onMyJsPrompt(WEBViewImpl.toWEBView(view), url, message, defaultValue, new MyJsPromptResult()
    {
        @Override
        public void confirm(String result)
        {
            jsPromptResult.confirm(result);
        }

        @Override
        public void cancel()
        {
            jsPromptResult.cancel();
        }

        @Override
        public void confirm()
        {
            jsPromptResult.confirm();
        }
    });
}
 
开发者ID:CLovinr,项目名称:Android-JS-Inject,代码行数:26,代码来源:WEBChromeClient.java

示例8: 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);
}
 
开发者ID:yyter,项目名称:SafeWebView,代码行数:21,代码来源:SafeWebView.java

示例9: 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;
	}

}
 
开发者ID:IfengAutomation,项目名称:test_agent_android,代码行数:27,代码来源:RobotiumWebClient.java

示例10: onJsPrompt

import android.webkit.JsPromptResult; //导入依赖的package包/类
@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;
}
 
开发者ID:zhaozepeng,项目名称:Android_framework,代码行数:21,代码来源:WebFragment.java


注:本文中的android.webkit.JsPromptResult类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。