summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/VideoCamera.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/camera/VideoCamera.java')
-rw-r--r--src/com/android/camera/VideoCamera.java49
1 files changed, 33 insertions, 16 deletions
diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java
index 6dcb42d..d1a81ae 100644
--- a/src/com/android/camera/VideoCamera.java
+++ b/src/com/android/camera/VideoCamera.java
@@ -22,6 +22,7 @@ import com.android.camera.ui.GLRootView;
import com.android.camera.ui.HeadUpDisplay;
import com.android.camera.ui.IndicatorWheel;
import com.android.camera.ui.RotateImageView;
+import com.android.camera.ui.SharePopup;
import com.android.camera.ui.ZoomPicker;
import android.content.ActivityNotFoundException;
@@ -40,7 +41,6 @@ import android.media.CamcorderProfile;
import android.media.MediaRecorder;
import android.media.ThumbnailUtils;
import android.net.Uri;
-import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
@@ -51,6 +51,7 @@ import android.provider.MediaStore.Video;
import android.provider.Settings;
import android.util.Log;
import android.view.GestureDetector;
+import android.view.Gravity;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
@@ -149,14 +150,16 @@ public class VideoCamera extends ActivityBase
private View mReviewControl;
private Toast mNoShareToast;
- // A button showing the last captured video thumbnail. Clicking on it
- // goes to gallery.
+ // A button showing the last captured video thumbnail. Clicking on it will
+ // show the share popup window.
private RotateImageView mThumbnailButton;
+ // A popup window that contains a bigger thumbnail and a list of apps to share.
+ private SharePopup mSharePopup;
// The bitmap of the last captured video thumbnail and the URI of the
// original video.
private Thumbnail mThumbnail;
// An review image having same size as preview. It is displayed when
- // recording is stopped in capture intent or share button is pressed.
+ // recording is stopped in capture intent.
private ImageView mReviewImage;
// A button sharing the last picture.
private RotateImageView mShareButton;
@@ -232,9 +235,10 @@ public class VideoCamera extends ActivityBase
private GestureDetector mPopupGestureDetector;
private MyOrientationEventListener mOrientationListener;
- // The device orientation in degrees. Default is unknown.
+ // The degrees of the device rotated clockwise from its natural orientation.
private int mOrientation = OrientationEventListener.ORIENTATION_UNKNOWN;
- // The orientation compensation for icons and thumbnails.
+ // The orientation compensation for icons and thumbnails. Ex: if the value
+ // is 90, the UI components should be rotated 90 degrees counter-clockwise.
private int mOrientationCompensation = 0;
private int mOrientationHint; // the orientation hint for video playback
@@ -559,11 +563,10 @@ public class VideoCamera extends ActivityBase
final String[] SETTING_KEYS = {
CameraSettings.KEY_VIDEOCAMERA_FLASH_MODE,
+ CameraSettings.KEY_WHITE_BALANCE,
CameraSettings.KEY_VIDEO_QUALITY,
CameraSettings.KEY_VIDEO_TIME_LAPSE_FRAME_INTERVAL};
- final String[] OTHER_SETTING_KEYS = {
- CameraSettings.KEY_WHITE_BALANCE,
- CameraSettings.KEY_COLOR_EFFECT};
+ final String[] OTHER_SETTING_KEYS = {CameraSettings.KEY_COLOR_EFFECT};
mIndicatorWheel.initialize(this, mPreferenceGroup, SETTING_KEYS, OTHER_SETTING_KEYS);
mIndicatorWheel.setListener(new MyIndicatorWheelListener());
mPopupGestureDetector = new GestureDetector(this,
@@ -597,18 +600,17 @@ public class VideoCamera extends ActivityBase
if (!mIsVideoCaptureIntent) {
setOrientationIndicator(mOrientationCompensation);
}
- if (mHeadUpDisplay != null) {
- mHeadUpDisplay.setOrientation(mOrientationCompensation);
- }
}
}
}
private void setOrientationIndicator(int degree) {
+ if (mHeadUpDisplay != null) mHeadUpDisplay.setOrientation(mOrientationCompensation);
if (mThumbnailButton != null) mThumbnailButton.setDegree(degree);
if (mShareButton != null) mShareButton.setDegree(degree);
if (mCameraSwitchIcon != null) mCameraSwitchIcon.setDegree(degree);
if (mVideoSwitchIcon != null) mVideoSwitchIcon.setDegree(degree);
+ if (mSharePopup != null) mSharePopup.setOrientation(degree);
}
private void startPlayVideoActivity() {
@@ -645,7 +647,9 @@ public class VideoCamera extends ActivityBase
gotoGallery();
break;
case R.id.btn_share:
- onShareButtonClicked();
+ if (!mMediaRecorderRecording && mThumbnail != null) {
+ createSharePopup();
+ }
break;
}
}
@@ -976,6 +980,8 @@ public class VideoCamera extends ActivityBase
finishRecorderAndCloseCamera();
+ dismissSharePopup();
+
if (mReceiver != null) {
unregisterReceiver(mReceiver);
mReceiver = null;
@@ -1922,14 +1928,25 @@ public class VideoCamera extends ActivityBase
}
+ private void createSharePopup() {
+ if (mSharePopup != null) mSharePopup.dismiss();
+ mSharePopup = new SharePopup(this, mThumbnail.getUri(),
+ mThumbnail.getBitmap(), mOrientationCompensation, mThumbnailButton);
+ mSharePopup.showAtLocation(mThumbnailButton, Gravity.NO_GRAVITY, 0, 0);
+ }
+
+ private void dismissSharePopup() {
+ if (mSharePopup != null) {
+ mSharePopup.dismiss();
+ mSharePopup = null;
+ }
+ }
+
private void onShareButtonClicked() {
if (mPausing) return;
// Share the last captured video.
if (mThumbnail != null) {
- mReviewImage.setImageBitmap(mThumbnail.getBitmap());
- mReviewImage.setVisibility(View.VISIBLE);
-
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("video/*");
intent.putExtra(Intent.EXTRA_STREAM, mThumbnail.getUri());