当前位置: 首页>>代码示例>>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;未经允许,请勿转载。