summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--AndroidManifest.xml8
-rw-r--r--res/layout/video_module.xml1
-rw-r--r--src/com/android/camera/CameraActivity.java13
-rw-r--r--src/com/android/camera/VideoModule.java33
-rw-r--r--src/com/android/camera/VideoUI.java18
-rw-r--r--src/com/android/camera/ui/CameraSwitcher.java10
6 files changed, 55 insertions, 28 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 6079b9fb2..b7748dfe3 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -64,6 +64,14 @@
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
+ <action android:name="android.media.action.VIDEO_CAMERA" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
+ <intent-filter>
+ <action android:name="android.media.action.VIDEO_CAPTURE" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
+ <intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
diff --git a/res/layout/video_module.xml b/res/layout/video_module.xml
index 2df1adc9b..0f4857965 100644
--- a/res/layout/video_module.xml
+++ b/res/layout/video_module.xml
@@ -51,6 +51,7 @@
style="@style/ReviewControlIcon"
android:layout_centerInParent="true"
android:src="@drawable/ic_gallery_play_big"
+ android:scaleType="center"
android:visibility="gone"
android:onClick="onReviewPlayClicked"/>
diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java
index 9ffebc2a6..82d10a98b 100644
--- a/src/com/android/camera/CameraActivity.java
+++ b/src/com/android/camera/CameraActivity.java
@@ -32,6 +32,7 @@ import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
+import android.provider.MediaStore;
import android.provider.Settings;
import android.util.Log;
import android.view.KeyEvent;
@@ -58,7 +59,6 @@ import com.android.camera.ui.FilmStripView;
import com.android.camera.util.CameraUtil;
import com.android.camera.util.PhotoSphereHelper.PanoramaViewHelper;
import com.android.camera.util.PhotoSphereHelper;
-import com.android.camera.util.RefocusHelper;
import com.android.camera2.R;
public class CameraActivity extends Activity
@@ -386,7 +386,13 @@ public class CameraActivity extends Activity
mFilmStripView.setPanoramaViewHelper(mPanoramaViewHelper);
// Set up the camera preview first so the preview shows up ASAP.
mFilmStripView.setListener(mFilmStripListener);
- mCurrentModule = new PhotoModule();
+ if (MediaStore.INTENT_ACTION_VIDEO_CAMERA.equals(getIntent().getAction())
+ || MediaStore.ACTION_VIDEO_CAPTURE.equals(getIntent().getAction())) {
+ mCurrentModule = new VideoModule();
+ mCurrentModuleIndex = CameraSwitcher.VIDEO_MODULE_INDEX;
+ } else {
+ mCurrentModule = new PhotoModule();
+ }
mCurrentModule.init(this, mRootView);
mOrientationListener = new MyOrientationEventListener(this);
mMainHandler = new Handler(getMainLooper());
@@ -593,9 +599,6 @@ public class CameraActivity extends Activity
case CameraSwitcher.LIGHTCYCLE_MODULE_INDEX:
mCurrentModule = PhotoSphereHelper.createPanoramaModule();
break;
- case CameraSwitcher.REFOCUS_MODULE_INDEX:
- mCurrentModule = RefocusHelper.createRefocusModule();
- break;
default:
break;
}
diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java
index 90915334e..b28b66ffd 100644
--- a/src/com/android/camera/VideoModule.java
+++ b/src/com/android/camera/VideoModule.java
@@ -198,6 +198,8 @@ public class VideoModule implements CameraModule,
@Override
public void onMediaSaved(Uri uri) {
if (uri != null) {
+ mCurrentVideoUri = uri;
+ onVideoSaved();
mActivity.notifyNewMedia(uri);
}
}
@@ -550,6 +552,12 @@ public class VideoModule implements CameraModule,
}
}
+ public void onVideoSaved() {
+ if (mIsVideoCaptureIntent) {
+ showCaptureResult();
+ }
+ }
+
public void onProtectiveCurtainClick(View v) {
// Consume clicks
}
@@ -1488,9 +1496,15 @@ public class VideoModule implements CameraModule,
if (mVideoFileDescriptor != null) {
bitmap = Thumbnail.createVideoThumbnailBitmap(mVideoFileDescriptor.getFileDescriptor(),
mDesiredPreviewWidth);
- } else if (mCurrentVideoFilename != null) {
- bitmap = Thumbnail.createVideoThumbnailBitmap(mCurrentVideoFilename,
- mDesiredPreviewWidth);
+ } else if (mCurrentVideoUri != null) {
+ try {
+ mVideoFileDescriptor = mContentResolver.openFileDescriptor(mCurrentVideoUri, "r");
+ bitmap = Thumbnail.createVideoThumbnailBitmap(
+ mVideoFileDescriptor.getFileDescriptor(), mDesiredPreviewWidth);
+ } catch (java.io.FileNotFoundException ex) {
+ // invalid uri
+ Log.e(TAG, ex.toString());
+ }
}
if (bitmap != null) {
// MetadataRetriever already rotates the thumbnail. We should rotate
@@ -1524,7 +1538,9 @@ public class VideoModule implements CameraModule,
private boolean stopVideoRecording() {
Log.v(TAG, "stopVideoRecording");
mUI.setSwipingEnabled(true);
- mUI.showSwitcher();
+ if (!isVideoCaptureIntent()) {
+ mUI.showSwitcher();
+ }
boolean fail = false;
if (mMediaRecorderRecording) {
@@ -1580,8 +1596,13 @@ public class VideoModule implements CameraModule,
// reflect the device orientation as video recording is stopped.
mUI.setOrientationIndicator(0, true);
keepScreenOnAwhile();
- if (shouldAddToMediaStoreNow) {
- saveVideo();
+ if (shouldAddToMediaStoreNow && !fail) {
+ if (mVideoFileDescriptor == null) {
+ saveVideo();
+ } else if (mIsVideoCaptureIntent) {
+ // if no file save is needed, we can show the post capture UI now
+ showCaptureResult();
+ }
}
}
// always release media recorder if no effects running
diff --git a/src/com/android/camera/VideoUI.java b/src/com/android/camera/VideoUI.java
index 5c7eca214..684179698 100644
--- a/src/com/android/camera/VideoUI.java
+++ b/src/com/android/camera/VideoUI.java
@@ -189,7 +189,7 @@ public class VideoUI implements PieRenderer.PieListener,
}
private void initializeControlByIntent() {
- mMenuButton = mActivity.findViewById(R.id.menu);
+ mMenuButton = mRootView.findViewById(R.id.menu);
mMenuButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
@@ -199,9 +199,9 @@ public class VideoUI implements PieRenderer.PieListener,
}
});
- mCameraControls = (CameraControls) mActivity.findViewById(R.id.camera_controls);
+ mCameraControls = (CameraControls) mRootView.findViewById(R.id.camera_controls);
mOnScreenIndicators = new OnScreenIndicators(mActivity,
- mActivity.findViewById(R.id.on_screen_indicators));
+ mRootView.findViewById(R.id.on_screen_indicators));
mOnScreenIndicators.resetToDefault();
if (mController.isVideoCaptureIntent()) {
hideSwitcher();
@@ -210,9 +210,9 @@ public class VideoUI implements PieRenderer.PieListener,
// Cannot use RotateImageView for "done" and "cancel" button because
// the tablet layout uses RotateLayout, which cannot be cast to
// RotateImageView.
- mReviewDoneButton = mActivity.findViewById(R.id.btn_done);
- mReviewCancelButton = mActivity.findViewById(R.id.btn_cancel);
- mReviewPlayButton = mActivity.findViewById(R.id.btn_play);
+ mReviewDoneButton = mRootView.findViewById(R.id.btn_done);
+ mReviewCancelButton = mRootView.findViewById(R.id.btn_cancel);
+ mReviewPlayButton = mRootView.findViewById(R.id.btn_play);
mReviewCancelButton.setVisibility(View.VISIBLE);
mReviewDoneButton.setOnClickListener(new OnClickListener() {
@Override
@@ -414,7 +414,7 @@ public class VideoUI implements PieRenderer.PieListener,
}
mGestures.setRenderOverlay(mRenderOverlay);
- mPreviewThumb = mActivity.findViewById(R.id.preview_thumb);
+ mPreviewThumb = mRootView.findViewById(R.id.preview_thumb);
mPreviewThumb.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
@@ -555,7 +555,9 @@ public class VideoUI implements PieRenderer.PieListener,
}
} else {
mShutterButton.setImageResource(R.drawable.btn_new_shutter_video);
- showSwitcher();
+ if (!mController.isVideoCaptureIntent()) {
+ showSwitcher();
+ }
mRecordingTimeView.setVisibility(View.GONE);
if (!ApiHelper.HAS_ZOOM_WHEN_RECORDING && zoomSupported) {
// TODO: enable zoom UI here.
diff --git a/src/com/android/camera/ui/CameraSwitcher.java b/src/com/android/camera/ui/CameraSwitcher.java
index eee68a58c..4a42e34e7 100644
--- a/src/com/android/camera/ui/CameraSwitcher.java
+++ b/src/com/android/camera/ui/CameraSwitcher.java
@@ -36,7 +36,6 @@ import android.widget.LinearLayout;
import com.android.camera.util.CameraUtil;
import com.android.camera.util.PhotoSphereHelper;
-import com.android.camera.util.RefocusHelper;
import com.android.camera.util.UsageStatistics;
import com.android.camera2.R;
import com.android.camera.util.ApiHelper;
@@ -44,18 +43,17 @@ import com.android.camera.util.ApiHelper;
public class CameraSwitcher extends RotateImageView
implements OnClickListener, OnTouchListener {
+ @SuppressWarnings("unused")
private static final String TAG = "CAM_Switcher";
private static final int SWITCHER_POPUP_ANIM_DURATION = 200;
public static final int PHOTO_MODULE_INDEX = 0;
public static final int VIDEO_MODULE_INDEX = 1;
public static final int LIGHTCYCLE_MODULE_INDEX = 2;
- public static final int REFOCUS_MODULE_INDEX = 3;
private static final int[] DRAW_IDS = {
R.drawable.ic_switch_camera,
R.drawable.ic_switch_video,
R.drawable.ic_switch_photosphere,
- R.drawable.ic_switch_refocus
};
public interface CameraSwitchListener {
@@ -104,9 +102,6 @@ public class CameraSwitcher extends RotateImageView
if (!PhotoSphereHelper.hasLightCycleCapture(context)) {
--numDrawIds;
}
- if (!RefocusHelper.hasRefocusCapture(context)) {
- --numDrawIds;
- }
int[] drawids = new int[numDrawIds];
int[] moduleids = new int[numDrawIds];
@@ -115,9 +110,6 @@ public class CameraSwitcher extends RotateImageView
if (i == LIGHTCYCLE_MODULE_INDEX && !PhotoSphereHelper.hasLightCycleCapture(context)) {
continue; // not enabled, so don't add to UI
}
- if (i == REFOCUS_MODULE_INDEX && !RefocusHelper.hasRefocusCapture(context)) {
- continue; // not enabled, so don't add to UI
- }
moduleids[ix] = i;
drawids[ix++] = DRAW_IDS[i];
}