示例#1
0
 public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
   if (mAcceptFiles) {
     Folder item = (Folder) mAdapter.getItem(position);
     if (item.isDirectory()) {
       mPath = item;
       updateAdapter();
       mFilePath = null;
     } else {
       mCurrentFolder.setText(item.getAbsolutePath());
       mFilePath = item;
     }
   } else {
     mPath = (Folder) mAdapter.getItem(position);
     updateAdapter();
   }
 }
示例#2
0
    public View getView(int position, View convertView, ViewGroup parent) {
      View v = mInflater.inflate(R.layout.folder, parent, false);
      Folder folder = mFolders.get(position);
      TextView name = (TextView) v.findViewById(R.id.folder_name);

      Drawable drawable = null;
      if (folder.isParent) {
        name.setText("[..]");
        drawable = new FolderTransitionDrawable(mFolderUpLayers);
      } else {
        name.setText(folder.getName());
        if (folder.isDirectory()) {
          drawable = new FolderTransitionDrawable(mFolderLayers);
        } else {
          drawable = mFileDrawable;
        }
      }
      v.findViewById(R.id.folder_icon).setBackgroundDrawable(drawable);
      return v;
    }