# HG changeset patch # User John Tsiombikas # Date 1431656147 -10800 # Node ID 9df99687a2ff30c51502c237a9c76cd57f2b1632 # Parent cf5964db7ff302ca6b07a8e5d73f8cf546a1e722 the old camera API is horrible diff -r cf5964db7ff3 -r 9df99687a2ff android/manifest.xml.in --- a/android/manifest.xml.in Fri May 15 02:06:26 2015 +0300 +++ b/android/manifest.xml.in Fri May 15 05:15:47 2015 +0300 @@ -4,7 +4,10 @@ android:versionCode="1" android:versionName="1.0"> - + + + + diff -r cf5964db7ff3 -r 9df99687a2ff src/android/MainActivity.java --- a/src/android/MainActivity.java Fri May 15 02:06:26 2015 +0300 +++ b/src/android/MainActivity.java Fri May 15 05:15:47 2015 +0300 @@ -2,11 +2,99 @@ import android.app.NativeActivity; import android.util.Log; +/* +import android.os.Bundle; +import android.content.Context; +import android.hardware.Camera; +import android.hardware.Camera.CameraInfo; +import android.hardware.camera2.*; +*/ public class MainActivity extends NativeActivity { + private static String tag = "photoshoot3d"; + public static int foo(String s, int n) { - Log.i("photoshoot3d", s + ": " + n); + Log.i(tag, s + ": " + n); return 42; } + + /* + // old camera api (fallback) + private Camera cam; + + // camera2 api (sdk version >= 21) + private CameraManager cman; + private CameraDevice cam2; + private CameraCaptureSession cam_session; + + @Override + protected void onCreate(Bundle state) + { + super.onCreate(state); + + if(android.os.Build.VERSION.SDK_INT >= 21) { + Log.i(tag, "Using the new camera API"); + + cman = (CameraManager)getSystemService(Context.CAMERA_SERVICE); + + try { + String [] clist = cman.getCameraIdList(); + Log.i(tag, "Found " + clist.length + " cameras"); + + for(int i=0; i