Search in sources :

Example 1 with LoginWithCaptchaRequiredException

use of com.newsrob.LoginWithCaptchaRequiredException in project newsrob by marianokamp.

the class LoginParameters method onError.

private void onError(Exception ex) {
    if (ex != null)
        ex.printStackTrace();
    if (ex instanceof LoginWithCaptchaRequiredException) {
        LoginWithCaptchaRequiredException e = (LoginWithCaptchaRequiredException) ex;
        configureView(e.getCaptchaToken(), e.getCaptchaUrl());
        return;
    }
    configureView(null, null);
    final AlertDialog dialog = new AlertDialog.Builder(LoginActivity.this).create();
    dialog.setIcon(android.R.drawable.ic_dialog_alert);
    dialog.setButton("OK", new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    });
    // i18n
    dialog.setTitle(U.t(LoginActivity.this, R.string.login_error_dialog_title));
    dialog.setMessage(U.t(LoginActivity.this, R.string.login_error_dialog_message) + " " + ex.getMessage() + "/n(" + ex.getClass() + // i18n
    ")");
    try {
        dialog.show();
    } catch (BadTokenException e) {
    //
    }
// mUsername.setError(getString(R.string.screen_login_error));
}
Also used : AlertDialog(android.app.AlertDialog) LoginWithCaptchaRequiredException(com.newsrob.LoginWithCaptchaRequiredException) DialogInterface(android.content.DialogInterface) BadTokenException(android.view.WindowManager.BadTokenException)

Aggregations

AlertDialog (android.app.AlertDialog)1 DialogInterface (android.content.DialogInterface)1 BadTokenException (android.view.WindowManager.BadTokenException)1 LoginWithCaptchaRequiredException (com.newsrob.LoginWithCaptchaRequiredException)1