summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera
diff options
context:
space:
mode:
authorDoris Liu <tianliu@google.com>2013-08-06 18:15:55 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-08-06 18:15:55 +0000
commit6e20e2330b1b8d531692bce39a0075e49405d1e0 (patch)
treee08bb59bc9b782e2f3aba36dcf0217f9b70f6d97 /src/com/android/camera
parent3d11536f496c6fd6ab0bd29b487c6c5cd84df40b (diff)
parentae7ef761a14a4f84b3a196fc0c71069c8fd3fa56 (diff)
downloadandroid_packages_apps_Gallery2-6e20e2330b1b8d531692bce39a0075e49405d1e0.tar.gz
android_packages_apps_Gallery2-6e20e2330b1b8d531692bce39a0075e49405d1e0.tar.bz2
android_packages_apps_Gallery2-6e20e2330b1b8d531692bce39a0075e49405d1e0.zip
Merge "Implement capture animation" into gb-ub-photos-carlsbad
Diffstat (limited to 'src/com/android/camera')
-rw-r--r--src/com/android/camera/AnimationManager.java157
-rw-r--r--src/com/android/camera/PhotoModule.java51
-rw-r--r--src/com/android/camera/PhotoUI.java66
-rw-r--r--src/com/android/camera/Util.java13
-rw-r--r--src/com/android/camera/VideoModule.java38
-rw-r--r--src/com/android/camera/VideoUI.java41
6 files changed, 259 insertions, 107 deletions
diff --git a/src/com/android/camera/AnimationManager.java b/src/com/android/camera/AnimationManager.java
new file mode 100644
index 000000000..41aa4b862
--- /dev/null
+++ b/src/com/android/camera/AnimationManager.java
@@ -0,0 +1,157 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.camera;
+
+import android.animation.Animator;
+import android.animation.AnimatorSet;
+import android.animation.ObjectAnimator;
+import android.view.View;
+
+/**
+ * Class to handle animations.
+ */
+
+public class AnimationManager {
+
+ public static final float FLASH_ALPHA_START = 0.3f;
+ public static final float FLASH_ALPHA_END = 0f;
+ public static final int FLASH_DURATION = 300;
+
+ public static final int SHRINK_DURATION = 400;
+ public static final int HOLD_DURATION = 2500;
+ public static final int SLIDE_DURATION = 1100;
+
+ private ObjectAnimator mFlashAnim;
+ private AnimatorSet mCaptureAnimator;
+
+ /**
+ * Starts capture animation.
+ * @param view a thumbnail view that shows a picture captured and gets animated
+ */
+ public void startCaptureAnimation(final View view) {
+ if (mCaptureAnimator != null && mCaptureAnimator.isStarted()) {
+ mCaptureAnimator.cancel();
+ }
+ View parentView = (View) view.getParent();
+ float slideDistance = (float) (parentView.getWidth() - view.getLeft());
+
+ float scaleX = ((float) parentView.getWidth()) / ((float) view.getWidth());
+ float scaleY = ((float) parentView.getHeight()) / ((float) view.getHeight());
+ float scale = scaleX > scaleY ? scaleX : scaleY;
+
+ int centerX = view.getLeft() + view.getWidth() / 2;
+ int centerY = view.getTop() + view.getHeight() / 2;
+
+ ObjectAnimator slide = ObjectAnimator.ofFloat(view, "translationX", 0f, slideDistance)
+ .setDuration(AnimationManager.SLIDE_DURATION);
+ slide.setStartDelay(AnimationManager.SHRINK_DURATION + AnimationManager.HOLD_DURATION);
+ mCaptureAnimator = new AnimatorSet();
+ mCaptureAnimator.playTogether(
+ ObjectAnimator.ofFloat(view, "scaleX", scale, 1f)
+ .setDuration(AnimationManager.SHRINK_DURATION),
+ ObjectAnimator.ofFloat(view, "scaleY", scale, 1f)
+ .setDuration(AnimationManager.SHRINK_DURATION),
+ ObjectAnimator.ofFloat(view, "translationX",
+ parentView.getWidth() / 2 - centerX, 0f)
+ .setDuration(AnimationManager.SHRINK_DURATION),
+ ObjectAnimator.ofFloat(view, "translationY",
+ parentView.getHeight() / 2 - centerY, 0f)
+ .setDuration(AnimationManager.SHRINK_DURATION),
+ slide);
+ mCaptureAnimator.addListener(new Animator.AnimatorListener() {
+ @Override
+ public void onAnimationStart(Animator animator) {
+ view.setVisibility(View.VISIBLE);
+ }
+
+ @Override
+ public void onAnimationEnd(Animator animator) {
+ view.setScaleX(1f);
+ view.setScaleX(1f);
+ view.setTranslationX(0f);
+ view.setTranslationY(0f);
+ view.setVisibility(View.INVISIBLE);
+ mCaptureAnimator.removeAllListeners();
+ mCaptureAnimator = null;
+ }
+
+ @Override
+ public void onAnimationCancel(Animator animator) {
+ view.setVisibility(View.INVISIBLE);
+ }
+
+ @Override
+ public void onAnimationRepeat(Animator animator) {
+ // Do nothing.
+ }
+ });
+ mCaptureAnimator.start();
+ }
+
+ /**
+ * Starts flash animation.
+ * @params flashOverlay the overlay that will animate on alpha to make the flash impression
+ */
+ public void startFlashAnimation(final View flashOverlay) {
+ // End the previous animation if the previous one is still running
+ if (mFlashAnim != null && mFlashAnim.isRunning()) {
+ mFlashAnim.cancel();
+ }
+ // Start new flash animation.
+ mFlashAnim = ObjectAnimator.ofFloat(flashOverlay, "alpha",
+ AnimationManager.FLASH_ALPHA_START, AnimationManager.FLASH_ALPHA_END);
+ mFlashAnim.setDuration(AnimationManager.FLASH_DURATION);
+ mFlashAnim.addListener(new Animator.AnimatorListener() {
+ @Override
+ public void onAnimationStart(Animator animator) {
+ flashOverlay.setVisibility(View.VISIBLE);
+ }
+
+ @Override
+ public void onAnimationEnd(Animator animator) {
+ flashOverlay.setAlpha(0f);
+ flashOverlay.setVisibility(View.GONE);
+ mFlashAnim.removeAllListeners();
+ mFlashAnim = null;
+ }
+
+ @Override
+ public void onAnimationCancel(Animator animator) {
+ // Do nothing.
+ }
+
+ @Override
+ public void onAnimationRepeat(Animator animator) {
+ // Do nothing.
+ }
+ });
+ mFlashAnim.start();
+ }
+
+ /**
+ * Cancels on-going flash animation and capture animation, if any.
+ */
+ public void cancelAnimations() {
+ // End the previous animation if the previous one is still running
+ if (mFlashAnim != null && mFlashAnim.isRunning()) {
+ mFlashAnim.cancel();
+ }
+ if (mCaptureAnimator != null && mCaptureAnimator.isStarted()) {
+ mCaptureAnimator.cancel();
+ }
+ }
+} \ No newline at end of file
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java
index c65a49ef9..d09c081a1 100644
--- a/src/com/android/camera/PhotoModule.java
+++ b/src/com/android/camera/PhotoModule.java
@@ -104,7 +104,6 @@ public class PhotoModule
private static final int START_PREVIEW_DONE = 10;
private static final int OPEN_CAMERA_FAIL = 11;
private static final int CAMERA_DISABLED = 12;
- private static final int CAPTURE_ANIMATION_DONE = 13;
// The subset of parameters we need to update in setCameraParameters().
private static final int UPDATE_PARAM_INITIALIZE = 1;
@@ -171,13 +170,6 @@ public class PhotoModule
}
};
- private Runnable mFlashRunnable = new Runnable() {
- @Override
- public void run() {
- animateFlash();
- }
- };
-
private final StringBuilder mBuilder = new StringBuilder();
private final Formatter mFormatter = new Formatter(mBuilder);
private final Object[] mFormatterArgs = new Object[1];
@@ -395,10 +387,6 @@ public class PhotoModule
R.string.camera_disabled);
break;
}
- case CAPTURE_ANIMATION_DONE: {
- mUI.enablePreviewThumb(false);
- break;
- }
}
}
}
@@ -685,10 +673,10 @@ public class PhotoModule
private final class ShutterCallback
implements CameraShutterCallback {
- private boolean mAnimateFlash;
+ private boolean mNeedsAnimation;
- public ShutterCallback(boolean animateFlash) {
- mAnimateFlash = animateFlash;
+ public ShutterCallback(boolean needsAnimation) {
+ mNeedsAnimation = needsAnimation;
}
@Override
@@ -696,8 +684,13 @@ public class PhotoModule
mShutterCallbackTime = System.currentTimeMillis();
mShutterLag = mShutterCallbackTime - mCaptureStartTime;
Log.v(TAG, "mShutterLag = " + mShutterLag + "ms");
- if (mAnimateFlash) {
- mActivity.runOnUiThread(mFlashRunnable);
+ if (mNeedsAnimation) {
+ mActivity.runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ animateAfterShutter();
+ }
+ });
}
}
}
@@ -736,9 +729,11 @@ public class PhotoModule
if (mPaused) {
return;
}
- //TODO: We should show the picture taken rather than frozen preview here
if (mIsImageCaptureIntent) {
stopPreview();
+ } else {
+ // Animate capture with real jpeg data instead of a preview frame.
+ mUI.animateCapture(jpegData);
}
if (mSceneMode == Util.SCENE_MODE_HDR) {
mUI.showSwitcher();
@@ -763,18 +758,6 @@ public class PhotoModule
Log.v(TAG, "mPictureDisplayedToJpegCallbackTime = "
+ mPictureDisplayedToJpegCallbackTime + "ms");
- /*TODO:
- // Only animate when in full screen capture mode
- // i.e. If monkey/a user swipes to the gallery during picture taking,
- // don't show animation
- if (ApiHelper.HAS_SURFACE_TEXTURE && !mIsImageCaptureIntent
- && mActivity.mShowCameraAppView) {
- // Finish capture animation
- mHandler.removeMessages(CAPTURE_ANIMATION_DONE);
- ((CameraScreenNail) mActivity.mCameraScreenNail).animateSlide();
- mHandler.sendEmptyMessageDelayed(CAPTURE_ANIMATION_DONE,
- CaptureAnimManager.getAnimationDuration());
- } */
mFocusManager.updateFocusUI(); // Ensure focus indicator is hidden.
if (!mIsImageCaptureIntent) {
if (ApiHelper.CAN_START_PREVIEW_IN_JPEG_CALLBACK) {
@@ -920,16 +903,12 @@ public class PhotoModule
}
}
- private void animateFlash() {
+ private void animateAfterShutter() {
// Only animate when in full screen capture mode
// i.e. If monkey/a user swipes to the gallery during picture taking,
// don't show animation
if (!mIsImageCaptureIntent) {
mUI.animateFlash();
-
- // TODO: mUI.enablePreviewThumb(true);
- // mHandler.sendEmptyMessageDelayed(CAPTURE_ANIMATION_DONE,
- // CaptureAnimManager.getAnimationDuration());
}
}
@@ -949,7 +928,7 @@ public class PhotoModule
final boolean animateBefore = (mSceneMode == Util.SCENE_MODE_HDR);
if (animateBefore) {
- animateFlash();
+ animateAfterShutter();
}
// Set rotation and gps data.
diff --git a/src/com/android/camera/PhotoUI.java b/src/com/android/camera/PhotoUI.java
index d58ed7f13..ecd9bef98 100644
--- a/src/com/android/camera/PhotoUI.java
+++ b/src/com/android/camera/PhotoUI.java
@@ -17,17 +17,15 @@
package com.android.camera;
-import android.animation.Animator;
-import android.animation.ObjectAnimator;
-import android.animation.ValueAnimator;
import android.app.AlertDialog;
import android.content.DialogInterface;
+import android.graphics.Bitmap;
import android.graphics.Matrix;
import android.graphics.SurfaceTexture;
import android.hardware.Camera;
import android.hardware.Camera.Face;
-import android.hardware.Camera.FaceDetectionListener;
import android.hardware.Camera.Size;
+import android.os.AsyncTask;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
@@ -40,6 +38,7 @@ import android.view.ViewGroup;
import android.view.ViewStub;
import android.widget.FrameLayout;
import android.widget.FrameLayout.LayoutParams;
+import android.widget.ImageView;
import android.widget.Toast;
import com.android.camera.CameraPreference.OnPreferenceChangedListener;
@@ -70,6 +69,8 @@ public class PhotoUI implements PieListener,
private static final String TAG = "CAM_UI";
private static final int UPDATE_TRANSFORM_MATRIX = 1;
+ private static final int DOWN_SAMPLE_FACTOR = 4;
+ private final AnimationManager mAnimationManager;
private CameraActivity mActivity;
private PhotoController mController;
private PreviewGestures mGestures;
@@ -109,8 +110,7 @@ public class PhotoUI implements PieListener,
private float mSurfaceTextureUncroppedWidth;
private float mSurfaceTextureUncroppedHeight;
- private View mPreviewThumb;
- private ObjectAnimator mFlashAnim;
+ private ImageView mPreviewThumb;
private View mFlashOverlay;
private SurfaceTextureSizeChangedListener mSurfaceTextureSizeListener;
@@ -157,25 +157,25 @@ public class PhotoUI implements PieListener,
}
};
- private ValueAnimator.AnimatorListener mAnimatorListener =
- new ValueAnimator.AnimatorListener() {
+ private class DecodeTask extends AsyncTask<Integer, Void, Bitmap> {
+ private final byte [] mData;
- @Override
- public void onAnimationCancel(Animator arg0) {}
-
- @Override
- public void onAnimationEnd(Animator arg0) {
- mFlashOverlay.setAlpha(0f);
- mFlashOverlay.setVisibility(View.GONE);
- mFlashAnim.removeListener(this);
+ public DecodeTask(byte[] data) {
+ mData = data;
}
@Override
- public void onAnimationRepeat(Animator arg0) {}
+ protected Bitmap doInBackground(Integer... params) {
+ // Decode image in background.
+ return Util.downSample(mData, DOWN_SAMPLE_FACTOR);
+ }
@Override
- public void onAnimationStart(Animator arg0) {}
- };
+ protected void onPostExecute(Bitmap bitmap) {
+ mPreviewThumb.setImageBitmap(bitmap);
+ mAnimationManager.startCaptureAnimation(mPreviewThumb);
+ }
+ }
public PhotoUI(CameraActivity activity, PhotoController controller, View parent) {
mActivity = activity;
@@ -209,6 +209,7 @@ public class PhotoUI implements PieListener,
}
mCameraControls = (CameraControls) mRootView.findViewById(R.id.camera_controls);
((CameraRootView) mRootView).setDisplayChangeListener(this);
+ mAnimationManager = new AnimationManager();
}
public void onScreenSizeChanged(int width, int height, int previewWidth, int previewHeight) {
@@ -329,6 +330,12 @@ public class PhotoUI implements PieListener,
updateOnScreenIndicators(params, prefGroup, prefs);
}
+ public void animateCapture(final byte[] jpegData) {
+ // Decode jpeg byte array and then animate the jpeg
+ DecodeTask task = new DecodeTask(jpegData);
+ task.execute();
+ }
+
private void openMenu() {
if (mPieRenderer != null) {
// If autofocus is not finished, cancel autofocus so that the
@@ -342,7 +349,7 @@ public class PhotoUI implements PieListener,
public void initializeControlByIntent() {
mBlocker = mRootView.findViewById(R.id.blocker);
- mPreviewThumb = mRootView.findViewById(R.id.preview_thumb);
+ mPreviewThumb = (ImageView) mActivity.findViewById(R.id.preview_thumb);
mPreviewThumb.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
@@ -499,16 +506,7 @@ public class PhotoUI implements PieListener,
}
public void animateFlash() {
- // End the previous animation if the previous one is still running
- if (mFlashAnim != null && mFlashAnim.isRunning()) {
- mFlashAnim.end();
- }
- // Start new flash animation.
- mFlashOverlay.setVisibility(View.VISIBLE);
- mFlashAnim = ObjectAnimator.ofFloat((Object) mFlashOverlay, "alpha", 0.3f, 0f);
- mFlashAnim.setDuration(300);
- mFlashAnim.addListener(mAnimatorListener);
- mFlashAnim.start();
+ mAnimationManager.startFlashAnimation(mFlashOverlay);
}
public void enableGestures(boolean enable) {
@@ -571,14 +569,6 @@ public class PhotoUI implements PieListener,
if (!toCamera && mCountDownView != null) mCountDownView.cancelCountDown();
}
- public void enablePreviewThumb(boolean enabled) {
- if (enabled) {
- mPreviewThumb.setVisibility(View.VISIBLE);
- } else {
- mPreviewThumb.setVisibility(View.GONE);
- }
- }
-
public boolean removeTopLevelPopup() {
// Remove the top level popup or dialog box and return true if there's any
if (mPopup != null) {
diff --git a/src/com/android/camera/Util.java b/src/com/android/camera/Util.java
index ccc2d9079..2c5aa9eab 100644
--- a/src/com/android/camera/Util.java
+++ b/src/com/android/camera/Util.java
@@ -710,6 +710,19 @@ public class Util {
return rotation;
}
+ /**
+ * Down-samples a jpeg byte array.
+ * @param data a byte array of jpeg data
+ * @param downSampleFactor down-sample factor
+ * @return decoded and down-sampled bitmap
+ */
+ public static Bitmap downSample(final byte[] data, int downSampleFactor) {
+ final BitmapFactory.Options opts = new BitmapFactory.Options();
+ // Downsample the image
+ opts.inSampleSize = downSampleFactor;
+ return BitmapFactory.decodeByteArray(data, 0, data.length, opts);
+ }
+
public static void setGpsParameters(Parameters parameters, Location loc) {
// Clear previous GPS location from the parameters.
parameters.removeGpsData();
diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java
index 956890e5e..24bbb2cc1 100644
--- a/src/com/android/camera/VideoModule.java
+++ b/src/com/android/camera/VideoModule.java
@@ -92,8 +92,6 @@ public class VideoModule implements CameraModule,
private static final int SHOW_TAP_TO_SNAPSHOT_TOAST = 7;
private static final int SWITCH_CAMERA = 8;
private static final int SWITCH_CAMERA_START_ANIMATION = 9;
- private static final int HIDE_SURFACE_VIEW = 10;
- private static final int CAPTURE_ANIMATION_DONE = 11;
private static final int SCREEN_DELAY = 2 * 60 * 1000;
@@ -107,7 +105,6 @@ public class VideoModule implements CameraModule,
private static final String EXTRA_QUICK_CAPTURE =
"android.intent.extra.quickCapture";
- private static final int MIN_THUMB_SIZE = 64;
// module fields
private CameraActivity mActivity;
private boolean mPaused;
@@ -295,11 +292,6 @@ public class VideoModule implements CameraModule,
break;
}
- case CAPTURE_ANIMATION_DONE: {
- mUI.enablePreviewThumb(false);
- break;
- }
-
default:
Log.v(TAG, "Unhandled message: " + msg.what);
break;
@@ -555,16 +547,12 @@ public class VideoModule implements CameraModule,
// back to use SurfaceTexture for preview and we need to stop then start
// the preview. This will cause the preview flicker since the preview
// will not be continuous for a short period of time.
- // TODO: need to get the capture animation to work
- // ((CameraScreenNail) mActivity.mCameraScreenNail).animateCapture(mDisplayRotation);
-
- mUI.enablePreviewThumb(true);
- // Make sure to disable the thumbnail preview after the
- // animation is done to disable the click target.
- mHandler.removeMessages(CAPTURE_ANIMATION_DONE);
- mHandler.sendEmptyMessageDelayed(CAPTURE_ANIMATION_DONE,
- CaptureAnimManager.getAnimationDuration());
+ mUI.animateFlash();
+ Bitmap bitmap = getVideoThumbnail();
+ if (bitmap != null) {
+ mUI.animateCapture(bitmap);
+ }
}
}
}
@@ -1425,7 +1413,7 @@ public class VideoModule implements CameraModule,
private void startVideoRecording() {
Log.v(TAG, "startVideoRecording");
- mUI.enablePreviewThumb(false);
+ mUI.cancelAnimations();
mUI.setSwipingEnabled(false);
mActivity.updateStorageSpaceAndHint();
@@ -1502,8 +1490,7 @@ public class VideoModule implements CameraModule,
UsageStatistics.ACTION_CAPTURE_START, "Video");
}
- private void showCaptureResult() {
- mIsInReviewMode = true;
+ private Bitmap getVideoThumbnail() {
Bitmap bitmap = null;
if (mVideoFileDescriptor != null) {
bitmap = Thumbnail.createVideoThumbnailBitmap(mVideoFileDescriptor.getFileDescriptor(),
@@ -1518,9 +1505,16 @@ public class VideoModule implements CameraModule,
CameraInfo[] info = CameraHolder.instance().getCameraInfo();
boolean mirror = (info[mCameraId].facing == CameraInfo.CAMERA_FACING_FRONT);
bitmap = Util.rotateAndMirror(bitmap, 0, mirror);
- mUI.showReviewImage(bitmap);
}
+ return bitmap;
+ }
+ private void showCaptureResult() {
+ mIsInReviewMode = true;
+ Bitmap bitmap = getVideoThumbnail();
+ if (bitmap != null) {
+ mUI.showReviewImage(bitmap);
+ }
mUI.showReviewControls();
mUI.enableCameraControls(false);
mUI.showTimeLapseUI(false);
@@ -2086,7 +2080,7 @@ public class VideoModule implements CameraModule,
if (mParameters == null) return;
if (Util.isVideoSnapshotSupported(mParameters) && !mIsVideoCaptureIntent) {
if (enabled) {
- // TODO: ((CameraScreenNail) mActivity.mCameraScreenNail).animateCapture(mDisplayRotation);
+ mUI.animateFlash();
} else {
mUI.showPreviewBorder(enabled);
}
diff --git a/src/com/android/camera/VideoUI.java b/src/com/android/camera/VideoUI.java
index 551b72596..72587381c 100644
--- a/src/com/android/camera/VideoUI.java
+++ b/src/com/android/camera/VideoUI.java
@@ -16,6 +16,9 @@
package com.android.camera;
+import android.animation.Animator;
+import android.animation.ObjectAnimator;
+import android.animation.ValueAnimator;
import android.graphics.Bitmap;
import android.graphics.Matrix;
import android.graphics.SurfaceTexture;
@@ -91,6 +94,7 @@ public class VideoUI implements PieRenderer.PieListener,
private int mZoomMax;
private List<Integer> mZoomRatios;
private View mPreviewThumb;
+ private View mFlashOverlay;
private SurfaceView mSurfaceView = null;
private int mPreviewWidth = 0;
@@ -99,6 +103,7 @@ public class VideoUI implements PieRenderer.PieListener,
private float mSurfaceTextureUncroppedHeight;
private float mAspectRatio = 4f / 3f;
private Matrix mMatrix = null;
+ private final AnimationManager mAnimationManager;
private final Handler mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
@@ -141,6 +146,7 @@ public class VideoUI implements PieRenderer.PieListener,
mTextureView.setSurfaceTextureListener(this);
mRootView.addOnLayoutChangeListener(mLayoutListener);
((CameraRootView) mRootView).setDisplayChangeListener(this);
+ mFlashOverlay = mRootView.findViewById(R.id.flash_overlay);
mShutterButton = (ShutterButton) mRootView.findViewById(R.id.shutter_button);
mSwitcher = (CameraSwitcher) mRootView.findViewById(R.id.camera_switcher);
mSwitcher.setCurrentIndex(CameraSwitcher.VIDEO_MODULE_INDEX);
@@ -148,6 +154,7 @@ public class VideoUI implements PieRenderer.PieListener,
initializeMiscControls();
initializeControlByIntent();
initializeOverlay();
+ mAnimationManager = new AnimationManager();
}
@@ -266,6 +273,29 @@ public class VideoUI implements PieRenderer.PieListener,
}
}
+ /**
+ * Starts a flash animation
+ */
+ public void animateFlash() {
+ mAnimationManager.startFlashAnimation(mFlashOverlay);
+ }
+
+ /**
+ * Starts a capture animation
+ * @param bitmap the captured image that we shrink and slide in the animation
+ */
+ public void animateCapture(Bitmap bitmap) {
+ ((ImageView) mPreviewThumb).setImageBitmap(bitmap);
+ mAnimationManager.startCaptureAnimation(mPreviewThumb);
+ }
+
+ /**
+ * Cancels on-going animations
+ */
+ public void cancelAnimations() {
+ mAnimationManager.cancelAnimations();
+ }
+
public void hideUI() {
mCameraControls.setVisibility(View.INVISIBLE);
mSwitcher.closePopup();
@@ -623,17 +653,6 @@ public class VideoUI implements PieRenderer.PieListener,
mController.updateCameraOrientation();
}
- /**
- * Enable or disable the preview thumbnail for click events.
- */
- public void enablePreviewThumb(boolean enabled) {
- if (enabled) {
- mPreviewThumb.setVisibility(View.VISIBLE);
- } else {
- mPreviewThumb.setVisibility(View.GONE);
- }
- }
-
private class ZoomChangeListener implements ZoomRenderer.OnZoomChangedListener {
@Override
public void onZoomValueChanged(int index) {