package rs.elfak.mosis.marko.discounthunt;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.provider.MediaStore;
import android.util.Base64;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;

public class Camera {
    public static final int CAPTURE_IMAGE_REQUEST_CODE = 1;

    private Activity activity;
    public Camera(Activity activity){
        this.activity = activity;
    }

    public void takePhoto() {
        Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        activity.startActivityForResult(cameraIntent, CAPTURE_IMAGE_REQUEST_CODE);
    }

    public static String encodeToBase64(Bitmap image)
    {
        ByteArrayOutputStream byteArrayOS = new ByteArrayOutputStream();
        image.compress(Bitmap.CompressFormat.JPEG, 100, byteArrayOS);
        return Base64.encodeToString(byteArrayOS.toByteArray(), Base64.DEFAULT);
    }

    public static Bitmap decodeBase64(String input)
    {
        byte[] decodedBytes = Base64.decode(input, 0);
        return BitmapFactory.decodeByteArray(decodedBytes, 0, decodedBytes.length);
    }
}

@@ -172,32 +172,8 @@
 ry;%0A
-import android.net.Uri;%0A
 impo
@@ -274,57 +274,8 @@
 eam;
-%0Aimport java.io.File;%0Aimport java.io.IOException;
 %0A%0Apu

Clean up Camera.java