本文整理匯總了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;
}
示例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;
}
示例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;
}
示例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();
}
});
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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();
}
示例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();
}
示例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);
}
}
示例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);
}
}
示例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);
}
}