Exemplo n.º 1
0
 @Override
 protected void onPostExecuteInternal(final StatusCode status) {
   if (status == StatusCode.NO_ERROR) {
     showToast(res.getString(R.string.info_log_posted));
     // No need to save the log when quitting if it has been posted.
     text = currentLogText();
     finish();
   } else if (status == StatusCode.LOG_SAVED) {
     showToast(res.getString(R.string.info_log_saved));
     finish();
   } else {
     showToast(status.getErrorString(res));
   }
 }
Exemplo n.º 2
0
        @Override
        public void handleMessage(final Message msg) {
          try {
            final StatusCode reason = (StatusCode) msg.obj;

            if (reason != null && reason != StatusCode.NO_ERROR) { // LoginFailed
              showToast(
                  res.getString(
                      reason == StatusCode.MAINTENANCE
                          ? reason.getErrorString()
                          : R.string.err_login_failed_toast));
            }
          } catch (final Exception e) {
            Log.w("MainActivity.firstLoginHander", e);
          }
        }
Exemplo n.º 3
0
    @Override
    protected void onPostExecuteInternal(final StatusCode status) {
      if (status == StatusCode.NO_ERROR) {
        showToast(res.getString(R.string.info_log_posted));
        // No need to save the log when quitting if it has been posted.
        text = currentLogText();
        finish();
      } else if (status == StatusCode.LOG_SAVED) {
        showToast(res.getString(R.string.info_log_saved));
        finish();
      } else {
        Dialogs.confirmPositiveNegativeNeutral(
            activity,
            R.string.info_log_post_failed,
            res.getString(R.string.info_log_post_failed_reason, status.getErrorString(res)),
            R.string.info_log_post_retry, // Positive Button
            string.cancel, // Negative Button
            R.string.info_log_post_save, // Neutral Button
            // Positive button: Retry
            new OnClickListener() {

              @Override
              public void onClick(final DialogInterface dialog, final int which) {
                sendLogInternal();
              }
            },
            // Negative button: dismiss popup
            null,
            // Neutral Button: SaveLog
            new OnClickListener() {

              @Override
              public void onClick(final DialogInterface dialogInterface, final int i) {
                saveLog(true);
                finish();
              }
            });
      }
    }
        @Override
        public void handleMessage(final Message msg) {
          if (waitDialog != null) {
            waitDialog.dismiss();
          }

          final StatusCode error = (StatusCode) msg.obj;
          if (error == StatusCode.NO_ERROR) {
            showToast(res.getString(R.string.info_log_posted));
            // No need to save the log when quitting if it has been posted.
            text = currentLogText();
            finish();
          } else if (error == StatusCode.LOG_SAVED) {
            showToast(res.getString(R.string.info_log_saved));

            if (waitDialog != null) {
              waitDialog.dismiss();
            }

            finish();
          } else {
            showToast(error.getErrorString(res));
          }
        }