<commit_before>package lecho.lib.hellocharts.utils;

import android.content.Context;

public abstract class Utils {

	public static int dp2px(Context context, int dp) {
		// Get the screen's density scale
		final float scale = context.getResources().getDisplayMetrics().density;
		// Convert the dps to pixels, based on density scale
		return (int) (dp * scale + 0.5f);

	}

	public static int sp2px(Context context, int sp) {
		// Get the screen's density scale
		final float scale = context.getResources().getDisplayMetrics().scaledDensity;
		// Convert the sps to pixels, based on scale density scale
		return (int) (sp * scale + 0.5f);
	}

	public static boolean isInArea(float x, float y, float touchX, float touchY, float radius) {
		float diffX = touchX - x;
		float diffY = touchY - y;
		return Math.pow(diffX, 2) + Math.pow(diffY, 2) <= 2 * Math.pow(radius, 2);<commit_msg>Added utility method to pick color<commit_after>package lecho.lib.hellocharts.utils;

import android.content.Context;
import android.graphics.Color;

public abstract class Utils {
	public static final int COLOR_BLUE = Color.parseColor("#33B5E5");
	public static final int COLOR_VIOLET = Color.parseColor("#AA66CC");
	public static final int COLOR_GREEN = Color.parseColor("#99CC00");
	public static final int COLOR_ORANGE = Color.parseColor("#FFBB33");
	public static final int COLOR_RED = Color.parseColor("#FF4444");

	public static final int pickColor() {
		final int[] colors = new int[] { COLOR_BLUE, COLOR_VIOLET, COLOR_GREEN, COLOR_ORANGE, COLOR_RED };
		return colors[(int) Math.round(Math.random() * (colors.length - 1))];
	}

	public static int dp2px(Context context, int dp) {
		// Get the screen's density scale
		final float scale = context.getResources().getDisplayMetrics().density;
		// Convert the dps to pixels, based on density scale
		return (int) (dp * scale + 0.5f);

	}

	public static int sp2px(Context context, int sp) {
		// Get the screen's density scale
		final float scale = context.getResources().getDisplayMetrics().scaledDensity;
		// Convert the sps to pixels, based on scale density scale
		return (int) (sp * scale + 0.5f);
	}

	public static boolean isInArea(float x, float y, float touchX, float touchY, float radius) {
		float diffX = touchX - x;
		float diffY = touchY - y;
		return Math.pow(diffX, 2) + Math.pow(diffY, 2) <= 2 * Math.pow(radius, 2);
{'fraction_non_alphanumeric': 0.11345423871784058, 'fraction_numerical': 0.01560522986081822, 'mean_word_length': 4.259423503325943, 'pattern_counts': {'":': 0, '<': 5, '<?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': '6613398', 'n_tokens_mistral': 804, 'n_tokens_neox': 742, 'n_words': 252}