Example #1
0
 void showList() {
   if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) finish();
   File file = new File(dir);
   if (!file.exists()) {
     dir = externalStorageDir;
     file = new File(dir);
   }
   this.setTitle(dir);
   File[] fc = file.listFiles(fFilter);
   final FileListAdapter adapter = new FileListAdapter(this, fc);
   adapter.sort(comparator);
   ListView lv = (ListView) findViewById(android.R.id.list);
   lv.setAdapter(adapter);
   lv.setOnItemClickListener(
       new OnItemClickListener() {
         public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
           if (((File) adapter.getItem(position)).isDirectory()) {
             dir = ((File) adapter.getItem(position)).getPath();
             showList();
           }
         }
       });
   if (dir.equals(Environment.getExternalStorageDirectory().toString())) {
     findViewById(R.id.button1).setEnabled(false);
   } else {
     findViewById(R.id.button1).setEnabled(true);
   }
 }
Example #2
0
 @Override
 public void onListItemClick(ListView l, View v, int position, long id) {
   FileListAdapter adapter = (FileListAdapter) l.getAdapter();
   if (adapter != null) {
     File file = (File) adapter.getItem(position);
     path = file.getAbsolutePath();
     ((FileChooserActivity) getActivity()).onFileSelected(file);
   }
 }
  /** Sets the file list to display. */
  public void setFiles(FileList files) {
    current = files;

    txtCurrentPath.setText(files.getPath());
    txtCurrentPath.setVisibility(View.VISIBLE);

    fileList.scrollTo(0, 0);
    fileListAdapter.setItems(files);
  }
  @Override
  protected void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.path_file_manager);
    // 20121026 - For bug 78847
    /* SPRD: modify actionbar title for bug 264804 @{ */
    /*
     * ActionBar actionBar = getActionBar();
     * actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
     * actionBar.setCustomView(R.layout.custom_title);
     * mTitleText = (TextView) actionBar.getCustomView().findViewById(R.id.custom_title);
     */
    mActionBar = getActionBar();
    /* @} */
    // SPRD: dual T policy porting
    // SPRD:MODIFY for double T card
    mCurrentDir = new File(STORAGE_PATH_DOUBLE_T);
    mOnlyAdapter = new FileListAdapter(this);
    mOnlyAdapter.sortImpl(new File(STORAGE_PATH_DOUBLE_T), "ttf");
    setListAdapter(mOnlyAdapter);

    updateTitle();
  }
 public void updateListView() {
   mOnlyAdapter.sortImpl(mCurrentDir, "ttf");
   updateTitle();
 }
Example #6
0
 public void onLoaderReset(Loader<List<File>> loader) {
   adapter.clear();
 }
Example #7
0
 public void onLoadFinished(Loader<List<File>> loader, List<File> data) {
   adapter.setListItems(data);
   if (isResumed()) setListShown(true);
   else setListShownNoAnimation(true);
 }