diff --git a/src/com/phonegap/demo/CameraHandler.java b/src/com/phonegap/demo/CameraHandler.java deleted file mode 100644 index 13c64bd6..00000000 --- a/src/com/phonegap/demo/CameraHandler.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.phonegap.demo; -/* License (MIT) - * Copyright (c) 2008 Nitobi - * website: http://phonegap.com - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * “Software”), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -import java.io.OutputStream; -import java.text.SimpleDateFormat; - -import android.hardware.Camera; -import android.hardware.Camera.PictureCallback; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; - -public class CameraHandler implements PictureCallback{ - - - private OutputStream oStream; - BitmapFactory photoLab; - - CameraHandler(OutputStream output) - { - oStream = output; - } - - public void onPictureTaken(byte[] graphic, Camera arg1) { - try { - oStream.write(graphic); - oStream.flush(); - oStream.close(); - } - catch (Exception ex) - { - //TO-DO: Put some logging here saying that this epic failed - } - - // Do some other things, like post it to a service! - } - - -} diff --git a/src/com/phonegap/demo/CameraListener.java b/src/com/phonegap/demo/CameraListener.java deleted file mode 100644 index 68ca1770..00000000 --- a/src/com/phonegap/demo/CameraListener.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.phonegap.demo; -/* License (MIT) - * Copyright (c) 2008 Nitobi - * website: http://phonegap.com - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * “Software”), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -import java.io.FileNotFoundException; -import java.io.OutputStream; -import java.text.SimpleDateFormat; -import java.util.Date; - -import android.content.ContentValues; -import android.content.Context; -import android.hardware.Camera; -import android.hardware.Camera.ShutterCallback; -import android.net.Uri; -import android.provider.MediaStore.Images.Media; - -public class CameraListener implements ShutterCallback{ - - private Camera mCam; - private CameraHandler camHand; - private SimpleDateFormat timeStampFormat = new SimpleDateFormat("yyyyMMddHHmmssSS"); - private Context mCtx; - private Uri target = Media.EXTERNAL_CONTENT_URI; - - CameraListener(Context ctx){ - mCam = Camera.open(); - mCtx = ctx; - } - - public void snap() - { - String filename = timeStampFormat.format(new Date()); - ContentValues values = new ContentValues(); - values.put(Media.TITLE, filename); - values.put(Media.DESCRIPTION, "PhoneGap"); - Uri uri = mCtx.getContentResolver().insert(Media.EXTERNAL_CONTENT_URI, values); - try - { - OutputStream output = (OutputStream) mCtx.getContentResolver().openOutputStream(uri); - camHand = new CameraHandler(output); - mCam.takePicture(this, null, camHand); - } - catch (Exception ex) - { - /*TODO: Do some logging here */ - } - } - - public void onShutter() { - /* This is logged */ - - } - -}