diff options
-rw-r--r-- | src/com/android/camera/Camera.java | 29 | ||||
-rw-r--r-- | src/com/android/camera/VideoCamera.java | 11 |
2 files changed, 26 insertions, 14 deletions
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java index 0256e08..3296912 100644 --- a/src/com/android/camera/Camera.java +++ b/src/com/android/camera/Camera.java @@ -290,7 +290,7 @@ public class Camera extends NoSearchActivity implements View.OnClickListener, // once only. We could have done these things in onCreate() but we want to // make preview screen appear as soon as possible. private void initializeFirstTime() { - if (mFirstTimeInitialized || mPausing || isFinishing()) return; + if (mFirstTimeInitialized) return; // Create orientation listenter. This should be done first because it // takes some time to get first orientation. @@ -308,11 +308,13 @@ public class Camera extends NoSearchActivity implements View.OnClickListener, if (!mIsImageCaptureIntent) { setOrientationIndicator(mLastOrientation); } - mGLRootView.queueEvent(new Runnable() { - public void run() { - mHeadUpDisplay.setOrientation(mLastOrientation); - } - }); + if (mGLRootView != null) { + mGLRootView.queueEvent(new Runnable() { + public void run() { + mHeadUpDisplay.setOrientation(mLastOrientation); + } + }); + } } } }; @@ -1275,10 +1277,12 @@ public class Camera extends NoSearchActivity implements View.OnClickListener, closeCamera(); resetScreenOn(); - mGLRootView.onPause(); - if (mHeadUpDisplay != null) { - mHeadUpDisplay.setGpsHasSignal(false); - mHeadUpDisplay.collapse(); + if (mGLRootView != null) { + mGLRootView.onPause(); + if (mHeadUpDisplay != null) { + mHeadUpDisplay.setGpsHasSignal(false); + mHeadUpDisplay.collapse(); + } } if (mFirstTimeInitialized) { mOrientationListener.disable(); @@ -2064,7 +2068,10 @@ public class Camera extends NoSearchActivity implements View.OnClickListener, private boolean switchToVideoMode() { if (isFinishing() || !isCameraIdle()) return false; MenuHelper.gotoVideoMode(this); - ((ViewGroup) mGLRootView.getParent()).removeView(mGLRootView); + if (mGLRootView != null) { + ((ViewGroup) mGLRootView.getParent()).removeView(mGLRootView); + mGLRootView = null; + } finish(); return true; } diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java index 69d7353..411386a 100644 --- a/src/com/android/camera/VideoCamera.java +++ b/src/com/android/camera/VideoCamera.java @@ -632,8 +632,10 @@ public class VideoCamera extends NoSearchActivity super.onPause(); mPausing = true; - mGLRootView.onPause(); - if (mHeadUpDisplay != null) mHeadUpDisplay.collapse(); + if (mGLRootView != null) { + mGLRootView.onPause(); + if (mHeadUpDisplay != null) mHeadUpDisplay.collapse(); + } // Hide the preview now. Otherwise, the preview may be rotated during // onPause and it is annoying to users. @@ -1397,7 +1399,10 @@ public class VideoCamera extends NoSearchActivity private boolean switchToCameraMode() { if (isFinishing() || mMediaRecorderRecording) return false; MenuHelper.gotoCameraMode(this); - ((ViewGroup) mGLRootView.getParent()).removeView(mGLRootView); + if (mGLRootView != null) { + ((ViewGroup) mGLRootView.getParent()).removeView(mGLRootView); + mGLRootView = null; + } finish(); return true; } |