<commit_before>package com.filemanager.dialogs;

import imoblife.android.os.ModernAsyncTask;

import java.io.File;


import com.filemanager.R;
import com.filemanager.files.FileHolder;
import com.filemanager.lists.FileListFragment;
import com.filemanager.util.MediaScannerUtils;
import com.filemanager.util.UIUtils;
import com.intents.FileManagerIntents;

import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.widget.Toast;

public class SingleDeleteDialog extends DialogFragment {
	private FileHolder mFileHolder;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		mFileHolder = getArguments().getParcelable(FileManagerIntents.EXTRA_DIALOG_FILE_HOLDER);
	}
	
	@Override
	public Dialog onCreateDialog(Bundle savedInstanceState) {
		return new AlertDialog.Builder(getActivity())
				.setInverseBackgroundForced(UIUtils.shouldDialogInverseBackground(getActivity()))
				.setTitle(getString(R.string.really_delete, mFileHolder.getName()))
				.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
					@Override
					public void onClick(DialogInterface dialog, int which) {
							new RecursiveDeleteTask().execute(mFileHolder.getFile());
					}
				})
				.setIcon(mFileHolder.getIcon())
				.setNegativeButton(android.R.string.cancel, null)
				.create();
	}
	
	private class RecursiveDeleteTask extends ModernAsyncTask<File, Void, Void> {
		/**
		 * If 0 some failed, if 1 all succeeded. 
		 */
		private int mResult = 1;
		private ProgressDialog dialog = new ProgressDialog(getActivity());

		/**
		 * Recursively delete a file or directory and all of its children.
		 * 
		 * @returns 0 if successful, error value otherwise.
		 */
		private void recursiveDelete(File file) {
			File[] files = file.listFiles();
			if (files != null && files.length != 0) 
				// If it's a directory delete all children.
				for (File childFile : files) {
					if (childFile.isDirectory()) {
						recursiveDelete(childFile);
					} else {<commit_msg>dialogs: handle java.util.FormatFlagsConversionMismatchException: %s does not support ' '<commit_after>package com.filemanager.dialogs;

import imoblife.android.os.ModernAsyncTask;

import java.io.File;


import com.filemanager.R;
import com.filemanager.files.FileHolder;
import com.filemanager.lists.FileListFragment;
import com.filemanager.util.MediaScannerUtils;
import com.filemanager.util.UIUtils;
import com.intents.FileManagerIntents;

import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.widget.Toast;

public class SingleDeleteDialog extends DialogFragment {
	private FileHolder mFileHolder;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		mFileHolder = getArguments().getParcelable(FileManagerIntents.EXTRA_DIALOG_FILE_HOLDER);
	}
	
	@Override
	public Dialog onCreateDialog(Bundle savedInstanceState) {
		AlertDialog.Builder adb = new AlertDialog.Builder(getActivity());
		try {
			adb.setInverseBackgroundForced(UIUtils.shouldDialogInverseBackground(getActivity()))
			.setTitle(getString(R.string.really_delete, mFileHolder.getName()))
			.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
				@Override
				public void onClick(DialogInterface dialog, int which) {
					new RecursiveDeleteTask().execute(mFileHolder.getFile());
				}
			})
			.setIcon(mFileHolder.getIcon())
			.setNegativeButton(android.R.string.cancel, null);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return adb.create();
	}
	
	private class RecursiveDeleteTask extends ModernAsyncTask<File, Void, Void> {
		/**
		 * If 0 some failed, if 1 all succeeded. 
		 */
		private int mResult = 1;
		private ProgressDialog dialog = new ProgressDialog(getActivity());

		/**
		 * Recursively delete a file or directory and all of its children.
		 * 
		 * @returns 0 if successful, error value otherwise.
		 */
		private void recursiveDelete(File file) {
			File[] files = file.listFiles();
			if (files != null && files.length != 0) 
				// If it's a directory delete all children.
				for (File childFile : files) {
					if (childFile.isDirectory()) {
						recursiveDelete(childFile);
					} else {
{'fraction_non_alphanumeric': 0.10232044198895028, 'fraction_numerical': 0.0026519337016574587, 'mean_word_length': 4.622360248447205, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6613644', 'n_tokens_mistral': 1512, 'n_tokens_neox': 1291, 'n_words': 302}