From 37f3611bbdc787c996a99894dcef7d8fb77e3f7c Mon Sep 17 00:00:00 2001 From: Sascha Haeberling Date: Tue, 6 Aug 2013 14:31:52 -0700 Subject: This adds the following four CLs to Camera2: http://ag/339319 http://ag/338974 http://ag/338401 http://ag/324149 Adapted to work in Camera2 and adding a .gitignore so that temporary Eclipse files and folders are not submitted. Change-Id: I40295c7f0139f76270c44f0ca395c0574a288569 --- src/com/android/camera/VideoUI.java | 38 ++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) (limited to 'src/com/android/camera/VideoUI.java') diff --git a/src/com/android/camera/VideoUI.java b/src/com/android/camera/VideoUI.java index 06c9795f3..1f6505fcf 100644 --- a/src/com/android/camera/VideoUI.java +++ b/src/com/android/camera/VideoUI.java @@ -91,6 +91,7 @@ public class VideoUI implements PieRenderer.PieListener, private int mZoomMax; private List mZoomRatios; private View mPreviewThumb; + private View mFlashOverlay; private SurfaceView mSurfaceView = null; private int mPreviewWidth = 0; @@ -99,6 +100,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 +143,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 +151,7 @@ public class VideoUI implements PieRenderer.PieListener, initializeMiscControls(); initializeControlByIntent(); initializeOverlay(); + mAnimationManager = new AnimationManager(); } @@ -266,6 +270,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 +650,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) { -- cgit v1.2.3