Ejemplo n.º 1
0
  private void showDirectoryContentsUI() {
    // Fijamos el directorio actual.

    iCurrentPath = iLoadingPathname;

    // Visualizamos el nombre del directorio actual.

    iFolderNameText.setText(iCurrentPath + "/");

    // Eliminamos la lista de ficheros antiguos.

    iFilesList.clear();

    // Si no estamos en el directorio raíz, añadimos como primer elemento
    // ir al directorio anterior.

    if (!iCurrentPath.equals("")) {
      iFilesList.add(
          createListViewItem(getResources().getString(R.string.folder_up), R.drawable.folder_up));
    }

    // Inicializamos la lista de ficheros.

    for (MyFile child : iChilds)
      iFilesList.add(
          createListViewItem(
              child.getName(), child.isDirectory() ? R.drawable.folder : R.drawable.file));

    // Visualizamos la lista.

    iAdapterList.notifyDataSetChanged();
    iListView.setAdapter(iAdapterList);
  }
Ejemplo n.º 2
0
 static MyFile createFile(Path root, FileSystem fs, int levels) throws IOException {
   MyFile f = levels < 0 ? new MyFile() : new MyFile(levels);
   Path p = new Path(root, f.getName());
   FSDataOutputStream out = fs.create(p);
   byte[] toWrite = new byte[f.getSize()];
   new Random(f.getSeed()).nextBytes(toWrite);
   out.write(toWrite);
   out.close();
   FileSystem.LOG.info("created: " + p + ", size=" + f.getSize());
   return f;
 }
Ejemplo n.º 3
0
 public int compareTo(MyFile file) {
   return iName.compareTo(file.getName());
 }