<commit_before>package io.happie.cordovaCamera;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.hardware.Camera;
import android.hardware.SensorManager;
import android.media.ExifInterface;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.Display;
import android.view.OrientationEventListener;
import android.view.Surface;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;

import com.jobnimbus.JobNimbus2.R; //parent project package

import org.apache.cordova.PluginResult;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

/**
 * import com.jobnimbus.moderncamera.R; //Used For testing with the intenral ionic project
 */

public class HappieCameraActivity extends Activity {
    public static final int MEDIA_TYPE_IMAGE = 1;
    public static final int MEDIA_TYPE_VIDEO = 2;
    private static final String TAG = "HappieCameraActivity";

    private static final String ORIENTATION_ROTATE_90 = "6";
    private static final String ORIENTATION_NORMAL = "1";
    private static final String ORIENTATION_ROTATE_270 = "8";
    private static final String ORIENTATION_ROTATE_180 = "3";

    private ImageButton shutter;
    private ImageButton flash;
    private ImageButton queue;
    private ImageButton cancel;

    private ImageView upperLeftThumbnail;
    private ImageView upperRightThumbnail;
    private ImageView lowerLeftThumbnail;
    private ImageView lowerRightThumbnail;
    private TextView badgeCount;
    private int quadState;  //0 = UL , 1 = UR, 2 = LL, 3 = LR
    private int flashState = 2;//camera_flash_auto
    private android.content.Context thisRef;
    File mediaStorageDir;
    File mediaThumbStorageDir;
    Display display;

    private int degrees = 0;

    protected HappieCameraThumb thumbGen = new HappieCameraThumb();

    private Camera mCamera;

    /**
     * UI State Functions
     */
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.happie_cam_layout);
        onCreateTasks();
        setCamOrientation();
    }

    protected void onCreateTasks() {

        OrientationEventListener orientationListener = new OrientationEventListener(this, SensorManager.SENSOR_DELAY_NORMAL) {
            @Override
            public void onOrientationChanged(int arg0) {
                //TODO update camera orientation with arg0
                //Log.d(TAG, "OrientationChanged called: " + arg0);
                degrees = arg0;
            }
        };

        display = getWindowManager().getDefaultDisplay();

        if (orientationListener.canDetectOrientation()) orientationListener.enable();

        cancel = (ImageButton) findViewById(R.id.cancel);
        cancel.setOnClickListener(cancelSession);

        shutter = (ImageButton) findViewById(R.id.shutter);
        shutter.setOnClickListener(captureImage);

        queue = (ImageButton) findViewById(R.id.confirm);
        queue.setOnClickListener(cameraFinishToQueue);


        flash = (ImageButton) findViewById(R.id.flashToggle);
        flash.setOnClickListener(switchFlash);

        upperLeftThumbnail = (ImageView) findViewById(R.id.UpperLeft);
        upperRightThumbnail = (ImageView) findViewById(R.id.UpperRight);
        lowerLeftThumbnail = (ImageView) findViewById(R.id.LowerLeft);
        lowerRightThumbnail = (ImageView) findViewById(R.id.LowerRight);
        badgeCount = (TextView) findViewById(R.id.badgeCount);

        quadState = 0;
<commit_msg>add first object reference for static references to have a pointer<commit_after>package io.happie.cordovaCamera;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.hardware.Camera;
import android.hardware.SensorManager;
import android.media.ExifInterface;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.Display;
import android.view.OrientationEventListener;
import android.view.Surface;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;

import com.jobnimbus.JobNimbus2.R; //parent project package

import org.apache.cordova.PluginResult;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

/**
 * import com.jobnimbus.moderncamera.R; //Used For testing with the intenral ionic project
 */

public class HappieCameraActivity extends Activity {
    public static final int MEDIA_TYPE_IMAGE = 1;
    public static final int MEDIA_TYPE_VIDEO = 2;
    private static final String TAG = "HappieCameraActivity";

    private static final String ORIENTATION_ROTATE_90 = "6";
    private static final String ORIENTATION_NORMAL = "1";
    private static final String ORIENTATION_ROTATE_270 = "8";
    private static final String ORIENTATION_ROTATE_180 = "3";

    private ImageButton shutter;
    private ImageButton flash;
    private ImageButton queue;
    private ImageButton cancel;

    private ImageView upperLeftThumbnail;
    private ImageView upperRightThumbnail;
    private ImageView lowerLeftThumbnail;
    private ImageView lowerRightThumbnail;
    private TextView badgeCount;
    private int quadState;  //0 = UL , 1 = UR, 2 = LL, 3 = LR
    private int flashState = 2;//camera_flash_auto
    private android.content.Context thisRef;
    File mediaStorageDir;
    File mediaThumbStorageDir;
    Display display;

    private int degrees = 0;

    protected HappieCameraThumb thumbGen = new HappieCameraThumb();

    private Camera mCamera;

    private HappieCameraJSON base;

    /**
     * UI State Functions
     */
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.happie_cam_layout);
        onCreateTasks();
        setCamOrientation();
    }

    protected void onCreateTasks() {

        OrientationEventListener orientationListener = new OrientationEventListener(this, SensorManager.SENSOR_DELAY_NORMAL) {
            @Override
            public void onOrientationChanged(int arg0) {
                //TODO update camera orientation with arg0
                //Log.d(TAG, "OrientationChanged called: " + arg0);
                degrees = arg0;
            }
        };

        base = new HappieCameraJSON();

        display = getWindowManager().getDefaultDisplay();

        if (orientationListener.canDetectOrientation()) orientationListener.enable();

        cancel = (ImageButton) findViewById(R.id.cancel);
        cancel.setOnClickListener(cancelSession);

        shutter = (ImageButton) findViewById(R.id.shutter);
        shutter.setOnClickListener(captureImage);

        queue = (ImageButton) findViewById(R.id.confirm);
        queue.setOnClickListener(cameraFinishToQueue);


        flash = (ImageButton) findViewById(R.id.flashToggle);
        flash.setOnClickListener(switchFlash);

        upperLeftThumbnail = (ImageView) findViewById(R.id.UpperLeft);
        upperRightThumbnail = (ImageView) findViewById(R.id.UpperRight);
        lowerLeftThumbnail = (ImageView) findViewById(R.id.LowerLeft);
        lowerRightThumbnail = (ImageView) findViewById(R.id.LowerRight);
        badgeCount = (TextView) findViewById(R.id.badgeCount);

        quadState = 0;

{'fraction_non_alphanumeric': 0.08410067526089625, 'fraction_numerical': 0.006384284837323511, 'mean_word_length': 3.7526254375729287, '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': '3816043', 'n_tokens_mistral': 2314, 'n_tokens_neox': 2157, 'n_words': 540}