Java Code Examples for com.blankj.utilcode.util.FileUtils#deleteDir()

The following examples show how to use com.blankj.utilcode.util.FileUtils#deleteDir() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DownloadedFragment.java    From DanDanPlayForAndroid with MIT License 6 votes vote down vote up
@Override
public void onTaskDelete(int position, String taskHash, boolean withFile) {
    //删除系统中文件
    if (withFile) {
        FileUtils.deleteDir(taskList.get(position).getSaveDirPath());
    }

    //删除数据库中信息
    DataBaseManager.getInstance()
            .selectTable("downloaded_task")
            .delete()
            .where("torrent_hash", taskHash)
            .postExecute();
    DataBaseManager.getInstance()
            .selectTable("downloaded_file")
            .delete()
            .where("task_torrent_hash", taskHash)
            .postExecute();

    //刷新媒体库数据
    EventBus.getDefault().post(UpdateFragmentEvent.updatePlay(PlayFragment.UPDATE_SYSTEM_DATA));

    //更新界面数据
    if (position > -1 && position < taskList.size())
        taskRvAdapter.removeItem(position);
}
 
Example 2
Source File: TorrentUtil.java    From DanDanPlayForAndroid with MIT License 4 votes vote down vote up
/**
 * 删除下载任务中的文件
 */
public static void deleteTaskFile(String saveDirPath) {
    FileUtils.deleteDir(saveDirPath);
}
 
Example 3
Source File: NoteMainPresenter.java    From SuperNote with GNU General Public License v3.0 4 votes vote down vote up
private void deleteFile(String mNoteId) {
    File file = Utils.getContext().getExternalFilesDir(mNoteId);
    if (file.exists()) {
        FileUtils.deleteDir(file);
    }
}
 
Example 4
Source File: NoteModel.java    From SuperNote with GNU General Public License v3.0 4 votes vote down vote up
private void deleteNoteFile(String noteId){
    File file=Utils.getContext().getExternalFilesDir(noteId);
    if(file.exists()){
        FileUtils.deleteDir(file);
    }
}