Beispiel #1
0
 @Override
 protected Dialog onCreateDialog(int id) {
   switch (id) {
     case PROGRESS_DIALOG:
       progressDialog = new ProgressDialog(D4.this);
       progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
       progressDialog.setMessage("Loading...");
       return progressDialog;
     default:
       return null;
   }
 }
Beispiel #2
0
 @Override
 protected void onPrepareDialog(int id, Dialog dialog) {
   switch (id) {
     case PROGRESS_DIALOG:
       progressDialog.setProgress(0);
       progressThread = new ProgressThread(handler);
       progressThread.start();
   }
 }
Beispiel #3
0
 @Override
 public void handleMessage(Message msg) {
   int total = msg.arg1;
   progressDialog.setProgress(total);
   if (total >= 100) {
     dismissDialog(PROGRESS_DIALOG);
     progressThread.setState(ProgressThread.STATE_DONE);
   }
 }
  void requestAccountList() {
    prog =
        ProgressDialog.show(
            this,
            null,
            getString(R.string.account_list_progress),
            false,
            true,
            new DialogInterface.OnCancelListener() {
              public void onCancel(DialogInterface dialog) {
                cancel();
              }
            });

    queryThread = new Thread(this, "Requestor Thread");
    queryThread.setDaemon(true);
    queryThread.start();
  }
        public void handleMessage(Message msg) {
          super.handleMessage(msg);

          try {
            prog.dismiss();
          } catch (
              IllegalArgumentException
                  e) { // this may happen due to race conditions on activity shutdown?
            e.printStackTrace();
          }
          switch (msg.what) {
            case QH_OK:
              buildView();
              break;
            case QH_EMPTY:
              doAlert(null, "Server gave an unexpected response (no signon acknowledgement?)");
              break;
            case QH_ERR_OFX:
              {
                OfxError e = (OfxError) msg.obj;
                switch (e.getErrorCode()) {
                    // case StatusResponse.STATUS_ERROR: // General error (ERROR)
                    // case StatusResponse.STATUS_MFA_REQUIRED: // User credentials are correct, but
                    // further authentication required (ERROR)
                    // case StatusResponse.STATUS_MFA_INVALID: // MFACHALLENGEA contains invalid
                    // information (ERROR)
                  case StatusResponse
                      .STATUS_FI_INVALID: // <FI> Missing or Invalid in <SONRQ> (ERROR)
                    doAlert(e, "Server is rejecting connection details (FI_ID or FI_ORG)");
                    break;
                    // case StatusResponse.STATUS_PINCH_NEEDED: // Must change USERPASS (INFO)
                  case StatusResponse
                      .STATUS_AUTHTOKEN_REQUIRED: // OFX server requires AUTHTOKEN in signon during
                                                  // the next session (ERROR)
                  case StatusResponse
                      .STATUS_BAD_LOGIN: // Signon invalid (see section 2.5.1) (ERROR)
                  case StatusResponse.STATUS_AUTHTOKEN_INVALID: // AUTHTOKEN invalid (ERROR)
                    loginFailure();
                    break;
                  case StatusResponse.STATUS_ACCT_BUSY: // Customer account already in use (ERROR)
                    doAlert(e, "Your account is currently in use");
                    break;
                  case StatusResponse.STATUS_ACCT_LOCKED: // USERPASS Lockout (ERROR)
                    doAlert(e, "Your account has been locked");
                    break;
                    // case StatusResponse.STATUS_EMPTY_REQUEST: // Empty signon transaction not
                    // supported (ERROR)
                    // case StatusResponse.STATUS_PINCH_REQUIRED: // Signon invalid without
                    // supporting pin change request (ERROR)
                    // case StatusResponse.STATUS_CLIENTUID_REJECTED: // CLIENTUID error (ERROR)
                  case StatusResponse
                      .STATUS_CALL_US: // User should contact financial institution (ERROR)
                    doAlert(e, "Please contact your financial institution");
                    break;
                  default:
                    doAlert(e, "Server refused the login");
                    break;
                }
              }

            case QH_ERR_HTTP:
            case QH_ERR_TIMEOUT:
            case QH_ERR_CONN:
            case QH_ERR_SSL:
              doRetryableAlert((Exception) msg.obj, "Unable to connect to server");
              break;

            default:
              doAlert((Exception) msg.obj, OfxProfile.exceptionComment((Exception) msg.obj));
              break;
          }
        }