diff options
| -rw-r--r-- | res/drawable/border_preview.xml | 21 | ||||
| -rw-r--r-- | res/layout-w1024dp/preview_frame.xml | 10 | ||||
| -rw-r--r-- | res/layout-w1024dp/preview_frame_video.xml | 19 | ||||
| -rw-r--r-- | res/layout/preview_frame.xml | 15 | ||||
| -rw-r--r-- | res/layout/preview_frame_video.xml | 42 | ||||
| -rw-r--r-- | res/values-w1024dp/dimens.xml | 2 | ||||
| -rw-r--r-- | res/values/arrays.xml | 6 | ||||
| -rw-r--r-- | res/values/dimens.xml | 2 | ||||
| -rw-r--r-- | src/com/android/camera/Camera.java | 30 | ||||
| -rw-r--r-- | src/com/android/camera/PreviewFrameLayout.java | 72 | ||||
| -rw-r--r-- | src/com/android/camera/Util.java | 17 | ||||
| -rw-r--r-- | src/com/android/camera/VideoCamera.java | 32 | ||||
| -rw-r--r-- | src/com/android/camera/panorama/PanoramaActivity.java | 13 | ||||
| -rw-r--r-- | src/com/android/camera/ui/IndicatorButton.java | 2 | ||||
| -rw-r--r-- | src/com/android/camera/ui/OtherSettingIndicatorButton.java | 2 | ||||
| -rw-r--r-- | src/com/android/camera/ui/SecondLevelIndicatorControlBar.java | 6 |
16 files changed, 146 insertions, 145 deletions
diff --git a/res/drawable/border_preview.xml b/res/drawable/border_preview.xml new file mode 100644 index 0000000..8cac1fc --- /dev/null +++ b/res/drawable/border_preview.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2011 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_activated="true" android:drawable="@drawable/ic_snapshot_border" /> + <item android:drawable="@android:color/transparent" /> +</selector> + diff --git a/res/layout-w1024dp/preview_frame.xml b/res/layout-w1024dp/preview_frame.xml index 762fef5..961a407 100644 --- a/res/layout-w1024dp/preview_frame.xml +++ b/res/layout-w1024dp/preview_frame.xml @@ -13,13 +13,13 @@ See the License for the specific language governing permissions and limitations under the License. --> - -<com.android.camera.PreviewFrameLayout xmlns:android="http://schemas.android.com/apk/res/android" +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/frame_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1"> - <RelativeLayout android:id="@+id/frame" + <com.android.camera.PreviewFrameLayout android:id="@+id/frame" + android:layout_centerInParent="true" android:layout_width="match_parent" android:layout_height="match_parent"> <SurfaceView android:id="@+id/camera_preview" @@ -32,5 +32,5 @@ <include layout="@layout/focus_indicator"/> <include layout="@layout/priority_indicators"/> <include layout="@layout/tap_to_focus_toast"/> - </RelativeLayout> -</com.android.camera.PreviewFrameLayout> + </com.android.camera.PreviewFrameLayout> +</RelativeLayout> diff --git a/res/layout-w1024dp/preview_frame_video.xml b/res/layout-w1024dp/preview_frame_video.xml index 8a5ecd5..8099d89 100644 --- a/res/layout-w1024dp/preview_frame_video.xml +++ b/res/layout-w1024dp/preview_frame_video.xml @@ -14,14 +14,16 @@ limitations under the License. --> -<com.android.camera.PreviewFrameLayout xmlns:android="http://schemas.android.com/apk/res/android" +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/frame_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1"> - <RelativeLayout android:id="@+id/frame" + <com.android.camera.PreviewFrameLayout android:id="@+id/frame" android:layout_width="match_parent" - android:layout_height="match_parent"> + android:layout_height="match_parent" + android:layout_centerInParent="true" + android:background="@drawable/border_preview"> <SurfaceView android:id="@+id/camera_preview" android:layout_width="match_parent" android:layout_height="match_parent" /> @@ -59,11 +61,6 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:visibility="gone" - android:background="@android:color/black" /> - </RelativeLayout> - <!-- Border for video snapshot. --> - <View android:id="@+id/preview_border" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:visibility="gone" /> -</com.android.camera.PreviewFrameLayout> + android:background="@android:color/black"/> + </com.android.camera.PreviewFrameLayout> +</RelativeLayout> diff --git a/res/layout/preview_frame.xml b/res/layout/preview_frame.xml index a8b4d99..c225a58 100644 --- a/res/layout/preview_frame.xml +++ b/res/layout/preview_frame.xml @@ -14,13 +14,13 @@ limitations under the License. --> -<com.android.camera.PreviewFrameLayout xmlns:android="http://schemas.android.com/apk/res/android" +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/frame_layout" android:layout_width="match_parent" android:layout_height="match_parent" - android:layout_weight="1" - android:layout_marginLeft="2dp"> - <RelativeLayout android:id="@+id/frame" + android:layout_weight="1"> + <com.android.camera.PreviewFrameLayout android:id="@+id/frame" + android:layout_centerInParent="true" android:layout_width="match_parent" android:layout_height="match_parent"> <SurfaceView android:id="@+id/camera_preview" @@ -33,6 +33,7 @@ <include layout="@layout/focus_indicator"/> <include layout="@layout/priority_indicators"/> <include layout="@layout/tap_to_focus_toast"/> - <include layout="@layout/indicator_bar" /> - </RelativeLayout> -</com.android.camera.PreviewFrameLayout> + </com.android.camera.PreviewFrameLayout> + <include layout="@layout/indicator_bar" /> +</RelativeLayout> + diff --git a/res/layout/preview_frame_video.xml b/res/layout/preview_frame_video.xml index a922c6a..e07de71 100644 --- a/res/layout/preview_frame_video.xml +++ b/res/layout/preview_frame_video.xml @@ -14,15 +14,16 @@ limitations under the License. --> -<com.android.camera.PreviewFrameLayout xmlns:android="http://schemas.android.com/apk/res/android" +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/frame_layout" android:layout_width="match_parent" android:layout_height="match_parent" - android:layout_weight="1" - android:layout_marginLeft="2dip"> - <RelativeLayout android:id="@+id/frame" + android:layout_weight="1"> + <com.android.camera.PreviewFrameLayout android:id="@+id/frame" android:layout_width="match_parent" - android:layout_height="match_parent"> + android:layout_height="match_parent" + android:layout_centerInParent="true" + android:background="@drawable/border_preview"> <SurfaceView android:id="@+id/camera_preview" android:layout_width="match_parent" android:layout_height="match_parent"/> @@ -49,21 +50,18 @@ android:layout_height="match_parent" android:visibility="gone" android:background="@android:color/black"/> - <include layout="@layout/indicator_bar"/> <TextView android:id="@+id/bg_replace_message" - android:layout_width="300dp" - android:layout_height="wrap_content" - android:layout_centerInParent="true" - android:padding="32dp" - android:layout_margin="24dp" - android:textAppearance="?android:attr/textAppearanceMedium" - android:background="@drawable/bg_text_on_preview" - android:visibility="gone" - android:text="@string/bg_replacement_message" /> - </RelativeLayout> - <!-- Border for video snapshot. --> - <View android:id="@+id/preview_border" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:visibility="gone"/> -</com.android.camera.PreviewFrameLayout> + android:layout_width="300dp" + android:layout_height="wrap_content" + android:layout_centerInParent="true" + android:padding="32dp" + android:layout_margin="24dp" + android:textAppearance="?android:attr/textAppearanceMedium" + android:background="@drawable/bg_text_on_preview" + android:visibility="gone" + android:text="@string/bg_replacement_message" /> + </com.android.camera.PreviewFrameLayout> + <!-- Indicator control and popup window frame. --> + <include layout="@layout/indicator_bar" /> +</RelativeLayout> + diff --git a/res/values-w1024dp/dimens.xml b/res/values-w1024dp/dimens.xml index 034b03a..b5a5e95 100644 --- a/res/values-w1024dp/dimens.xml +++ b/res/values-w1024dp/dimens.xml @@ -31,7 +31,7 @@ <dimen name="pano_mosaic_surface_height">480dp</dimen> <dimen name="pano_review_button_width">180dp</dimen> <dimen name="pano_review_button_height">120dp</dimen> - <dimen name="pano_review_saving_indication_size">18sp</dimen> + <dimen name="pano_review_saving_indication_size">22sp</dimen> <dimen name="pano_capture_too_fast_text_height">160dp</dimen> <dimen name="pano_indication_width">300dp</dimen> <dimen name="pano_indication_height">150dp</dimen> diff --git a/res/values/arrays.xml b/res/values/arrays.xml index 868c926..fa301b9 100644 --- a/res/values/arrays.xml +++ b/res/values/arrays.xml @@ -251,6 +251,7 @@ <item>@string/effect_goofy_face_small_eyes</item> <item>@string/effect_backdropper_space</item> <item>@string/effect_backdropper_sunset</item> + <item>@string/effect_backdropper_disco</item> <item>@string/effect_backdropper_gallery</item> </string-array> @@ -262,8 +263,9 @@ <item>goofy_face/small_mouth</item> <item>goofy_face/big_nose</item> <item>goofy_face/small_eyes</item> - <item>backdropper/file:///system/media/video/AndroidInSpace.240p.mp4</item> - <item>backdropper/file:///system/media/video/Sunset.240p.mp4</item> + <item>backdropper/file:///system/media/video/AndroidInSpace.480p.mp4</item> + <item>backdropper/file:///system/media/video/Sunset.480p.mp4</item> + <item>backdropper/file:///system/media/video/Disco.480p.mp4</item> <item>backdropper/gallery</item> </string-array> </resources> diff --git a/res/values/dimens.xml b/res/values/dimens.xml index f0778dd..6224de4 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -27,7 +27,7 @@ <dimen name="pano_mosaic_surface_height">240dp</dimen> <dimen name="pano_review_button_width">70dp</dimen> <dimen name="pano_review_button_height">45dp</dimen> - <dimen name="pano_review_saving_indication_size">12sp</dimen> + <dimen name="pano_review_saving_indication_size">14sp</dimen> <dimen name="pano_capture_too_fast_text_height">70dp</dimen> <dimen name="pano_indication_width">150dp</dimen> <dimen name="pano_indication_height">75dp</dimen> diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java index 345e9b2..5c645a4 100644 --- a/src/com/android/camera/Camera.java +++ b/src/com/android/camera/Camera.java @@ -105,10 +105,6 @@ public class Camera extends ActivityBase implements FocusManager.Listener, // needed to be updated in mUpdateSet. private int mUpdateSet; - // The brightness settings used when it is set to automatic in the system. - // The reason why it is set to 0.7 is just because 1.0 is too bright. - private static final float DEFAULT_CAMERA_BRIGHTNESS = 0.7f; - private static final int SCREEN_DELAY = 2 * 60 * 1000; private static final int ZOOM_STOPPED = 0; @@ -145,6 +141,7 @@ public class Camera extends ActivityBase implements FocusManager.Listener, private boolean mOpenCameraFail = false; private boolean mCameraDisabled = false; + private View mPreviewPanel; // The container of PreviewFrameLayout. private PreviewFrameLayout mPreviewFrameLayout; private View mPreviewFrame; // Preview frame area. @@ -365,7 +362,7 @@ public class Camera extends ActivityBase implements FocusManager.Listener, mFocusIndicator = (RotateLayout) findViewById(R.id.focus_indicator_rotate_layout); mFocusManager.initialize(mFocusIndicator, mPreviewFrame, mFaceView, this); mFocusManager.initializeToneGenerator(); - initializeScreenBrightness(); + Util.initializeScreenBrightness(getWindow(), getContentResolver()); installIntentFilter(); initializeZoom(); // Show the tap to focus toast if this is the first start. @@ -1193,20 +1190,6 @@ public class Camera extends ActivityBase implements FocusManager.Listener, mDidRegister = true; } - private void initializeScreenBrightness() { - Window win = getWindow(); - // Overright the brightness settings if it is automatic - int mode = Settings.System.getInt( - getContentResolver(), - Settings.System.SCREEN_BRIGHTNESS_MODE, - Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL); - if (mode == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC) { - WindowManager.LayoutParams winParams = win.getAttributes(); - winParams.screenBrightness = DEFAULT_CAMERA_BRIGHTNESS; - win.setAttributes(winParams); - } - } - @Override protected void onResume() { super.onResume(); @@ -1343,7 +1326,8 @@ public class Camera extends ActivityBase implements FocusManager.Listener, // Preview area is touched. Handle touch focus. @Override public boolean onTouch(View v, MotionEvent e) { - if (mPausing || !mFirstTimeInitialized || mCameraState == SNAPSHOT_IN_PROGRESS) { + if (mPausing || mCameraDevice == null || !mFirstTimeInitialized + || mCameraState == SNAPSHOT_IN_PROGRESS) { return false; } @@ -1606,7 +1590,8 @@ public class Camera extends ActivityBase implements FocusManager.Listener, // Set the preview frame aspect ratio according to the picture size. Size size = mParameters.getPictureSize(); - mPreviewFrameLayout = (PreviewFrameLayout) findViewById(R.id.frame_layout); + mPreviewPanel = findViewById(R.id.frame_layout); + mPreviewFrameLayout = (PreviewFrameLayout) findViewById(R.id.frame); mPreviewFrameLayout.setAspectRatio((double) size.width / size.height); // Set a preview size that is closest to the viewfinder height and has @@ -1954,8 +1939,9 @@ public class Camera extends ActivityBase implements FocusManager.Listener, private void showSharePopup() { Uri uri = mThumbnail.getUri(); if (mSharePopup == null || !uri.equals(mSharePopup.getUri())) { + // SharePopup window takes the mPreviewPanel as its size reference. mSharePopup = new SharePopup(this, uri, mThumbnail.getBitmap(), - mOrientationCompensation, mPreviewFrameLayout); + mOrientationCompensation, mPreviewPanel); } mSharePopup.showAtLocation(mThumbnailView, Gravity.NO_GRAVITY, 0, 0); } diff --git a/src/com/android/camera/PreviewFrameLayout.java b/src/com/android/camera/PreviewFrameLayout.java index d19ff6d..5d31e2b 100644 --- a/src/com/android/camera/PreviewFrameLayout.java +++ b/src/com/android/camera/PreviewFrameLayout.java @@ -16,13 +16,12 @@ package com.android.camera; -import android.app.Activity; +import com.android.camera.R; + import android.content.Context; +import android.graphics.Rect; import android.util.AttributeSet; -import android.util.DisplayMetrics; -import android.view.View; import android.widget.RelativeLayout; - /** * A layout which handles the preview aspect ratio. */ @@ -33,69 +32,48 @@ public class PreviewFrameLayout extends RelativeLayout { } private double mAspectRatio = 4.0 / 3.0; - private View mFrame; - private View mPreviewBorder; - private final DisplayMetrics mMetrics = new DisplayMetrics(); public PreviewFrameLayout(Context context, AttributeSet attrs) { super(context, attrs); - ((Activity) context).getWindowManager() - .getDefaultDisplay().getMetrics(mMetrics); - } - - @Override - protected void onFinishInflate() { - super.onFinishInflate(); - mFrame = (View) findViewById(R.id.frame); - mPreviewBorder = (View) findViewById(R.id.preview_border); } public void setAspectRatio(double ratio) { if (ratio <= 0.0) throw new IllegalArgumentException(); - if (mAspectRatio != ratio) { mAspectRatio = ratio; requestLayout(); } } + public void showBorder(boolean enabled) { + setActivated(enabled); + } + + @Override - protected void onLayout(boolean changed, int l, int t, int r, int b) { - // Calculate the width and the height of preview frame. - int frameWidth = getWidth(); - int frameHeight = getHeight(); - int hPadding = 0; - int vPadding = 0; - if (mPreviewBorder != null) { - hPadding = mPreviewBorder.getPaddingLeft() + mPreviewBorder.getPaddingRight(); - vPadding = mPreviewBorder.getPaddingBottom() + mPreviewBorder.getPaddingTop(); - } - int previewHeight = frameHeight - vPadding; - int previewWidth = frameWidth - hPadding; + protected void onMeasure(int widthSpec, int heightSpec) { + int previewWidth = MeasureSpec.getSize(widthSpec); + int previewHeight = MeasureSpec.getSize(heightSpec); + + // Get the padding of the border background. + int hPadding = mPaddingLeft + mPaddingRight; + int vPadding = mPaddingTop + mPaddingBottom; + + // Resize the preview frame with correct aspect ratio. + previewWidth -= hPadding; + previewHeight -= vPadding; if (previewWidth > previewHeight * mAspectRatio) { previewWidth = (int) (previewHeight * mAspectRatio + .5); } else { previewHeight = (int) (previewWidth / mAspectRatio + .5); } - // Measure and layout preview frame. - int hSpace = ((r - l) - previewWidth) / 2; - int vSpace = ((b - t) - previewHeight) / 2; - mFrame.measure( - MeasureSpec.makeMeasureSpec(previewWidth, MeasureSpec.EXACTLY), - MeasureSpec.makeMeasureSpec(previewHeight, MeasureSpec.EXACTLY)); - mFrame.layout(hSpace, vSpace, frameWidth + hSpace, frameHeight + vSpace); + // Add the padding of the border. + previewWidth += hPadding; + previewHeight += vPadding; - // Measure and layout the border of preview frame. - if (mPreviewBorder != null) { - frameWidth = previewWidth + hPadding; - frameHeight = previewHeight + vPadding; - hSpace = ((r - l) - frameWidth) / 2; - vSpace = ((b - t) - frameHeight) / 2; - mPreviewBorder.measure( - MeasureSpec.makeMeasureSpec(frameWidth, MeasureSpec.EXACTLY), - MeasureSpec.makeMeasureSpec(frameHeight, MeasureSpec.EXACTLY)); - mPreviewBorder.layout(hSpace, vSpace, frameWidth + hSpace, frameHeight + vSpace); - } + // Ask children to follow the new preview dimension. + super.onMeasure(MeasureSpec.makeMeasureSpec(previewWidth, MeasureSpec.EXACTLY), + MeasureSpec.makeMeasureSpec(previewHeight, MeasureSpec.EXACTLY)); } } diff --git a/src/com/android/camera/Util.java b/src/com/android/camera/Util.java index 906dc1e..c5bc79d 100644 --- a/src/com/android/camera/Util.java +++ b/src/com/android/camera/Util.java @@ -35,6 +35,7 @@ import android.location.Location; import android.net.Uri; import android.os.Build; import android.os.ParcelFileDescriptor; +import android.provider.Settings; import android.telephony.TelephonyManager; import android.util.DisplayMetrics; import android.util.Log; @@ -65,6 +66,11 @@ public class Util { private static final int DIRECTION_UP = 2; private static final int DIRECTION_DOWN = 3; + // The brightness setting used when it is set to automatic in the system. + // The reason why it is set to 0.7 is just because 1.0 is too bright. + // Use the same setting among the Camera, VideoCamera and Panorama modes. + private static final float DEFAULT_CAMERA_BRIGHTNESS = 0.7f; + public static final String REVIEW_ACTION = "com.android.camera.action.REVIEW"; // Private intent extras. Test only. @@ -593,4 +599,15 @@ public class Util { params.systemUiVisibility = View.SYSTEM_UI_FLAG_LOW_PROFILE; window.setAttributes(params); } + + public static void initializeScreenBrightness(Window win, ContentResolver resolver) { + // Overright the brightness settings if it is automatic + int mode = Settings.System.getInt(resolver, Settings.System.SCREEN_BRIGHTNESS_MODE, + Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL); + if (mode == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC) { + WindowManager.LayoutParams winParams = win.getAttributes(); + winParams.screenBrightness = DEFAULT_CAMERA_BRIGHTNESS; + win.setAttributes(winParams); + } + } } diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java index a2d539f..e9c3133 100644 --- a/src/com/android/camera/VideoCamera.java +++ b/src/com/android/camera/VideoCamera.java @@ -111,6 +111,7 @@ public class VideoCamera extends ActivityBase CamcorderProfile.QUALITY_TIME_LAPSE_720P, CamcorderProfile.QUALITY_TIME_LAPSE_480P, CamcorderProfile.QUALITY_TIME_LAPSE_CIF, + CamcorderProfile.QUALITY_TIME_LAPSE_QVGA, CamcorderProfile.QUALITY_TIME_LAPSE_QCIF}; private static final int[] VIDEO_QUALITY = { @@ -118,6 +119,7 @@ public class VideoCamera extends ActivityBase CamcorderProfile.QUALITY_720P, CamcorderProfile.QUALITY_480P, CamcorderProfile.QUALITY_CIF, + CamcorderProfile.QUALITY_QVGA, CamcorderProfile.QUALITY_QCIF}; /** @@ -139,6 +141,7 @@ public class VideoCamera extends ActivityBase private ComboPreferences mPreferences; private PreferenceGroup mPreferenceGroup; + private View mPreviewPanel; // The container of PreviewFrameLayout. private PreviewFrameLayout mPreviewFrameLayout; private SurfaceHolder mSurfaceHolder = null; private IndicatorControlContainer mIndicatorControlContainer; @@ -207,7 +210,6 @@ public class VideoCamera extends ActivityBase // Default 0. If it is larger than 0, the camcorder is in time lapse mode. private int mTimeBetweenTimeLapseFrameCaptureMs = 0; private View mTimeLapseLabel; - private View mPreviewBorder; private int mDesiredPreviewWidth; private int mDesiredPreviewHeight; @@ -336,18 +338,7 @@ public class VideoCamera extends ActivityBase public void onCreate(Bundle icicle) { super.onCreate(icicle); - Window win = getWindow(); - - // Overright the brightness settings if it is automatic - int mode = Settings.System.getInt( - getContentResolver(), - Settings.System.SCREEN_BRIGHTNESS_MODE, - Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL); - if (mode == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC) { - WindowManager.LayoutParams winParams = win.getAttributes(); - winParams.screenBrightness = DEFAULT_CAMERA_BRIGHTNESS; - win.setAttributes(winParams); - } + Util.initializeScreenBrightness(getWindow(), getContentResolver()); mPreferences = new ComboPreferences(this); CameraSettings.upgradeGlobalPreferences(mPreferences.getGlobal()); @@ -399,8 +390,8 @@ public class VideoCamera extends ActivityBase mModePicker.setOnModeChangeListener(this); } - mPreviewFrameLayout = (PreviewFrameLayout) - findViewById(R.id.frame_layout); + mPreviewPanel = findViewById(R.id.frame_layout); + mPreviewFrameLayout = (PreviewFrameLayout) findViewById(R.id.frame); mReviewImage = (ImageView) findViewById(R.id.review_image); // don't set mSurfaceHolder here. We have it set ONLY within @@ -421,7 +412,6 @@ public class VideoCamera extends ActivityBase mRecordingTimeView = (TextView) findViewById(R.id.recording_time); mOrientationListener = new MyOrientationEventListener(VideoCamera.this); mTimeLapseLabel = findViewById(R.id.time_lapse_label); - mPreviewBorder = findViewById(R.id.preview_border); mBgLearningMessage = (TextView) findViewById(R.id.bg_replace_message); @@ -448,7 +438,6 @@ public class VideoCamera extends ActivityBase mBackCameraId = CameraHolder.instance().getBackCameraId(); mFrontCameraId = CameraHolder.instance().getFrontCameraId(); - initializeZoomControl(); initializeIndicatorControl(); } @@ -822,6 +811,10 @@ public class VideoCamera extends ActivityBase return; } } + + // Initializing it here after the preview is started. + initializeZoomControl(); + keepScreenOnAwhile(); // install an intent filter to receive SD card related events. @@ -2048,7 +2041,7 @@ public class VideoCamera extends ActivityBase Uri uri = mThumbnail.getUri(); if (mSharePopup == null || !uri.equals(mSharePopup.getUri())) { mSharePopup = new SharePopup(this, uri, mThumbnail.getBitmap(), - mOrientationCompensation, mPreviewFrameLayout); + mOrientationCompensation, mPreviewPanel); } mSharePopup.showAtLocation(mThumbnailView, Gravity.NO_GRAVITY, 0, 0); } @@ -2173,13 +2166,12 @@ public class VideoCamera extends ActivityBase private void initializeVideoSnapshot() { if (mParameters.isVideoSnapshotSupported() && !mIsVideoCaptureIntent) { findViewById(R.id.camera_preview).setOnTouchListener(this); - mPreviewBorder.setBackgroundResource(R.drawable.ic_snapshot_border); } } void showVideoSnapshotUI(boolean enabled) { if (mParameters.isVideoSnapshotSupported() && !mIsVideoCaptureIntent) { - mPreviewBorder.setVisibility(enabled ? View.VISIBLE : View.INVISIBLE); + mPreviewFrameLayout.showBorder(enabled); mIndicatorControlContainer.enableZoom(!enabled); mShutterButton.setEnabled(!enabled); } diff --git a/src/com/android/camera/panorama/PanoramaActivity.java b/src/com/android/camera/panorama/PanoramaActivity.java index d459740..8126a1b 100644 --- a/src/com/android/camera/panorama/PanoramaActivity.java +++ b/src/com/android/camera/panorama/PanoramaActivity.java @@ -62,6 +62,7 @@ import android.util.Log; import android.view.Gravity; import android.view.OrientationEventListener; import android.view.View; +import android.view.Window; import android.view.WindowManager; import android.view.animation.LinearInterpolator; import android.widget.ImageView; @@ -211,9 +212,11 @@ public class PanoramaActivity extends Activity implements public void onCreate(Bundle icicle) { super.onCreate(icicle); - getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, + Window window = getWindow(); + window.setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); - Util.enterLightsOutMode(getWindow()); + Util.enterLightsOutMode(window); + Util.initializeScreenBrightness(window, getContentResolver()); createContentView(); @@ -252,7 +255,11 @@ public class PanoramaActivity extends Activity implements break; case MSG_GENERATE_FINAL_MOSAIC_ERROR: onBackgroundThreadFinished(); - mAlertDialog.show(); + if (mPausing) { + resetToPreview(); + } else { + mAlertDialog.show(); + } break; case MSG_RESET_TO_PREVIEW: onBackgroundThreadFinished(); diff --git a/src/com/android/camera/ui/IndicatorButton.java b/src/com/android/camera/ui/IndicatorButton.java index 6685358..880a650 100644 --- a/src/com/android/camera/ui/IndicatorButton.java +++ b/src/com/android/camera/ui/IndicatorButton.java @@ -100,7 +100,7 @@ public class IndicatorButton extends AbstractIndicatorButton implements BasicSet protected void initializePopup() { LayoutInflater inflater = (LayoutInflater) mContext.getSystemService( Context.LAYOUT_INFLATER_SERVICE); - ViewGroup root = (ViewGroup) getRootView().findViewById(R.id.frame); + ViewGroup root = (ViewGroup) getRootView().findViewById(R.id.frame_layout); BasicSettingPopup popup = (BasicSettingPopup) inflater.inflate( R.layout.basic_setting_popup, root, false); diff --git a/src/com/android/camera/ui/OtherSettingIndicatorButton.java b/src/com/android/camera/ui/OtherSettingIndicatorButton.java index e020f94..69d627a 100644 --- a/src/com/android/camera/ui/OtherSettingIndicatorButton.java +++ b/src/com/android/camera/ui/OtherSettingIndicatorButton.java @@ -53,7 +53,7 @@ public class OtherSettingIndicatorButton extends AbstractIndicatorButton { protected void initializePopup() { LayoutInflater inflater = (LayoutInflater) mContext.getSystemService( Context.LAYOUT_INFLATER_SERVICE); - ViewGroup root = (ViewGroup) getRootView().findViewById(R.id.frame); + ViewGroup root = (ViewGroup) getRootView().findViewById(R.id.frame_layout); OtherSettingsPopup popup = (OtherSettingsPopup) inflater.inflate( R.layout.other_setting_popup, root, false); diff --git a/src/com/android/camera/ui/SecondLevelIndicatorControlBar.java b/src/com/android/camera/ui/SecondLevelIndicatorControlBar.java index 4b87bdc..670bbb9 100644 --- a/src/com/android/camera/ui/SecondLevelIndicatorControlBar.java +++ b/src/com/android/camera/ui/SecondLevelIndicatorControlBar.java @@ -108,9 +108,11 @@ public class SecondLevelIndicatorControlBar extends IndicatorControl implements int width = right - left; int height = bottom - top; int h = height / count; + + // TODO: follow the redlines of UI design in next change. The icons are + // simply distributed on the bar equally with current implmentation. for (int i = 0; i < count; i++) { - getChildAt(i).layout(0, top + i * height / count, width, - top + i * height / count + h); + getChildAt(i).layout(0, i * h, width, (i + 1) * h); } } |
