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.java77
1 files changed, 49 insertions, 28 deletions
diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java
index 951cb072a..65b6065bf 100644
--- a/src/com/android/camera/CameraActivity.java
+++ b/src/com/android/camera/CameraActivity.java
@@ -100,6 +100,7 @@ import com.android.camera.data.MediaDetails;
import com.android.camera.data.SimpleViewData;
import com.android.camera.exif.ExifInterface;
import com.android.camera.tinyplanet.TinyPlanetFragment;
+import com.android.camera.ui.CameraRootFrame;
import com.android.camera.ui.CameraRootView;
import com.android.camera.ui.ModuleSwitcher;
import com.android.camera.ui.DetailsDialog;
@@ -189,8 +190,14 @@ public class CameraActivity extends Activity
private PlaceholderManager mPlaceholderManager;
private int mCurrentModuleIndex;
private CameraModule mCurrentModule;
+ private PhotoModule mPhotoModule;
+ private VideoModule mVideoModule;
+ private WideAnglePanoramaModule mPanoModule;
private FrameLayout mAboveFilmstripControlLayout;
- private CameraRootView mCameraModuleRootView;
+ private CameraRootFrame mCameraRootFrame;
+ private CameraRootView mCameraPhotoModuleRootView;
+ private CameraRootView mCameraVideoModuleRootView;
+ private CameraRootView mCameraPanoModuleRootView;
private FilmStripView mFilmStripView;
private ProgressBar mBottomProgress;
private View mPanoStitchingPanel;
@@ -1440,7 +1447,12 @@ public class CameraActivity extends Activity
LayoutInflater inflater = getLayoutInflater();
View rootLayout = inflater.inflate(R.layout.camera, null, false);
- mCameraModuleRootView = (CameraRootView) rootLayout.findViewById(R.id.camera_app_root);
+ 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);
int moduleIndex = -1;
if (MediaStore.INTENT_ACTION_VIDEO_CAMERA.equals(getIntent().getAction())
@@ -1481,7 +1493,6 @@ public class CameraActivity extends Activity
mOrientationListener = new MyOrientationEventListener(this);
setModuleFromIndex(moduleIndex);
- mCurrentModule.init(this, mCameraModuleRootView);
mActionBar = getActionBar();
mActionBar.addOnMenuVisibilityListener(this);
@@ -1892,34 +1903,51 @@ public class CameraActivity extends Activity
* index an sets it as mCurrentModule.
*/
private void setModuleFromIndex(int moduleIndex) {
+ mCameraPhotoModuleRootView.setVisibility(View.GONE);
+ mCameraVideoModuleRootView.setVisibility(View.GONE);
+ mCameraPanoModuleRootView.setVisibility(View.GONE);
+ mCameraRootFrame.removeAllViews();
mCurrentModuleIndex = moduleIndex;
+
+ final CameraRootView rootView;
switch (moduleIndex) {
case ModuleSwitcher.VIDEO_MODULE_INDEX:
- mCurrentModule = new VideoModule();
- break;
-
- case ModuleSwitcher.PHOTO_MODULE_INDEX:
- mCurrentModule = new PhotoModule();
+ if (mVideoModule == null) {
+ mVideoModule = new VideoModule();
+ mVideoModule.init(this, mCameraVideoModuleRootView);
+ }
+ mCurrentModule = mVideoModule;
+ rootView = mCameraVideoModuleRootView;
break;
case ModuleSwitcher.WIDE_ANGLE_PANO_MODULE_INDEX:
- mCurrentModule = new WideAnglePanoramaModule();
+ if (mPanoModule == null) {
+ mPanoModule = new WideAnglePanoramaModule();
+ mPanoModule.init(this, mCameraPanoModuleRootView);
+ }
+ mCurrentModule = mPanoModule;
+ rootView = mCameraPanoModuleRootView;
break;
- case ModuleSwitcher.LIGHTCYCLE_MODULE_INDEX:
- mCurrentModule = PhotoSphereHelper.createPanoramaModule();
- break;
- case ModuleSwitcher.GCAM_MODULE_INDEX:
- // Force immediate release of Camera instance
- CameraHolder.instance().strongRelease();
- mCurrentModule = GcamHelper.createGcamModule();
- break;
- default:
- // Fall back to photo mode.
- mCurrentModule = new PhotoModule();
- mCurrentModuleIndex = ModuleSwitcher.PHOTO_MODULE_INDEX;
+ case ModuleSwitcher.PHOTO_MODULE_INDEX:
+ case ModuleSwitcher.LIGHTCYCLE_MODULE_INDEX: //Unused module for now
+ case ModuleSwitcher.GCAM_MODULE_INDEX: //Unused module for now
+ default: // Fall back to photo mode.
+ if (mPhotoModule == null) {
+ mPhotoModule = new PhotoModule();
+ mPhotoModule.init(this, mCameraPhotoModuleRootView);
+ }
+ mCurrentModule = mPhotoModule;
+ rootView = mCameraPhotoModuleRootView;
break;
}
+ mCameraRootFrame.addView(rootView);
+ rootView.setVisibility(View.VISIBLE);
+
+ // Re-apply the last fitSystemWindows() run. Our views rely on this, but
+ // the framework's ActionBarOverlayLayout effectively prevents this if the
+ // actual insets haven't changed.
+ mCameraRootFrame.redoFitSystemWindows();
}
/**
@@ -1957,11 +1985,6 @@ public class CameraActivity extends Activity
}
private void openModule(CameraModule module) {
- module.init(this, mCameraModuleRootView);
- // Re-apply the last fitSystemWindows() run. Our views rely on this, but
- // the framework's ActionBarOverlayLayout effectively prevents this if the
- // actual insets haven't changed.
- mCameraModuleRootView.redoFitSystemWindows();
module.onResumeBeforeSuper();
module.onResumeAfterSuper();
}
@@ -1969,8 +1992,6 @@ public class CameraActivity extends Activity
private void closeModule(CameraModule module) {
module.onPauseBeforeSuper();
module.onPauseAfterSuper();
- ((ViewGroup) mCameraModuleRootView).removeAllViews();
- ((ViewGroup) mCameraModuleRootView).clearDisappearingChildren();
}
private void performDeletion() {