Пример #1
0
  private void getAccountInfo() {
    if (api.isAuthenticated()) {
      // If we're already authenticated, we don't need to get the login info

      dialog.show();
      LoginAsyncTask login = new LoginAsyncTask(this, null, null, getConfig(), dialog);
      login.execute();
    } else {

      String email = mLoginEmail.getText().toString();

      if (email.length() < 5 || email.indexOf("@") < 0 || email.indexOf(".") < 0) {
        showToast("Error, invalid e-mail");
        return;
      }

      String password = mLoginPassword.getText().toString();

      if (password.length() < 6) {
        showToast("Error, password too short");
        return;
      }

      // It's good to do Dropbox API (and any web API) calls in a separate thread,
      // so we don't get a force-close due to the UI thread stalling.

      dialog.show();
      LoginAsyncTask login = new LoginAsyncTask(this, email, password, getConfig(), dialog);
      login.execute();
    }
  }
 private void loginAsync() {
   mStatusView.setText(
       mIsLogin ? R.string.msg_login_dialog_title_wait : R.string.msg_update_dialog_title_wait);
   AsyncTaskUtils.cancelTask(mLoginAsyncTask);
   mLoginAsyncTask = new LoginAsyncTask();
   mLoginAsyncTask.execute();
 }