Пример #1
0
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
      // We can read and write the media

      try {
        url = (String) getIntent().getExtras().get(Intent.EXTRA_TEXT) + "#view:list";
      } catch (Exception e) {
        url = "https://www.dropbox.com/s/8owsfcia59ko76i#view:list";
        // Used for testing if it's not opened from the dropox action menu
        // Obviously what needs to happen here is a message suggesting that the user use the dropbox
        // app, and a textbox in case they've got the url copied.
      }

      showDialog(
          PROGRESS_DIALOG); // Do the work in a separate thread so we can update the UI
                            // simultaneously.

    } else {
      // Can't write files, so show a message and quit.

    }
  }
Пример #2
0
 public void stuff() {
   String page = getData(url);
   List filesAndFolders = parsePage(page);
   String dlDirPath =
       Environment.getExternalStorageDirectory() + "/download/" + getFolderName(page) + "/";
   getFilesFromFolder(filesAndFolders, dlDirPath);
   debug("Done!");
 }