當前位置: 首頁>>代碼示例>>Java>>正文


Java JsResult類代碼示例

本文整理匯總了Java中android.webkit.JsResult的典型用法代碼示例。如果您正苦於以下問題:Java JsResult類的具體用法?Java JsResult怎麽用?Java JsResult使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


JsResult類屬於android.webkit包,在下文中一共展示了JsResult類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onJsAlert

import android.webkit.JsResult; //導入依賴的package包/類
@Override
public boolean onJsAlert(WebView view, String url, String message, final JsResult result) {
    new AlertDialog.Builder(view.getContext())
            .setCancelable(false)
            .setMessage(message)
            .setPositiveButton("確定", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    result.confirm();
                    dialog.dismiss();
                }
            })
            .create()
            .show();
    return true;
}
 
開發者ID:chendongMarch,項目名稱:uikit,代碼行數:17,代碼來源:XWebChromeClient.java

示例2: onJsAlert

import android.webkit.JsResult; //導入依賴的package包/類
@Override
public boolean onJsAlert(final WebView view, final String url, final String message, final JsResult result)
{
  new AlertDialog.Builder(m_activity)
    .setTitle("Alert")
    .setMessage(message)
    .setPositiveButton(android.R.string.ok,
      new AlertDialog.OnClickListener()
      {
        @Override
        public void onClick(DialogInterface dialog, int which)
        {
          result.confirm();
        }
      })
    .setCancelable(false)
    .create()
    .show();
  return true;
}
 
開發者ID:SOASTA,項目名稱:touchtestweb-android,代碼行數:21,代碼來源:SimpleWebChromeClient.java

示例3: onJsConfirm

import android.webkit.JsResult; //導入依賴的package包/類
@Override
    public boolean onJsConfirm(WebView view, String url, String message, JsResult result) {

        LogUtils.i(TAG, "onJsConfirm:" + message);
        if (AgentWebUtils.isOverriedMethod(mWebChromeClient, "onJsConfirm", "public boolean " + ChromePath + ".onJsConfirm", WebView.class, String.class, String.class, JsResult.class)) {

            return super.onJsConfirm(view, url, message, result);
        }


        LogUtils.i(TAG, "mAgentWebUiController:" + mAgentWebUiController.get());
        if (mAgentWebUiController.get() != null) {
            mAgentWebUiController.get().onJsConfirm(view, url, message, result);
        }
//        showJsConfirm(message, result);
        return true;
    }
 
開發者ID:Justson,項目名稱:AgentWeb,代碼行數:18,代碼來源:DefaultChromeClient.java

示例4: onJsAlert

import android.webkit.JsResult; //導入依賴的package包/類
@Override
public boolean onJsAlert(WebView view, String url, String message, final JsResult result)
{
    return onMyJsAlert(WEBViewImpl.toWEBView(view), url, message, new MyJsResult()
    {

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

        @Override
        public void confirm()
        {
            result.confirm();
        }


    });
}
 
開發者ID:CLovinr,項目名稱:Android-JS-Inject,代碼行數:22,代碼來源:WEBChromeClient.java

示例5: onJsAlert

import android.webkit.JsResult; //導入依賴的package包/類
@Override
public boolean onJsAlert(WebView view, String url, String message,
		final JsResult result) {
	AlertDialog.Builder dlg = new AlertDialog.Builder(ctx);
	dlg.setMessage(message);
	dlg.setTitle("提示");
	// dlg.setTitle(null);
	dlg.setCancelable(false);
	dlg.setPositiveButton(android.R.string.ok,
			new AlertDialog.OnClickListener() {
				public void onClick(DialogInterface dialog, int which) {
					result.confirm();
				}
			});
	dlg.create();
	dlg.show();
	return true;
}
 
開發者ID:cowthan,項目名稱:AyoSunny,代碼行數:19,代碼來源:MyWebViewActivity.java

示例6: onJsAlert

import android.webkit.JsResult; //導入依賴的package包/類
/**
 * Tell the client to display a javascript alert dialog.
 */
@Override
public boolean onJsAlert(WebView view, String url, String message, final JsResult result) {
    dialogsHelper.showAlert(message, new CordovaDialogsHelper.Result() {
        @Override public void gotResult(boolean success, String value) {
            if (success) {
                result.confirm();
            } else {
                result.cancel();
            }
        }
    });
    return true;
}
 
開發者ID:Andy-Ta,項目名稱:COB,代碼行數:17,代碼來源:SystemWebChromeClient.java

示例7: onJsConfirm

import android.webkit.JsResult; //導入依賴的package包/類
/**
 * Tell the client to display a confirm dialog to the user.
 */
@Override
public boolean onJsConfirm(WebView view, String url, String message, final JsResult result) {
    dialogsHelper.showConfirm(message, new CordovaDialogsHelper.Result() {
        @Override
        public void gotResult(boolean success, String value) {
            if (success) {
                result.confirm();
            } else {
                result.cancel();
            }
        }
    });
    return true;
}
 
開發者ID:Andy-Ta,項目名稱:COB,代碼行數:18,代碼來源:SystemWebChromeClient.java

示例8: setupWebView

import android.webkit.JsResult; //導入依賴的package包/類
@SuppressLint("SetJavaScriptEnabled")
private void setupWebView() {

  progressBar.spin();

  final WebSettings webSettings = mWebView.getSettings();
  webSettings.setJavaScriptEnabled(true);
  webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
  webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE);
  webSettings.setDomStorageEnabled(true);
  webSettings.setGeolocationEnabled(true);
  webSettings.setUseWideViewPort(true);
  webSettings.setLoadWithOverviewMode(true);
  mWebView.getSettings().setBlockNetworkImage(true);
  mWebView.setWebViewClient(webViewClient);
  mWebView.requestFocus(View.FOCUS_DOWN);
  mWebView.getSettings().setDefaultTextEncodingName("UTF-8");
  mWebView.setWebChromeClient(new WebChromeClient() {

    @Override
    public boolean onJsAlert(WebView view, String url, String message, final JsResult result) {

      AlertDialog.Builder b2 = new AlertDialog
          .Builder(BrowserActivity.this)
          .setTitle(R.string.app_name)
          .setMessage(message)
          .setPositiveButton("確定", (dialog, which) -> result.confirm());

      b2.setCancelable(false);
      b2.create();
      b2.show();
      return true;
    }
  });
  mWebView.loadUrl(url);
}
 
開發者ID:MUFCRyan,項目名稱:BilibiliClient,代碼行數:37,代碼來源:BrowserActivity.java

示例9: onJsAlert

import android.webkit.JsResult; //導入依賴的package包/類
@Override
public boolean onJsAlert(WebView view, String url, String message, final JsResult result) {
    new ThemeColorMaterialDialogBuilder(getContext())
            .title(R.string.text_alert)
            .content(message)
            .onPositive((dialog, which) -> result.confirm())
            .cancelListener(dialog -> result.cancel())
            .positiveText(R.string.ok)
            .show();
    return true;
}
 
開發者ID:hyb1996,項目名稱:Auto.js,代碼行數:12,代碼來源:CodeMirrorEditor.java

示例10: onJsAlert

import android.webkit.JsResult; //導入依賴的package包/類
@Override
public boolean onJsAlert(
	WebView view,
	String url,
	String message,
	JsResult result)
{
    // Display alert as a Toast.
	Toast.makeText(
		view.getContext(),
		message,
		Toast.LENGTH_SHORT).show();
	result.confirm();
	return true;
}
 
開發者ID:sdrausty,項目名稱:buildAPKsApps,代碼行數:16,代碼來源:JavaScriptWebView.java

示例11: showAlert

import android.webkit.JsResult; //導入依賴的package包/類
private void showAlert(WebView view, String url, String message, final JsResult result) {
    AlertDialog.Builder builder = new AlertDialog.Builder(this)
            .setTitle("")
            .setMessage(message)
            .setPositiveButton(getString(R.string.confirm), (dialog, which) -> {
                result.confirm();
                dialog.dismiss();
            }).setOnCancelListener(dialog -> result.cancel());
    builder.show();
}
 
開發者ID:Jusenr,項目名稱:AppFirCloud,代碼行數:11,代碼來源:WebViewActivity.java

示例12: JsAlert

import android.webkit.JsResult; //導入依賴的package包/類
protected void JsAlert(WebView view, String url, String message, final JsResult result) {
    AlertDialog.Builder builderAlert = new AlertDialog.Builder(BaseWebActivity.this)
            .setTitle("")
            .setMessage(message)
            .setPositiveButton("ok", new AlertDialog.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    result.confirm();
                }
            });

    builderAlert.setCancelable(false);
    builderAlert.create();
    builderAlert.show();
}
 
開發者ID:AlpacaNotSheep,項目名稱:hybrid,代碼行數:16,代碼來源:BaseWebActivity.java

示例13: onJsAlert

import android.webkit.JsResult; //導入依賴的package包/類
@Override
public boolean onJsAlert(WebView view, String url, String message, JsResult result) {
    if (originalWebChromeClient != null) {
        return originalWebChromeClient.onJsAlert(view, url, message, result);
    } else {
        return super.onJsAlert(view, url, message, result);
    }
}
 
開發者ID:bitbar,項目名稱:robotium-extensions,代碼行數:9,代碼來源:ProxyWebChromeClient.java

示例14: onJsBeforeUnload

import android.webkit.JsResult; //導入依賴的package包/類
@Override
public boolean onJsBeforeUnload(WebView view, String url, String message, JsResult result) {
    if (originalWebChromeClient.onJsBeforeUnload(view, url, message, result)) {
        return originalWebChromeClient.onJsBeforeUnload(view, url, message, result);
    } else {
        return super.onJsBeforeUnload(view, url, message, result);
    }
}
 
開發者ID:bitbar,項目名稱:robotium-extensions,代碼行數:9,代碼來源:ProxyWebChromeClient.java

示例15: onJsConfirm

import android.webkit.JsResult; //導入依賴的package包/類
@Override
public boolean onJsConfirm(WebView view, String url, String message, JsResult result) {
    if (originalWebChromeClient != null) {
        return originalWebChromeClient.onJsConfirm(view, url, message, result);
    } else {
        return super.onJsConfirm(view, url, message, result);
    }
}
 
開發者ID:bitbar,項目名稱:robotium-extensions,代碼行數:9,代碼來源:ProxyWebChromeClient.java


注:本文中的android.webkit.JsResult類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。