private void doAttach() { if (mPausing) { return; } byte[] data = mImageCapture.getLastCaptureData(); if (mSaveUri != null && data != null) { Bitmap bitmap = createCaptureBitmap(data); OutputStream outputStream = null; try { outputStream = mContentResolver.openOutputStream(mSaveUri); if (bitmap != null) { bitmap.compress(Bitmap.CompressFormat.JPEG, 70, outputStream); outputStream.close(); bitmap.recycle(); setResult(RESULT_OK); } } catch (IOException ex) { ex.printStackTrace(); } finally { closeSilently(outputStream); } } else { setResult(RESULT_CANCELED); } }
@Override protected void onPause() { mPausing = true; stopPreview(); // Close the camera now because other activities may need to use it. closeCamera(); resetScreenOn(); if (mFirstTimeInitialized) { mOrientationListener.disable(); hidePostCaptureAlert(); } // If we are in an image capture intent and has taken // a picture, we just clear it in onPause. mImageCapture.clearLastData(); mImageCapture = null; if (mStorageHint != null) { mStorageHint.cancel(); mStorageHint = null; } // Remove the messages in the event queue. mHandler.removeMessages(RESTART_PREVIEW); mHandler.removeMessages(FIRST_TIME_INIT); super.onPause(); }
public static void inline_signature_capture(String callback_url) { if (ourInlineSignatureView != null) { ImageCapture.takeSignature( callback_url, getSharedInstance().mProperties.imageFormat, ourInlineSignatureView.makeBitmap()); } inlineSignatureHide(RhoExtManager.getInstance()); }
private void doSnap() { // If the user has half-pressed the shutter and focus is completed, we // can take the photo right away. If the focus mode is infinity, we can // also take the photo. if ((mFocusState == FOCUS_SUCCESS || mFocusState == FOCUS_FAIL)) { mImageCapture.onSnap(); } else if (mFocusState == FOCUSING) { // Half pressing the shutter (i.e. the focus button event) will // already have requested AF for us, so just request capture on // focus here. mFocusState = FOCUSING_SNAP_ON_FINISH; } else if (mFocusState == FOCUS_NOT_STARTED) { // Focus key down event is dropped for some reasons. Just ignore. } }