<commit_before>package com.example.androidfileexplorer;

import java.io.File;
import java.io.FilenameFilter;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.preference.PreferenceManager;
import android.webkit.MimeTypeMap;
import android.widget.Toast;

public class Util {
	public static FilenameFilter onlyDirFilter() {
		return new FilenameFilter() {
			@Override
			public boolean accept(File current, String name) {
				return new File(current, name).isDirectory();
			}
		};
	}

	public static FilenameFilter onlyFileFilter() {
		return new FilenameFilter() {
			@Override
			public boolean accept(File current, String name) {
				return new File(current, name).isFile();
			}
		};
	}

	public static void openFileWithApp(Context context, File f) {
		if (!f.canRead()) {
			toolTip(context,
					context.getResources().getString(R.string.no_read_perm));
		} else {
			String type = null;
			String extension = MimeTypeMap.getFileExtensionFromUrl(f.getName()
					.replace(" ", "%20"));
			MimeTypeMap map = MimeTypeMap.getSingleton();
			type = map.getMimeTypeFromExtension(extension);
			if (type == null) {
				type = PreferenceManager.getDefaultSharedPreferences(context)
						.getString("pref_unknownMimeTypeHandler", "*/*");
			}
			Intent intent = new Intent();
			intent.setAction(android.content.Intent.ACTION_VIEW);
			intent.setDataAndType(Uri.fromFile(f), type);
			context.startActivity(intent);
		}
	}

	static public void toolTip(Context context, String msg) {
		int duration = Toast.LENGTH_SHORT;
		Toast toast = Toast.makeText(context, msg, duration);
		toast.show();
	}
}
<commit_msg>added wrapper to use tooltips more easily with string resources<commit_after>package com.example.androidfileexplorer;

import java.io.File;
import java.io.FilenameFilter;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.preference.PreferenceManager;
import android.webkit.MimeTypeMap;
import android.widget.Toast;

public class Util {
	public static FilenameFilter onlyDirFilter() {
		return new FilenameFilter() {
			@Override
			public boolean accept(File current, String name) {
				return new File(current, name).isDirectory();
			}
		};
	}

	public static FilenameFilter onlyFileFilter() {
		return new FilenameFilter() {
			@Override
			public boolean accept(File current, String name) {
				return new File(current, name).isFile();
			}
		};
	}

	public static void openFileWithApp(Context context, File f) {
		if (!f.canRead()) {
			toolTip(context, R.string.no_read_perm);
		} else {
			String type = null;
			String extension = MimeTypeMap.getFileExtensionFromUrl(f.getName()
					.replace(" ", "%20"));
			MimeTypeMap map = MimeTypeMap.getSingleton();
			type = map.getMimeTypeFromExtension(extension);
			if (type == null) {
				type = PreferenceManager.getDefaultSharedPreferences(context)
						.getString("pref_unknownMimeTypeHandler", "*/*");
			}
			Intent intent = new Intent();
			intent.setAction(android.content.Intent.ACTION_VIEW);
			intent.setDataAndType(Uri.fromFile(f), type);
			context.startActivity(intent);
		}
	}

	static public void toolTip(Context context, String msg) {
		int duration = Toast.LENGTH_SHORT;
		Toast toast = Toast.makeText(context, msg, duration);
		toast.show();
	}

	static public void toolTip(Context context, int id) {
		toolTip(context, context.getResources().getString(id));
	}
}

{'fraction_non_alphanumeric': 0.11623188405797101, 'fraction_numerical': 0.0011594202898550724, 'mean_word_length': 4.503987240829346, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3511813', 'n_tokens_mistral': 1185, 'n_tokens_neox': 1038, 'n_words': 242}