diff options
author | Doris Liu <tianliu@google.com> | 2013-10-15 19:10:28 -0700 |
---|---|---|
committer | Doris Liu <tianliu@google.com> | 2013-10-15 19:24:40 -0700 |
commit | 3a45c33d74fe0ad0ade9be3d037560a53891c627 (patch) | |
tree | 472570a2434bb07b1622afec9ce4e96397cab132 | |
parent | d3e75bd748ce2be8fdcb30575bbde9bd07536bd3 (diff) | |
download | android_packages_apps_Snap-3a45c33d74fe0ad0ade9be3d037560a53891c627.tar.gz android_packages_apps_Snap-3a45c33d74fe0ad0ade9be3d037560a53891c627.tar.bz2 android_packages_apps_Snap-3a45c33d74fe0ad0ade9be3d037560a53891c627.zip |
Show a preview cover until real preview is ready
Bug: 11211650
Change-Id: Ic4b26ef0f03eac0682e7be0d4bcb1c4632d85f39
-rw-r--r-- | res/layout/panorama_module.xml | 6 | ||||
-rw-r--r-- | res/layout/photo_module.xml | 6 | ||||
-rw-r--r-- | res/layout/video_module.xml | 6 | ||||
-rw-r--r-- | src/com/android/camera/PhotoModule.java | 3 | ||||
-rw-r--r-- | src/com/android/camera/PhotoUI.java | 9 | ||||
-rw-r--r-- | src/com/android/camera/VideoModule.java | 1 | ||||
-rw-r--r-- | src/com/android/camera/VideoUI.java | 7 | ||||
-rw-r--r-- | src/com/android/camera/WideAnglePanoramaModule.java | 2 | ||||
-rw-r--r-- | src/com/android/camera/WideAnglePanoramaUI.java | 7 |
9 files changed, 44 insertions, 3 deletions
diff --git a/res/layout/panorama_module.xml b/res/layout/panorama_module.xml index 0b2785a3e..581170f07 100644 --- a/res/layout/panorama_module.xml +++ b/res/layout/panorama_module.xml @@ -19,6 +19,12 @@ android:layout_width="match_parent" android:layout_height="match_parent"> <include layout="@layout/pano_module_capture" /> + <View + android:id="@+id/preview_cover" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="@android:color/black" + android:visibility="gone" /> <include layout="@layout/pano_module_review" /> <include layout="@layout/camera_controls" android:layout_gravity="center" diff --git a/res/layout/photo_module.xml b/res/layout/photo_module.xml index b63d53662..0410f16fc 100644 --- a/res/layout/photo_module.xml +++ b/res/layout/photo_module.xml @@ -33,6 +33,12 @@ android:id="@+id/preview_content" android:layout_width="match_parent" android:layout_height="match_parent" /> + <View + android:id="@+id/preview_cover" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="@android:color/black" + android:visibility="gone" /> </FrameLayout> <ImageView android:id="@+id/review_image" diff --git a/res/layout/video_module.xml b/res/layout/video_module.xml index b4444e7f0..198be8913 100644 --- a/res/layout/video_module.xml +++ b/res/layout/video_module.xml @@ -26,6 +26,12 @@ android:id="@+id/preview_content" android:layout_width="match_parent" android:layout_height="match_parent" /> + <View + android:id="@+id/preview_cover" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="@android:color/black" + android:visibility="gone" /> </FrameLayout> <View android:id="@+id/flash_overlay" diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java index bed8a2149..e9ca280b6 100644 --- a/src/com/android/camera/PhotoModule.java +++ b/src/com/android/camera/PhotoModule.java @@ -1185,6 +1185,7 @@ public class PhotoModule @Override public void onResumeAfterSuper() { + Log.v(TAG, "On resume."); if (mOpenCameraFail || mCameraDisabled) return; mJpegPictureCallbackTime = 0; @@ -1235,6 +1236,8 @@ public class PhotoModule @Override public void onPauseAfterSuper() { + Log.v(TAG, "On pause."); + mUI.showPreviewCover(); // When camera is started from secure lock screen for the first time // after screen on, the activity gets onCreate->onResume->onPause->onResume. // To reduce the latency, keep the camera for a short time so it does diff --git a/src/com/android/camera/PhotoUI.java b/src/com/android/camera/PhotoUI.java index 58df43657..4f66a18cb 100644 --- a/src/com/android/camera/PhotoUI.java +++ b/src/com/android/camera/PhotoUI.java @@ -115,6 +115,7 @@ public class PhotoUI implements PieListener, private TextureView mTextureView; private Matrix mMatrix = null; private float mAspectRatio = 4f / 3f; + private View mPreviewCover; public interface SurfaceTextureSizeChangedListener { public void onSurfaceTextureSizeChanged(int uncroppedWidth, int uncroppedHeight); @@ -196,6 +197,7 @@ public class PhotoUI implements PieListener, (ViewGroup) mRootView, true); mRenderOverlay = (RenderOverlay) mRootView.findViewById(R.id.render_overlay); mFlashOverlay = mRootView.findViewById(R.id.flash_overlay); + mPreviewCover = mRootView.findViewById(R.id.preview_cover); // display the view mTextureView = (TextureView) mRootView.findViewById(R.id.preview_content); mTextureView.setSurfaceTextureListener(this); @@ -256,6 +258,7 @@ public class PhotoUI implements PieListener, @Override public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) { Log.v(TAG, "SurfaceTexture ready."); + mPreviewCover.setVisibility(View.GONE); mSurfaceTexture = surface; mController.onPreviewUIReady(); // Workaround for b/11168275, see b/10981460 for more details @@ -753,6 +756,10 @@ public class PhotoUI implements PieListener, mNotSelectableToast.show(); } + public void showPreviewCover() { + mPreviewCover.setVisibility(View.VISIBLE); + } + public void onPause() { cancelCountDown(); @@ -764,8 +771,6 @@ public class PhotoUI implements PieListener, mLocationDialog.dismiss(); } mLocationDialog = null; - mPreviewWidth = 0; - mPreviewHeight = 0; } public void initDisplayChangeListener() { diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java index fdd48e264..0ee62bb9d 100644 --- a/src/com/android/camera/VideoModule.java +++ b/src/com/android/camera/VideoModule.java @@ -783,6 +783,7 @@ public class VideoModule implements CameraModule, public void onPauseBeforeSuper() { mPaused = true; + mUI.showPreviewCover(); if (mMediaRecorderRecording) { // Camera will be released in onStopVideoRecording. onStopVideoRecording(); diff --git a/src/com/android/camera/VideoUI.java b/src/com/android/camera/VideoUI.java index 23d08dbb4..02b256754 100644 --- a/src/com/android/camera/VideoUI.java +++ b/src/com/android/camera/VideoUI.java @@ -93,6 +93,7 @@ public class VideoUI implements PieRenderer.PieListener, private View mPreviewThumb; private View mFlashOverlay; + private View mPreviewCover; private SurfaceView mSurfaceView = null; private int mPreviewWidth = 0; private int mPreviewHeight = 0; @@ -134,6 +135,10 @@ public class VideoUI implements PieRenderer.PieListener, } }; + public void showPreviewCover() { + mPreviewCover.setVisibility(View.VISIBLE); + } + private class SettingsPopup extends PopupWindow { public SettingsPopup(View popup) { super(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); @@ -168,6 +173,7 @@ public class VideoUI implements PieRenderer.PieListener, mController = controller; mRootView = parent; mActivity.getLayoutInflater().inflate(R.layout.video_module, (ViewGroup) mRootView, true); + mPreviewCover = mRootView.findViewById(R.id.preview_cover); mTextureView = (TextureView) mRootView.findViewById(R.id.preview_content); mTextureView.setSurfaceTextureListener(this); mTextureView.addOnLayoutChangeListener(mLayoutListener); @@ -712,6 +718,7 @@ public class VideoUI implements PieRenderer.PieListener, @Override public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) { mSurfaceTexture = surface; + mPreviewCover.setVisibility(View.GONE); mController.onPreviewUIReady(); } diff --git a/src/com/android/camera/WideAnglePanoramaModule.java b/src/com/android/camera/WideAnglePanoramaModule.java index aa66bdcd3..db4e59d2e 100644 --- a/src/com/android/camera/WideAnglePanoramaModule.java +++ b/src/com/android/camera/WideAnglePanoramaModule.java @@ -805,7 +805,7 @@ public class WideAnglePanoramaModule stopCapture(true); reset(); } - + mUI.showPreviewCover(); releaseCamera(); synchronized (mRendererLock) { mCameraTexture = null; diff --git a/src/com/android/camera/WideAnglePanoramaUI.java b/src/com/android/camera/WideAnglePanoramaUI.java index da49638cc..b0f3de40b 100644 --- a/src/com/android/camera/WideAnglePanoramaUI.java +++ b/src/com/android/camera/WideAnglePanoramaUI.java @@ -89,6 +89,7 @@ public class WideAnglePanoramaUI implements private int mIndicatorColorFast; private int mReviewBackground; private SurfaceTexture mSurfaceTexture; + private View mPreviewCover; /** Constructor. */ public WideAnglePanoramaUI( @@ -225,6 +226,7 @@ public class WideAnglePanoramaUI implements @Override public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int i, int i2) { mSurfaceTexture = surfaceTexture; + mPreviewCover.setVisibility(View.GONE); mController.onPreviewUIReady(); } @@ -346,6 +348,7 @@ public class WideAnglePanoramaUI implements mReviewBackground = appRes.getColor(R.color.review_background); mIndicatorColorFast = appRes.getColor(R.color.pano_progress_indication_fast); + mPreviewCover = mRootView.findViewById(R.id.preview_cover); mPreviewLayout = mRootView.findViewById(R.id.pano_preview_layout); mReviewControl = (ViewGroup) mRootView.findViewById(R.id.pano_review_control); mReviewLayout = mRootView.findViewById(R.id.pano_review_layout); @@ -453,6 +456,10 @@ public class WideAnglePanoramaUI implements ((CameraRootView) mRootView).removeDisplayChangeListener(); } + public void showPreviewCover() { + mPreviewCover.setVisibility(View.VISIBLE); + } + private class DialogHelper { private ProgressDialog mProgressDialog; private AlertDialog mAlertDialog; |