<commit_before>package fi.mikuz.boarder.util;

import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.Matrix;
import android.util.DisplayMetrics;

/**
 * 
 * @author <NAME>
 */
public class IconUtils {
	public static Bitmap resizeIcon(Activity activity, Bitmap bitmap, float pixelsPerInch) {
		DisplayMetrics metrics = new DisplayMetrics();
		activity.getWindowManager().getDefaultDisplay().getMetrics(metrics);
		
		float density = metrics.densityDpi;
		float imageSize = density/pixelsPerInch;
		
        int width = bitmap.getWidth();
        int height = bitmap.getHeight();
        float scaleWidth = ((float) imageSize) / width;
        float scaleHeight = ((float) imageSize) / height;
       
        Matrix matrix = new Matrix();
        matrix.postScale(scaleWidth, scaleHeight);
        return Bitmap.createBitmap(bitmap, 0, 0, width, height, matrix, true);
	}
}<commit_msg>Instead of activity only context is needed to resize icon.<commit_after>package fi.mikuz.boarder.util;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Matrix;
import android.util.DisplayMetrics;
import android.util.Log;

/**
 * 
 * @author <NAME>
 */
public class IconUtils {
	public static Bitmap resizeIcon(Context context, Bitmap bitmap, float pixelsPerInch) {
		DisplayMetrics metrics = context.getResources().getDisplayMetrics();
		
		float density = metrics.densityDpi;
		float imageSize = density/pixelsPerInch;
		
		int width = bitmap.getWidth();
		int height = bitmap.getHeight();
        float scaleWidth = ((float) imageSize) / width;
        float scaleHeight = ((float) imageSize) / height;
       
        Matrix matrix = new Matrix();
        matrix.postScale(scaleWidth, scaleHeight);
        return Bitmap.createBitmap(bitmap, 0, 0, width, height, matrix, true);
	}
}
{'fraction_non_alphanumeric': 0.10760869565217392, 'fraction_numerical': 0.002173913043478261, 'mean_word_length': 3.819371727748691, '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': '4998941', 'n_tokens_mistral': 536, 'n_tokens_neox': 501, 'n_words': 139}