Ejemplo n.º 1
0
    @Override
    protected Void doInBackground(Void... params) {
      try {
        if (mBitcasaClient.isLinked()) {
          File tempDownloadFile =
              new File(
                  Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS),
                  mFileToBeDownloaded.name);
          mBitcasaClient.downloadFile(
              mFileToBeDownloaded, 0, false, tempDownloadFile.getPath(), mListener);
        }

      } catch (IOException e) {
        e.printStackTrace();
      } catch (BitcasaAuthenticationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      } catch (BitcasaRequestErrorException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      } catch (BitcasaException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      } finally {

      }
      return null;
    }
Ejemplo n.º 2
0
    @Override
    protected ArrayList<FileMetaData> doInBackground(Void... params) {
      try {
        if (authcode != null) {
          String accesstoken = mBitcasaClient.getAccessToken(CLIENT_SECRET, authcode);
          if (accesstoken != null) {
            // get root folder list
            ArrayList<FileMetaData> root = mBitcasaClient.getList(null, null, 0, null);
            return root;
          }
        }

      } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      } catch (BitcasaRequestErrorException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      } catch (BitcasaException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }

      return null;
    }
Ejemplo n.º 3
0
    @Override
    protected AccountInfo doInBackground(Void... params) {
      try {
        if (mBitcasaClient.isLinked()) {
          AccountInfo account = mBitcasaClient.getAccountInfo();
          return account;
        }

      } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      } catch (BitcasaRequestErrorException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      } catch (BitcasaAuthenticationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      } catch (BitcasaException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
      return null;
    }
Ejemplo n.º 4
0
    @Override
    protected ArrayList<FileMetaData> doInBackground(Void... params) {
      try {
        if (mBitcasaClient.isLinked()) {
          Depth d = null;
          if (depth != null) {
            if (depth.equals("0")) d = Depth.INFINITE;
            else if (depth.equals("1")) d = Depth.CURRENT_CHILDREN;
          }

          int l = latest == null ? 0 : Integer.parseInt(latest);

          Category ca = null;
          if (category != null) {
            int c = Integer.parseInt(category);
            switch (c) {
              case 0:
                ca = Category.MUSIC_ARTISTS;
                break;
              case 1:
                ca = Category.MUSIC_ALBUMS;
                break;
              case 2:
                ca = Category.MUSIC_TRACKS;
                break;
              case 3:
                ca = Category.PHOTO_ALBUMS;
                break;
              case 4:
                ca = Category.PHOTOS;
                break;
              case 5:
                ca = Category.DOCUMENTS;
                break;
              case 6:
                ca = Category.VIDEOS;
                break;
              case 7:
                ca = Category.EVERYTHING;
                break;
            }
          }

          ArrayList<FileMetaData> allfolders = mBitcasaClient.getList(mFolder, d, l, ca);
          return allfolders;
        }

      } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      } catch (BitcasaRequestErrorException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      } catch (BitcasaAuthenticationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      } catch (BitcasaException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
      return null;
    }