org.apache.cordova.CordovaDialogsHelper Java Examples

The following examples show how to use org.apache.cordova.CordovaDialogsHelper. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SystemWebChromeClient.java    From countly-sdk-cordova with MIT License 6 votes vote down vote up
/**
 * 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;
}
 
Example #2
Source File: SystemWebChromeClient.java    From a2cardboard with Apache License 2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #3
Source File: SystemWebChromeClient.java    From keemob with MIT License 6 votes vote down vote up
/**
 * 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;
}
 
Example #4
Source File: SystemWebChromeClient.java    From cordova-plugin-intent with MIT License 6 votes vote down vote up
/**
 * 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;
}
 
Example #5
Source File: SystemWebChromeClient.java    From keemob with MIT License 6 votes vote down vote up
/**
 * 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;
}
 
Example #6
Source File: X5WebChromeClient.java    From cordova-plugin-x5-webview with Apache License 2.0 6 votes vote down vote up
/**
 * 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!
 */
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;
}
 
Example #7
Source File: SystemWebChromeClient.java    From chappiecast with Mozilla Public License 2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #8
Source File: SystemWebChromeClient.java    From cordova-plugin-app-update-demo with MIT License 6 votes vote down vote up
/**
 * 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;
}
 
Example #9
Source File: X5WebChromeClient.java    From x5webview-cordova-plugin with Apache License 2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #10
Source File: SystemWebChromeClient.java    From pychat with MIT License 6 votes vote down vote up
/**
 * 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;
}
 
Example #11
Source File: X5WebChromeClient.java    From cordova-plugin-x5-tbs with Apache License 2.0 6 votes vote down vote up
/**
 * 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.
 * <p>
 * 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;
}
 
Example #12
Source File: SystemWebChromeClient.java    From ultimate-cordova-webview-app with MIT License 6 votes vote down vote up
/**
 * 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;
}
 
Example #13
Source File: XWalkCordovaUiClient.java    From cordova-crosswalk-engine with Apache License 2.0 6 votes vote down vote up
/**
 * 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.
 * <p/>
 * 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!
 */
public boolean onJsPrompt(XWalkView view, String origin, String message, String defaultValue,
                           final XWalkJavascriptResult 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.confirmWithResult(handledRet);
    } else {
        dialogsHelper.showPrompt(message, defaultValue, new CordovaDialogsHelper.Result() {
            @Override
            public void gotResult(boolean success, String value) {
                if (success) {
                    result.confirmWithResult(value);
                } else {
                    result.cancel();
                }
            }
        });

    }
    return true;
}
 
Example #14
Source File: X5WebChromeClient.java    From cordova-plugin-x5engine-webview with Apache License 2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #15
Source File: SystemWebChromeClient.java    From xmall with MIT License 6 votes vote down vote up
/**
 * 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;
}
 
Example #16
Source File: SystemWebChromeClient.java    From lona with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #17
Source File: SystemWebChromeClient.java    From app-icon with MIT License 6 votes vote down vote up
/**
 * 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;
}
 
Example #18
Source File: SystemWebChromeClient.java    From BigDataPlatform with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #19
Source File: SystemWebChromeClient.java    From countly-sdk-cordova with MIT License 5 votes vote down vote up
/**
 * 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;
}
 
Example #20
Source File: XWalkCordovaUiClient.java    From cordova-crosswalk-engine with Apache License 2.0 5 votes vote down vote up
/**
 * Tell the client to display a javascript alert dialog.
 */
public boolean onJsAlert(XWalkView view, String url, String message,
                          final XWalkJavascriptResult result) {
    dialogsHelper.showAlert(message, new CordovaDialogsHelper.Result() {
        @Override
        public void gotResult(boolean success, String value) {
            if (success) {
                result.confirm();
            } else {
                result.cancel();
            }
        }
    });
    return true;
}
 
Example #21
Source File: SystemWebChromeClient.java    From lona with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #22
Source File: XWalkCordovaUiClient.java    From cordova-crosswalk-engine with Apache License 2.0 5 votes vote down vote up
/**
 * Tell the client to display a confirm dialog to the user.
 */
public boolean onJsConfirm(XWalkView view, String url, String message,
                            final XWalkJavascriptResult result) {
    dialogsHelper.showConfirm(message, new CordovaDialogsHelper.Result() {
        @Override
        public void gotResult(boolean success, String value) {
            if (success) {
                result.confirm();
            } else {
                result.cancel();
            }
        }
    });
    return true;
}
 
Example #23
Source File: SystemWebChromeClient.java    From lona with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #24
Source File: X5WebChromeClient.java    From cordova-plugin-x5engine-webview with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #25
Source File: SystemWebChromeClient.java    From BigDataPlatform with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #26
Source File: SystemWebChromeClient.java    From a2cardboard with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #27
Source File: SystemWebChromeClient.java    From a2cardboard with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #28
Source File: X5WebChromeClient.java    From cordova-plugin-x5engine-webview with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #29
Source File: SystemWebChromeClient.java    From cordova-plugin-app-update-demo with MIT License 5 votes vote down vote up
/**
 * 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;
}
 
Example #30
Source File: SystemWebChromeClient.java    From cordova-plugin-app-update-demo with MIT License 5 votes vote down vote up
/**
 * 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;
}