Sha256: 0f4424a94ea898d4c4ccdb8a64eab0169e1ad327154c952ef395a10a67ee3a67

Contents?: true

Size: 1.96 KB

Versions: 51

Compression:

Stored size: 1.96 KB

Contents

/*
 ============================================================================
 Author	    : Dmitry Moskalchuk
 Version	: 1.5
 Copyright  : Copyright (C) 2008 Rhomobile. All rights reserved.

 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.
 ============================================================================
 */
package com.rhomobile.rhodes.camera;

import java.io.FileOutputStream;
import java.io.OutputStream;

import com.rhomobile.rhodes.Logger;

import android.hardware.Camera;
import android.hardware.Camera.PictureCallback;

public class ImageCaptureCallback implements PictureCallback {
	
	private static final String TAG = "ImageCapture";

	private ImageCapture mOwner;
	private String callbackUrl;
	private OutputStream osCommon;
	private String filePath;

	public ImageCaptureCallback(ImageCapture owner, String u, OutputStream o, String f) {
		mOwner = owner;
		callbackUrl = u;
		osCommon = o;
		filePath = f;
	}

	public void onPictureTaken(byte[] data, Camera camera) {
		try {
			Logger.D(TAG, "PICTURE CALLBACK JPEG: " + data.length + " bytes");

			osCommon.write(data);
			osCommon.flush();
			osCommon.close();
			
			OutputStream osOwn = new FileOutputStream(filePath);
			osOwn.write(data);
			osOwn.flush();
			osOwn.close();

			com.rhomobile.rhodes.camera.Camera.doCallback(callbackUrl, filePath);
			mOwner.finish();

		} catch (Exception e) {
			Logger.E(TAG, e);
			e.printStackTrace();
		}
	}
	
}

Version data entries

51 entries across 51 versions & 1 rubygems

Version Path
rhodes-2.4.0 platform/android/Rhodes/src/com/rhomobile/rhodes/camera/ImageCaptureCallback.java
rhodes-2.4.0.beta.2 platform/android/Rhodes/src/com/rhomobile/rhodes/camera/ImageCaptureCallback.java
rhodes-2.4.0.beta.1 platform/android/Rhodes/src/com/rhomobile/rhodes/camera/ImageCaptureCallback.java
rhodes-2.3.2 platform/android/Rhodes/src/com/rhomobile/rhodes/camera/ImageCaptureCallback.java
rhodes-2.3.2.beta.2 platform/android/Rhodes/src/com/rhomobile/rhodes/camera/ImageCaptureCallback.java
rhodes-2.3.2.beta.1 platform/android/Rhodes/src/com/rhomobile/rhodes/camera/ImageCaptureCallback.java
rhodes-2.3.1 platform/android/Rhodes/src/com/rhomobile/rhodes/camera/ImageCaptureCallback.java
rhodes-2.3.1.beta.1 platform/android/Rhodes/src/com/rhomobile/rhodes/camera/ImageCaptureCallback.java
rhodes-2.3.0 platform/android/Rhodes/src/com/rhomobile/rhodes/camera/ImageCaptureCallback.java
rhodes-2.3.0.beta.3 platform/android/Rhodes/src/com/rhomobile/rhodes/camera/ImageCaptureCallback.java
rhodes-2.3.0.beta.2 platform/android/Rhodes/src/com/rhomobile/rhodes/camera/ImageCaptureCallback.java
rhodes-2.3.0.beta.1 platform/android/Rhodes/src/com/rhomobile/rhodes/camera/ImageCaptureCallback.java
rhodes-2.2.6 platform/android/Rhodes/src/com/rhomobile/rhodes/camera/ImageCaptureCallback.java
rhodes-2.2.6.beta.1 platform/android/Rhodes/src/com/rhomobile/rhodes/camera/ImageCaptureCallback.java
rhodes-2.2.5 platform/android/Rhodes/src/com/rhomobile/rhodes/camera/ImageCaptureCallback.java
rhodes-2.2.5.beta.3 platform/android/Rhodes/src/com/rhomobile/rhodes/camera/ImageCaptureCallback.java
rhodes-2.2.5.beta.2 platform/android/Rhodes/src/com/rhomobile/rhodes/camera/ImageCaptureCallback.java
rhodes-2.2.5.beta.1 platform/android/Rhodes/src/com/rhomobile/rhodes/camera/ImageCaptureCallback.java
rhodes-2.2.4.beta.1 platform/android/Rhodes/src/com/rhomobile/rhodes/camera/ImageCaptureCallback.java
rhodes-2.2.3 platform/android/Rhodes/src/com/rhomobile/rhodes/camera/ImageCaptureCallback.java