<commit_before>package com.example.mosis.landmarksgo.other;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.support.annotation.DrawableRes;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;

import com.example.mosis.landmarksgo.R;

/**
 * Created by k on 5/23/2017.
 */

public class BitmapManipulation {

    public static Bitmap getCroppedBitmap(Bitmap bitmap) {
        int smallerSide = bitmap.getHeight();
        if(bitmap.getWidth()<bitmap.getHeight()){
            smallerSide = bitmap.getWidth();
        }

        Bitmap output = Bitmap.createBitmap(smallerSide, smallerSide, Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(output);

        final int color = 0xff424242;
        final Paint paint = new Paint();
        final Rect rect = new Rect(0, 0, smallerSide, smallerSide);
<commit_msg>Scaling down bitmaps<commit_after>package com.example.mosis.landmarksgo.other;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.support.annotation.DrawableRes;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;

import com.example.mosis.landmarksgo.R;

/**
 * Created by k on 5/23/2017.
 */

public class BitmapManipulation {

    public static Bitmap getCroppedBitmap(Bitmap bitmap) {
        //scale bitmap so it takes less memory space
        double ratio=(double)bitmap.getWidth()/(double)bitmap.getHeight();
        int newHeight, newWidth;
        if(bitmap.getHeight()>bitmap.getWidth()){
            newHeight=256;
            newWidth=(int)(newHeight/ratio);
        }else{
            newWidth=256;
            newHeight=(int)(newWidth*ratio);
        }

        bitmap = Bitmap.createScaledBitmap(bitmap, newHeight, newWidth, false);

        //creating new square bitmap
        int smallerSide = newHeight;
        if(newWidth<newHeight){
            smallerSide = newWidth;
        }

        Bitmap output = Bitmap.createBitmap(smallerSide, smallerSide, Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(output);

        final int color = 0xff424242;
        final Paint paint = new Paint();
        final Rect rect = new Rect(0, 0, smallerSide, smallerSide);

{'fraction_non_alphanumeric': 0.09960014540167211, 'fraction_numerical': 0.016721192293711377, 'mean_word_length': 3.556291390728477, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 4, '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': '5016608', 'n_tokens_mistral': 823, 'n_tokens_neox': 773, 'n_words': 180}