// Path: app/src/main/java/io/rapidpro/surveyor/Logger.java
// public class Logger {
// 
//     private static final String TAG = "Surveyor";
// 
//     public static void e(String message, Throwable t) {
//         Log.e(TAG, message, t);
//     }
// 
//     public static void w(String message) {
//         Log.w(TAG, message);
//     }
// 
//     public static void d(String message) {
//         Log.d(TAG, message);
//     }
// }


import android.app.Activity;
import android.content.Context;
import android.hardware.Camera;
import android.hardware.SensorManager;
import android.util.Log;
import android.view.Display;
import android.view.OrientationEventListener;
import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.WindowManager;
import java.io.IOException;
import io.rapidpro.surveyor.Logger;
        m_camera.setDisplayOrientation(CameraUtil.getRotationDegrees(m_activity, m_cameraId, true));
    }

    /**
     * Refresh the camera according to it's properties. Use for toggling between
     * front and rear cameras
     */
    public void refreshCamera(Camera camera, int cameraId) {

        if (m_surfaceHolder.getSurface() == null) {
            return;
        }

        if (m_camera != null) {
            try {
                m_camera.stopPreview();
            } catch (Exception e) {
                // we may already be released
            }
        }

        m_camera = camera;
        m_cameraId = cameraId;

        m_camera.setDisplayOrientation(CameraUtil.getRotationDegrees(m_activity, m_cameraId, true));

        try {
            m_camera.setPreviewDisplay(m_surfaceHolder);
            m_camera.startPreview();
        } catch (Exception e) {
// Path: app/src/main/java/io/rapidpro/surveyor/Logger.java
// public class Logger {
// 
//     private static final String TAG = "Surveyor";
// 
//     public static void e(String message, Throwable t) {
//         Log.e(TAG, message, t);
//     }
// 
//     public static void w(String message) {
//         Log.w(TAG, message);
//     }
// 
//     public static void d(String message) {
//         Log.d(TAG, message);
//     }
// }


// Path: app/src/main/java/io/rapidpro/surveyor/ui/CameraPreview.java
import android.app.Activity;
import android.content.Context;
import android.hardware.Camera;
import android.hardware.SensorManager;
import android.util.Log;
import android.view.Display;
import android.view.OrientationEventListener;
import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.WindowManager;
import java.io.IOException;
import io.rapidpro.surveyor.Logger;

        m_camera.setDisplayOrientation(CameraUtil.getRotationDegrees(m_activity, m_cameraId, true));
    }

    /**
     * Refresh the camera according to it's properties. Use for toggling between
     * front and rear cameras
     */
    public void refreshCamera(Camera camera, int cameraId) {

        if (m_surfaceHolder.getSurface() == null) {
            return;
        }

        if (m_camera != null) {
            try {
                m_camera.stopPreview();
            } catch (Exception e) {
                // we may already be released
            }
        }

        m_camera = camera;
        m_cameraId = cameraId;

        m_camera.setDisplayOrientation(CameraUtil.getRotationDegrees(m_activity, m_cameraId, true));

        try {
            m_camera.setPreviewDisplay(m_surfaceHolder);
            m_camera.startPreview();
        } catch (Exception e) {
            Logger.e("Error starting camera preview", e);