當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。