@Override public void onPostExecute(FileManageTask task) { if (mFileObserver != null) { mFileObserver.deleteFinished(mFilesDeleted, mFilesNotDeleted); } dismissProgressDialog(); if (mTaskList != null) { mTaskList.remove(task); } }
/** * 删除文件 * * @param path * @param type */ public void deleteFile(String path, int type) { File file = new File(path); boolean ret = false; if (file.exists()) { ret = file.delete(); } else { ret = true; } if (ret) { Category category = null; String key = MediaFileUtil.getPathFromFilepath(path); if (type == TYPE_AUDIO) { category = mAudioCategory.get(key); mDeletedAudioList.add(path); } if (type == TYPE_IMAGE) { category = mImageCategory.get(key); mDeletedImageList.add(path); } if (type == TYPE_VIDEO) { category = mVideoCategory.get(key); mDeletedVideoList.add(path); } if (null != category) { category.deleteFile(path); } removeDataFromDB(path, type); } mFileObserver.deleteFinished(path, ret); }