Merge "Add time lapse label for Phone UI."
diff --git a/res/drawable-mdpi/ic_recording_indicator_small.png b/res/drawable-w1024dp-mdpi/ic_recording_indicator.png
similarity index 100%
rename from res/drawable-mdpi/ic_recording_indicator_small.png
rename to res/drawable-w1024dp-mdpi/ic_recording_indicator.png
Binary files differ
diff --git a/res/layout-w1024dp/preview_frame_video.xml b/res/layout-w1024dp/preview_frame_video.xml
index a125187..8b7cb2b 100644
--- a/res/layout-w1024dp/preview_frame_video.xml
+++ b/res/layout-w1024dp/preview_frame_video.xml
@@ -28,26 +28,9 @@
android:layout_width="match_parent"
android:layout_height="match_parent" />
<com.android.camera.ui.RotateLayout android:id="@+id/recording_time_rect"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_margin="20dp"
- android:layout_alignParentTop="true"
- android:layout_alignParentLeft="true">
+ style="@style/ViewfinderLableLayout">
- <LinearLayout android:id="@+id/labels"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content">
- <TextView android:id="@+id/time_lapse_label"
- android:text="@string/time_lapse_title"
- style="@style/OnViewfinderLabel"
- android:visibility="gone" />
- <TextView android:id="@+id/recording_time"
- style="@style/OnViewfinderLabel"
- android:gravity="center"
- android:drawableLeft="@drawable/ic_recording_indicator_small"
- android:drawablePadding="5dp"
- android:visibility="gone"/>
- </LinearLayout>
+ <include layout="@layout/viewfinder_labels_video" android:id="@+id/labels_w1024" />
</com.android.camera.ui.RotateLayout>
<ImageView android:id="@+id/review_image"
android:layout_width="match_parent"
diff --git a/res/layout/indicator_bar.xml b/res/layout/indicator_bar.xml
index cbbfcef..4fe6d45 100644
--- a/res/layout/indicator_bar.xml
+++ b/res/layout/indicator_bar.xml
@@ -23,7 +23,7 @@
<RelativeLayout
android:id="@+id/control_bars"
android:layout_toRightOf="@+id/zoom_index_bar"
- android:layout_width="48dp"
+ android:layout_width="@dimen/indicator_bar_width"
android:layout_height="match_parent">
<com.android.camera.ui.IndicatorControlBar
android:id="@+id/indicator_bar"
diff --git a/res/layout/preview_frame_video.xml b/res/layout/preview_frame_video.xml
index 7bc4a49..c7db06b 100644
--- a/res/layout/preview_frame_video.xml
+++ b/res/layout/preview_frame_video.xml
@@ -26,26 +26,11 @@
android:background="@drawable/border_preview">
<SurfaceView android:id="@+id/camera_preview"
android:layout_width="match_parent"
- android:layout_height="match_parent"/>
+ android:layout_height="match_parent" />
<com.android.camera.ui.RotateLayout android:id="@+id/recording_time_rect"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="13dp"
- android:layout_marginLeft="17dp"
- android:layout_alignParentTop="true"
- android:layout_alignParentLeft="true">
+ style="@style/ViewfinderLableLayout">
- <!-- Note: In this TextView the paddingRight="2"
- attribute is required because otherwise the
- text's drop shadow will be clipped. -->
- <TextView android:id="@+id/recording_time"
- style="@style/RecordingTime"
- android:drawablePadding="8dp"
- android:drawableLeft="@drawable/ic_recording_indicator"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:paddingRight="2dp"
- android:visibility="gone"/>
+ <include layout="@layout/viewfinder_labels_video" android:id="@+id/labels" />
</com.android.camera.ui.RotateLayout>
<ImageView android:id="@+id/review_image"
android:layout_width="match_parent"
diff --git a/res/layout/viewfinder_labels_video.xml b/res/layout/viewfinder_labels_video.xml
new file mode 100644
index 0000000..9e9c892
--- /dev/null
+++ b/res/layout/viewfinder_labels_video.xml
@@ -0,0 +1,31 @@
+<?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.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="horizontal"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <TextView android:id="@+id/recording_time"
+ style="@style/OnViewfinderLabel"
+ android:gravity="center"
+ android:drawableLeft="@drawable/ic_recording_indicator"
+ android:drawablePadding="5dp"
+ android:visibility="gone" />
+ <TextView android:id="@+id/time_lapse_label"
+ android:text="@string/time_lapse_title"
+ style="@style/OnViewfinderLabel"
+ android:visibility="gone" />
+</LinearLayout>
diff --git a/res/values-w1024dp/dimens.xml b/res/values-w1024dp/dimens.xml
index a52bafa..f35facc 100644
--- a/res/values-w1024dp/dimens.xml
+++ b/res/values-w1024dp/dimens.xml
@@ -41,6 +41,7 @@
<dimen name="setting_item_text_width">130dp</dimen>
<dimen name="setting_popup_window_width">410dp</dimen>
<dimen name="setting_item_list_margin">16dp</dimen>
+ <dimen name="indicator_bar_width">13dp</dimen>
<dimen name="popup_title_text_size">22dp</dimen>
<dimen name="popup_title_frame_min_height">60dp</dimen>
<dimen name="big_setting_popup_window_width">590dp</dimen>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index f34b2e5..40e3d25 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -39,6 +39,7 @@
<dimen name="setting_item_text_width">81dp</dimen>
<dimen name="setting_popup_window_width">240dp</dimen>
<dimen name="setting_item_list_margin">6dp</dimen>
+ <dimen name="indicator_bar_width">48dp</dimen>
<dimen name="popup_title_text_size">22dp</dimen>
<dimen name="popup_title_frame_min_height">60dp</dimen>
<dimen name="big_setting_popup_window_width">320dp</dimen>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 05eb0c1..b20dbfc 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -53,10 +53,15 @@
<item name="android:visibility">gone</item>
<item name="android:src">@drawable/ic_gallery_play</item>
</style>
- <style name="RecordingTime">
+ <style name="RecordingLabels">
+ <item name="android:background">@color/on_viewfinder_label_background_color</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">26dp</item>
<item name="android:shadowColor">#c0000000</item>
+ <item name="android:paddingLeft">5dp</item>
+ <item name="android:paddingRight">5dp</item>
+ <item name="android:paddingTop">2dp</item>
+ <item name="android:paddingBottom">2dp</item>
<item name="android:shadowDx">1</item>
<item name="android:shadowDy">1</item>
<item name="android:shadowRadius">1</item>
@@ -141,6 +146,14 @@
<item name="android:visibility">gone</item>
<item name="android:layout_marginRight">8dp</item>
</style>
+ <style name="ViewfinderLableLayout">
+ <item name="android:layout_width">match_parent</item>
+ <item name="android:layout_height">match_parent</item>
+ <item name="android:layout_marginTop">13dp</item>
+ <item name="android:layout_marginBottom">13dp</item>
+ <item name="android:layout_marginLeft">13dp</item>
+ <item name="android:layout_marginRight">@dimen/indicator_bar_width</item>
+ </style>
<style name="OnViewfinderLabel">
<item name="android:gravity">center</item>
<item name="android:layout_width">wrap_content</item>
diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java
index b75fbed..47640ba 100644
--- a/src/com/android/camera/VideoCamera.java
+++ b/src/com/android/camera/VideoCamera.java
@@ -64,6 +64,7 @@
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;
+import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
@@ -130,8 +131,7 @@
private boolean mSnapshotInProgress = false;
- private final static String EFFECT_BG_FROM_GALLERY =
- "gallery";
+ private static final String EFFECT_BG_FROM_GALLERY = "gallery";
private android.hardware.Camera mCameraDevice;
private final CameraErrorCallback mErrorCallback = new CameraErrorCallback();
@@ -162,6 +162,7 @@
private ShutterButton mShutterButton;
private TextView mRecordingTimeView;
private TextView mBgLearningMessage;
+ private LinearLayout mLabelsLinearLayout;
private boolean mIsVideoCaptureIntent;
private boolean mQuickCapture;
@@ -406,6 +407,9 @@
mRecordingTimeRect = (RotateLayout) findViewById(R.id.recording_time_rect);
mOrientationListener = new MyOrientationEventListener(VideoCamera.this);
mTimeLapseLabel = findViewById(R.id.time_lapse_label);
+ // The R.id.labels can only be found in phone layout. For tablet, the id is
+ // R.id.labels_w1024. That is, mLabelsLinearLayout should be null in tablet layout.
+ mLabelsLinearLayout = (LinearLayout) findViewById(R.id.labels);
mBgLearningMessage = (TextView) findViewById(R.id.bg_replace_message);
@@ -530,6 +534,15 @@
if (mModePicker != null) mModePicker.setDegree(degree);
if (mSharePopup != null) mSharePopup.setOrientation(degree);
if (mIndicatorControlContainer != null) mIndicatorControlContainer.setDegree(degree);
+ // We change the orientation of the linearlayout only for phone UI because when in portrait
+ // the width is not enough.
+ if (mLabelsLinearLayout != null) {
+ if (((degree / 90) & 1) == 1) {
+ mLabelsLinearLayout.setOrientation(mLabelsLinearLayout.VERTICAL);
+ } else {
+ mLabelsLinearLayout.setOrientation(mLabelsLinearLayout.HORIZONTAL);
+ }
+ }
mRecordingTimeRect.setOrientation(mOrientationCompensation);
}