summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/CameraActivity.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/camera/CameraActivity.java')
-rw-r--r--src/com/android/camera/CameraActivity.java55
1 files changed, 43 insertions, 12 deletions
diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java
index 405acfeae..0270b2808 100644
--- a/src/com/android/camera/CameraActivity.java
+++ b/src/com/android/camera/CameraActivity.java
@@ -168,6 +168,8 @@ public class CameraActivity extends Activity
/** Whether onResume should reset the view to the preview. */
private boolean mResetToPreviewOnResume = true;
+ public static boolean CAMERA_2_ON = false;
+
// Supported operations at FilmStripView. Different data has different
// set of supported operations.
private static final int SUPPORT_DELETE = 1 << 0;
@@ -198,11 +200,13 @@ public class CameraActivity extends Activity
private PhotoModule mPhotoModule;
private VideoModule mVideoModule;
private WideAnglePanoramaModule mPanoModule;
+ private CaptureModule mCaptureModule;
private FrameLayout mAboveFilmstripControlLayout;
- private CameraRootFrame mCameraRootFrame;
- private CameraRootView mCameraPhotoModuleRootView;
- private CameraRootView mCameraVideoModuleRootView;
- private CameraRootView mCameraPanoModuleRootView;
+ private FrameLayout mCameraRootFrame;
+ private View mCameraPhotoModuleRootView;
+ private View mCameraVideoModuleRootView;
+ private View mCameraPanoModuleRootView;
+ private View mCameraCaptureModuleRootView;
private FilmStripView mFilmStripView;
private ProgressBar mBottomProgress;
private View mPanoStitchingPanel;
@@ -769,6 +773,7 @@ public class CameraActivity extends Activity
}
public void updateThumbnail(final Bitmap bitmap) {
+ if (bitmap == null) return;
mThumbnailDrawable = new CircularDrawable(bitmap);
if (mThumbnail != null) {
mThumbnail.setImageDrawable(mThumbnailDrawable);
@@ -778,6 +783,7 @@ public class CameraActivity extends Activity
public void updateThumbnail(ImageView thumbnail) {
mThumbnail = thumbnail;
+ if (mThumbnail == null) return;
if (mThumbnailDrawable != null) {
mThumbnail.setImageDrawable(mThumbnailDrawable);
mThumbnail.setVisibility(View.VISIBLE);
@@ -1487,12 +1493,11 @@ public class CameraActivity extends Activity
LayoutInflater inflater = getLayoutInflater();
View rootLayout = inflater.inflate(R.layout.camera, null, false);
- mCameraRootFrame = (CameraRootFrame)rootLayout.findViewById(R.id.camera_root_frame);
- mCameraPhotoModuleRootView =
- (CameraRootView)rootLayout.findViewById(R.id.camera_photo_root);
- mCameraVideoModuleRootView =
- (CameraRootView)rootLayout.findViewById(R.id.camera_video_root);
- mCameraPanoModuleRootView = (CameraRootView)rootLayout.findViewById(R.id.camera_pano_root);
+ mCameraRootFrame = (FrameLayout)rootLayout.findViewById(R.id.camera_root_frame);
+ mCameraPhotoModuleRootView = rootLayout.findViewById(R.id.camera_photo_root);
+ mCameraVideoModuleRootView = rootLayout.findViewById(R.id.camera_video_root);
+ mCameraPanoModuleRootView = rootLayout.findViewById(R.id.camera_pano_root);
+ mCameraCaptureModuleRootView = rootLayout.findViewById(R.id.camera_capture_root);
int moduleIndex = -1;
if (MediaStore.INTENT_ACTION_VIDEO_CAMERA.equals(getIntent().getAction())
@@ -1520,6 +1525,11 @@ public class CameraActivity extends Activity
moduleIndex = ModuleSwitcher.PHOTO_MODULE_INDEX;
}
}
+ SharedPreferences pref = PreferenceManager
+ .getDefaultSharedPreferences(this);
+ CAMERA_2_ON = pref.getBoolean(CameraSettings.KEY_CAMERA2, false);
+ if (CAMERA_2_ON && moduleIndex == ModuleSwitcher.PHOTO_MODULE_INDEX)
+ moduleIndex = ModuleSwitcher.CAPTURE_MODULE_INDEX;
setContentView(R.layout.camera_filmstrip);
@@ -2007,10 +2017,10 @@ public class CameraActivity extends Activity
@Override
public void onModuleSelected(int moduleIndex) {
+ if (moduleIndex == 0 && CAMERA_2_ON) moduleIndex = ModuleSwitcher.CAPTURE_MODULE_INDEX;
if (mCurrentModuleIndex == moduleIndex) {
return;
}
-
CameraHolder.instance().keep();
closeModule(mCurrentModule);
setModuleFromIndex(moduleIndex);
@@ -2035,6 +2045,7 @@ public class CameraActivity extends Activity
mCameraPhotoModuleRootView.setVisibility(View.GONE);
mCameraVideoModuleRootView.setVisibility(View.GONE);
mCameraPanoModuleRootView.setVisibility(View.GONE);
+ mCameraCaptureModuleRootView.setVisibility(View.GONE);
mCurrentModuleIndex = moduleIndex;
switch (moduleIndex) {
case ModuleSwitcher.VIDEO_MODULE_INDEX:
@@ -2046,6 +2057,17 @@ public class CameraActivity extends Activity
mCameraVideoModuleRootView.setVisibility(View.VISIBLE);
break;
+ case ModuleSwitcher.PHOTO_MODULE_INDEX:
+ if(mPhotoModule == null) {
+ mPhotoModule = new PhotoModule();
+ mPhotoModule.init(this, mCameraPhotoModuleRootView);
+ } else {
+ mPhotoModule.reinit();
+ }
+ mCurrentModule = mPhotoModule;
+ mCameraPhotoModuleRootView.setVisibility(View.VISIBLE);
+ break;
+
case ModuleSwitcher.WIDE_ANGLE_PANO_MODULE_INDEX:
if (mPanoModule == null) {
mPanoModule = new WideAnglePanoramaModule();
@@ -2055,7 +2077,16 @@ public class CameraActivity extends Activity
mCameraPanoModuleRootView.setVisibility(View.VISIBLE);
break;
- case ModuleSwitcher.PHOTO_MODULE_INDEX:
+ case ModuleSwitcher.CAPTURE_MODULE_INDEX:
+ if(mCaptureModule == null) {
+ mCaptureModule = new CaptureModule();
+ mCaptureModule.init(this, mCameraCaptureModuleRootView);
+ } else {
+ mCaptureModule.reinit();
+ }
+ mCurrentModule = mCaptureModule;
+ mCameraCaptureModuleRootView.setVisibility(View.VISIBLE);
+ break;
case ModuleSwitcher.LIGHTCYCLE_MODULE_INDEX: //Unused module for now
case ModuleSwitcher.GCAM_MODULE_INDEX: //Unused module for now
default: // Fall back to photo mode.