예제 #1
0
    @Override
    protected void onPreExecute() {
      if (dialogShow) {
        progDialog = new ProgressDialog(RssReaderActivity.this);
        progDialog.setCancelable(false);
        progDialog.setMessage(getString(R.string.rss_fetching));
        progDialog.setButton(
            DialogInterface.BUTTON_NEGATIVE,
            getString(R.string.btn_hide_text),
            new DialogInterface.OnClickListener() {
              @Override
              public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
                Toast.makeText(
                        RssReaderActivity.this, R.string.rss_keep_updating, Toast.LENGTH_SHORT)
                    .show();
              }
            });
        progDialog.show();
      } else
        Toast.makeText(RssReaderActivity.this, R.string.rss_start_updating, Toast.LENGTH_SHORT)
            .show();

      isTaskRunning = true;
    }
예제 #2
0
파일: D4.java 프로젝트: sarekautowerke/D4
 @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;
   }
 }
예제 #3
0
파일: D4.java 프로젝트: sarekautowerke/D4
 @Override
 protected void onPrepareDialog(int id, Dialog dialog) {
   switch (id) {
     case PROGRESS_DIALOG:
       progressDialog.setProgress(0);
       progressThread = new ProgressThread(handler);
       progressThread.start();
   }
 }
예제 #4
0
파일: D4.java 프로젝트: sarekautowerke/D4
 @Override
 public void handleMessage(Message msg) {
   int total = msg.arg1;
   progressDialog.setProgress(total);
   if (total >= 100) {
     dismissDialog(PROGRESS_DIALOG);
     progressThread.setState(ProgressThread.STATE_DONE);
   }
 }
예제 #5
0
 protected Dialog onCreateDialog(int id) {
   switch (id) {
     case 0:
       mProgress = new ProgressDialog(this);
       mProgress.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
       mProgress.setTitle("Updating");
       mProgress.setMessage("Wait...");
       mProgress.setCancelable(false);
       mProgress.setButton(
           "Cancel",
           new DialogInterface.OnClickListener() {
             public void onClick(DialogInterface dialog, int whichButton) {
               mQuit = true;
               dismissDialog(0);
             }
           });
       return mProgress;
   }
   return null;
 }
예제 #6
0
 public void handleMessage(Message msg) {
   mValue++;
   mText.setText(Integer.toString(mValue));
   try {
     Thread.sleep(50);
   } catch (InterruptedException e) {;
   }
   if (mValue < 100 && mQuit == false) {
     mProgress.setProgress(mValue);
     mHandler.sendEmptyMessage(0);
   } else {
     dismissDialog(0);
   }
 }
예제 #7
0
    @Override
    protected void onPostExecute(Boolean result) {
      if (dialogShow) progDialog.cancel();
      if (result) {
        Toast.makeText(RssReaderActivity.this, R.string.rss_items_update_done, Toast.LENGTH_SHORT)
            .show();
        rssFeed = dbQuery.getRssFeed(name, limit);
        updateListView();
      } else
        Toast.makeText(RssReaderActivity.this, R.string.rss_item_not_update, Toast.LENGTH_SHORT)
            .show();

      dbQuery.updateRssItems();
      isTaskRunning = false;
    }
예제 #8
0
  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();
  }
예제 #9
0
        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;
          }
        }