Ejemplo n.º 1
3
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.line_list);

    // Setup the list
    adapter = new IconAdapter<FileWrapper>(this, R.layout.line_list_item);
    ListView list = (ListView) findViewById(R.id.list);
    list.setAdapter(adapter);
    list.setOnItemClickListener(this);

    // Load Directory
    if (savedInstanceState != null) {
      backStack = savedInstanceState.getParcelableArrayList("BACKSTACK");
    }

    if (backStack == null || backStack.size() == 0) {
      backStack = new ArrayList<BackStackItem>();
      String startPath =
          (startDirectory == null || startDirectory.isEmpty())
              ? Environment.getExternalStorageDirectory().getPath()
              : startDirectory;
      backStack.add(new BackStackItem(startPath, false));
    }

    wrapFiles();
    this.setVolumeControlStream(AudioManager.STREAM_MUSIC);
  }
Ejemplo n.º 2
0
  @Override
  public void onItemClick(AdapterView<?> aListView, View aView, int aPosition, long aID) {
    final FileWrapper item = adapter.getItem(aPosition);

    if (item.parentItem && backStack.get(backStack.size() - 1).parentIsBack) {
      backStack.remove(backStack.size() - 1);
      wrapFiles();
      return;
    } else if (item.dirSelectItem) {
      finishWithPath(listedDirectory.getAbsolutePath());
      return;
    }

    final File selected = item.parentItem ? listedDirectory.getParentFile() : item.file;

    if (selected.isDirectory()) {
      backStack.add(new BackStackItem(selected.getAbsolutePath(), !item.parentItem));
      wrapFiles();
    } else {
      String filePath = selected.getAbsolutePath();
      finishWithPath(filePath);
    }
  }
Ejemplo n.º 3
0
  protected void addDisallowedExt(String ext) {
    if (disallowedExt == null) disallowedExt = new ArrayList<String>();

    disallowedExt.add(ext);
  }
Ejemplo n.º 4
0
  protected void addAllowedExt(String ext) {
    if (allowedExt == null) allowedExt = new ArrayList<String>();

    allowedExt.add(ext);
  }