public FileInfo getFileItem(int pos) { Integer position = Integer.valueOf(pos); if (mFileNameList.containsKey(position)) return mFileNameList.get(position); Cursor cursor = (Cursor) getItem(pos); FileInfo fileInfo = getFileInfo(cursor); if (fileInfo == null) return null; mFileNameList.put(position, fileInfo); fileInfo.dbId = cursor.getLong(FileCategoryHelper.COLUMN_ID); return fileInfo; }
@Override public void bindView(View view, Context context, Cursor cursor) { // TODO Auto-generated method stub FileInfo fileInfo = getFileItem(cursor.getPosition()); if (fileInfo == null) { // file is not existing, create a fake info fileInfo = new FileInfo(); fileInfo.dbId = cursor.getLong(FileCategoryHelper.COLUMN_ID); fileInfo.filePath = cursor.getString(FileCategoryHelper.COLUMN_PATH); fileInfo.fileName = FileUtil.getNameFromFilepath(fileInfo.filePath); fileInfo.fileSize = cursor.getLong(FileCategoryHelper.COLUMN_SIZE); fileInfo.ModifiedDate = cursor.getLong(FileCategoryHelper.COLUMN_DATE); } FileListItem.setupFileListItemInfo(mContext, view, fileInfo, mFileIconHelper); }