summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHung-ying Tyan <tyanh@google.com>2010-12-09 20:20:27 +0800
committerHung-ying Tyan <tyanh@google.com>2010-12-10 16:47:32 +0800
commit373d10b91c8e736275a0bc52e247598eec0b3cea (patch)
tree4a0212cbe430636ea52c8ad4d18cfd49be970337
parent9bbd157589ef9ee4a525bc8bc49586c8ba45b3ae (diff)
downloadLegacyCamera-373d10b91c8e736275a0bc52e247598eec0b3cea.zip
LegacyCamera-373d10b91c8e736275a0bc52e247598eec0b3cea.tar.gz
LegacyCamera-373d10b91c8e736275a0bc52e247598eec0b3cea.tar.bz2
Implement photo/video picker mode using holo controls
Bug: 3253016 Change-Id: I0f851f2840cf1303c06921549028dcbf73d53b61
-rw-r--r--res/drawable-hdpi/ic_menu_cancel_holo_light.pngbin0 -> 605 bytes
-rw-r--r--res/drawable-hdpi/ic_menu_divider.pngbin0 -> 214 bytes
-rw-r--r--res/drawable-hdpi/ic_menu_done_holo_light.pngbin0 -> 562 bytes
-rw-r--r--res/drawable-hdpi/ic_switch_camera_holo_dark.pngbin0 -> 1442 bytes
-rw-r--r--res/drawable-hdpi/ic_switch_video_holo_dark.pngbin0 -> 1233 bytes
-rw-r--r--res/drawable-mdpi/ic_menu_cancel_holo_light.pngbin0 -> 605 bytes
-rw-r--r--res/drawable-mdpi/ic_menu_divider.pngbin0 -> 214 bytes
-rw-r--r--res/drawable-mdpi/ic_menu_done_holo_light.pngbin0 -> 562 bytes
-rw-r--r--res/drawable-mdpi/ic_switch_camera_holo_dark.pngbin0 -> 1442 bytes
-rw-r--r--res/drawable-mdpi/ic_switch_video_holo_dark.pngbin0 -> 1233 bytes
-rwxr-xr-xres/drawable-xlarge-mdpi/btn_ic_review_play.pngbin0 -> 1229 bytes
-rw-r--r--res/drawable-xlarge/btn_review_control.xml21
-rw-r--r--res/layout-xlarge/camera_control.xml1
-rw-r--r--res/layout-xlarge/preview_frame.xml5
-rw-r--r--res/layout-xlarge/preview_frame_video.xml13
-rw-r--r--res/layout-xlarge/review_control.xml58
-rw-r--r--res/values-xlarge/styles.xml13
-rw-r--r--res/values/colors.xml1
-rw-r--r--res/values/strings.xml8
-rw-r--r--src/com/android/camera/Camera.java11
-rw-r--r--src/com/android/camera/VideoCamera.java28
21 files changed, 111 insertions, 48 deletions
diff --git a/res/drawable-hdpi/ic_menu_cancel_holo_light.png b/res/drawable-hdpi/ic_menu_cancel_holo_light.png
new file mode 100644
index 0000000..cb9abb9
--- /dev/null
+++ b/res/drawable-hdpi/ic_menu_cancel_holo_light.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_divider.png b/res/drawable-hdpi/ic_menu_divider.png
new file mode 100644
index 0000000..d6ded3d
--- /dev/null
+++ b/res/drawable-hdpi/ic_menu_divider.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_done_holo_light.png b/res/drawable-hdpi/ic_menu_done_holo_light.png
new file mode 100644
index 0000000..fb56f3a
--- /dev/null
+++ b/res/drawable-hdpi/ic_menu_done_holo_light.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_switch_camera_holo_dark.png b/res/drawable-hdpi/ic_switch_camera_holo_dark.png
new file mode 100644
index 0000000..f417d34
--- /dev/null
+++ b/res/drawable-hdpi/ic_switch_camera_holo_dark.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_switch_video_holo_dark.png b/res/drawable-hdpi/ic_switch_video_holo_dark.png
new file mode 100644
index 0000000..8488819
--- /dev/null
+++ b/res/drawable-hdpi/ic_switch_video_holo_dark.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_cancel_holo_light.png b/res/drawable-mdpi/ic_menu_cancel_holo_light.png
new file mode 100644
index 0000000..cb9abb9
--- /dev/null
+++ b/res/drawable-mdpi/ic_menu_cancel_holo_light.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_divider.png b/res/drawable-mdpi/ic_menu_divider.png
new file mode 100644
index 0000000..d6ded3d
--- /dev/null
+++ b/res/drawable-mdpi/ic_menu_divider.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_done_holo_light.png b/res/drawable-mdpi/ic_menu_done_holo_light.png
new file mode 100644
index 0000000..fb56f3a
--- /dev/null
+++ b/res/drawable-mdpi/ic_menu_done_holo_light.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_switch_camera_holo_dark.png b/res/drawable-mdpi/ic_switch_camera_holo_dark.png
new file mode 100644
index 0000000..f417d34
--- /dev/null
+++ b/res/drawable-mdpi/ic_switch_camera_holo_dark.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_switch_video_holo_dark.png b/res/drawable-mdpi/ic_switch_video_holo_dark.png
new file mode 100644
index 0000000..8488819
--- /dev/null
+++ b/res/drawable-mdpi/ic_switch_video_holo_dark.png
Binary files differ
diff --git a/res/drawable-xlarge-mdpi/btn_ic_review_play.png b/res/drawable-xlarge-mdpi/btn_ic_review_play.png
new file mode 100755
index 0000000..6eca85c
--- /dev/null
+++ b/res/drawable-xlarge-mdpi/btn_ic_review_play.png
Binary files differ
diff --git a/res/drawable-xlarge/btn_review_control.xml b/res/drawable-xlarge/btn_review_control.xml
new file mode 100644
index 0000000..98a44d5
--- /dev/null
+++ b/res/drawable-xlarge/btn_review_control.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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_pressed="true" android:drawable="@color/review_control_pressed_color" />
+ <item android:drawable="@android:color/transparent" />
+</selector>
+
diff --git a/res/layout-xlarge/camera_control.xml b/res/layout-xlarge/camera_control.xml
index 8d500b5..3567816 100644
--- a/res/layout-xlarge/camera_control.xml
+++ b/res/layout-xlarge/camera_control.xml
@@ -87,7 +87,6 @@
android:button="@android:color/transparent"
android:background="@drawable/btn_ic_mode_switch_camera"/>
</com.android.camera.SwitcherSet>
- <include layout="@layout/review_control"/>
<com.android.camera.ui.CameraPicker android:id="@+id/camera_picker"
android:clickable="true"
android:layout_width="wrap_content"
diff --git a/res/layout-xlarge/preview_frame.xml b/res/layout-xlarge/preview_frame.xml
index 5a62280..2872414 100644
--- a/res/layout-xlarge/preview_frame.xml
+++ b/res/layout-xlarge/preview_frame.xml
@@ -35,9 +35,9 @@
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<TextView android:id="@+id/zoom_ratio"
- android:layout_alignParentTop="true"
+ style="@style/OnViewfinderLabel"
android:layout_alignParentRight="true"
- style="@style/OnViewfinderLabel"/>
+ android:layout_below="@+id/review_control"/>
<ImageView style="@style/OnScreenGpsIndicator"
android:id="@+id/onscreen_gps_indicator_no_signal"
android:src="@drawable/ic_viewfinder_gps_no_signal"
@@ -53,5 +53,6 @@
android:layout_margin="10dp"
android:visibility="invisible"/>
<include layout="@layout/review_thumbnail"/>
+ <include layout="@layout/review_control"/>
</RelativeLayout>
</com.android.camera.PreviewFrameLayout>
diff --git a/res/layout-xlarge/preview_frame_video.xml b/res/layout-xlarge/preview_frame_video.xml
index cc46a2a..7649896 100644
--- a/res/layout-xlarge/preview_frame_video.xml
+++ b/res/layout-xlarge/preview_frame_video.xml
@@ -37,24 +37,23 @@
android:visibility="gone" />
<include layout="@layout/review_thumbnail"/>
<TextView android:id="@+id/recording_time"
- style="@style/RecordingTime"
- android:layout_marginTop="20dp"
- android:layout_marginRight="26dp"
- android:layout_alignParentTop="true"
+ style="@style/OnViewfinderLabel"
+ android:layout_below="@+id/review_control"
android:layout_alignParentRight="true"
- android:paddingLeft="8dp"
- android:paddingRight="8dp"
android:gravity="center"
- android:background="@drawable/mode_switch_bg_v2"
android:drawableLeft="@drawable/ic_recording_indicator_small"
android:visibility="gone"/>
+ <include layout="@layout/review_control"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
+ android:background="@color/on_viewfinder_label_background_color"
android:visibility="gone">
<ImageView style="@style/ReviewControlIcon"
android:id="@+id/btn_play"
+ android:paddingTop="10dp"
+ android:paddingBottom="10dp"
android:src="@drawable/btn_ic_review_play"/>
</LinearLayout>
<TextView android:id="@+id/time_lapse_label"
diff --git a/res/layout-xlarge/review_control.xml b/res/layout-xlarge/review_control.xml
index 9c6c5de..83b3175 100644
--- a/res/layout-xlarge/review_control.xml
+++ b/res/layout-xlarge/review_control.xml
@@ -16,39 +16,41 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/review_control"
+ style="@style/ReviewControlGroup"
android:visibility="gone"
- android:orientation="vertical"
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- android:gravity="top|center_horizontal"
- android:layout_alignParentBottom="true"
+ android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
- android:layout_marginRight="180dp">
+ android:layout_marginRight="20dp"
+ android:layout_marginTop="20dp"
+ android:background="@color/on_viewfinder_label_background_color">
+
<LinearLayout style="@style/ReviewControlGroup"
- android:visibility="gone"
- android:layout_alignParentBottom="true"
- android:layout_centerHorizontal="true">
- <ImageView style="@style/ReviewControlIcon"
- android:id="@+id/btn_done"
- android:src="@drawable/btn_ic_review_done"/>
- <TextView style="@style/ReviewControlText"
- android:text="@string/review_ok" />
+ android:visibility="gone">
+ <Button android:id="@+id/btn_done"
+ style="@style/ReviewControlIcon"
+ android:drawableLeft="@drawable/ic_menu_done_holo_light"
+ android:text="@string/review_ok"/>
+ <ImageView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:src="@drawable/ic_menu_divider"/>
</LinearLayout>
<LinearLayout style="@style/ReviewControlGroup"
- android:visibility="gone"
- android:layout_marginBottom="15dp">
- <ImageView style="@style/ReviewControlIcon"
- android:id="@+id/btn_retake"
- android:src="@drawable/btn_ic_review_retake_photo"/>
- <TextView style="@style/ReviewControlText"
- android:text="@string/review_retake" />
+ android:visibility="gone">
+ <Button android:id="@+id/btn_retake"
+ style="@style/ReviewControlIcon"
+ android:scaleType="center"
+ android:clickable="true"
+ android:drawableLeft="@drawable/ic_switch_camera_holo_dark"/>
+ <ImageView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:src="@drawable/ic_menu_divider"/>
</LinearLayout>
- <LinearLayout style="@style/ReviewControlGroup"
- android:layout_marginBottom="15dp">
- <ImageView style="@style/ReviewControlIcon"
- android:id="@+id/btn_cancel"
- android:src="@drawable/btn_ic_review_cancel"/>
- <TextView style="@style/ReviewControlText"
- android:text="@string/review_cancel" />
+ <LinearLayout style="@style/ReviewControlGroup">
+ <Button android:id="@+id/btn_cancel"
+ style="@style/ReviewControlIcon"
+ android:drawableLeft="@drawable/ic_menu_cancel_holo_light"
+ android:text="@string/review_cancel"/>
</LinearLayout>
</LinearLayout>
diff --git a/res/values-xlarge/styles.xml b/res/values-xlarge/styles.xml
index dd9c8f5..f75819b 100644
--- a/res/values-xlarge/styles.xml
+++ b/res/values-xlarge/styles.xml
@@ -20,4 +20,17 @@
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="ThemeCamera" parent="android:Theme.Holo.NoActionBar">
</style>
+ <style name="ReviewControlGroup">
+ <item name="android:orientation">horizontal</item>
+ <item name="android:layout_height">wrap_content</item>
+ <item name="android:layout_width">wrap_content</item>
+ <item name="android:gravity">center</item>
+ </style>
+ <style name="ReviewControlIcon">
+ <item name="android:layout_height">wrap_content</item>
+ <item name="android:layout_width">wrap_content</item>
+ <item name="android:paddingLeft">15dp</item>
+ <item name="android:paddingRight">15dp</item>
+ <item name="android:background">@drawable/btn_review_control</item>
+ </style>
</resources>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 1306c47..530cab7 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -22,4 +22,5 @@
<color name="recording_time_remaining_text">#FFFF0033</color>
<color name="zoom_picker_btn_pressed">#FFFFAD00</color>
<color name="on_viewfinder_label_background_color">#77333333</color>
+ <color name="review_control_pressed_color">#FF6899FF</color>
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 6800f29..8102bc3 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -82,16 +82,16 @@
<string name="confirm_restore_message">Camera settings will be restored to defaults.</string>
<!-- button in review mode indicating that the video just taken should be played -->
- <string name="review_play">PLAY</string>
+ <string name="review_play">Play</string>
<!-- button in review mode indicating that the video recording session should be canceled -->
- <string name="review_cancel">CANCEL</string>
+ <string name="review_cancel">Cancel</string>
<!-- button in review mode indicating that the taken video is OK to be attached/uploaded -->
- <string name="review_ok">OK</string>
+ <string name="review_ok">Ok</string>
<!-- button in review mode indicate the user want to retake another picture for attachment -->
- <string name="review_retake">RETAKE</string>
+ <string name="review_retake">Retake</string>
<!-- button indicating that the picture just taken should be deleted -->
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java
index a22a659..19a739a 100644
--- a/src/com/android/camera/Camera.java
+++ b/src/com/android/camera/Camera.java
@@ -78,6 +78,7 @@ import android.view.ViewStub;
import android.view.Window;
import android.view.WindowManager;
import android.view.MenuItem.OnMenuItemClickListener;
+import android.widget.Button;
import java.io.File;
import java.io.FileNotFoundException;
@@ -2130,6 +2131,10 @@ public class Camera extends NoSearchActivity implements View.OnClickListener,
}
if (mCameraPicker != null) mCameraPicker.setEnabled(false);
if (mZoomPicker != null) mZoomPicker.setEnabled(false);
+
+ // Remove the text of the cancel button
+ View view = findViewById(R.id.btn_cancel);
+ if (view instanceof Button) ((Button) view).setText("");
}
}
@@ -2145,6 +2150,12 @@ public class Camera extends NoSearchActivity implements View.OnClickListener,
}
if (mCameraPicker != null) mCameraPicker.setEnabled(true);
if (mZoomPicker != null) mZoomPicker.setEnabled(true);
+
+ // Restore the text of the cancel button
+ View view = findViewById(R.id.btn_cancel);
+ if (view instanceof Button) {
+ ((Button) view).setText(R.string.review_cancel);
+ }
}
}
diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java
index 270c42d..3bbf9b4 100644
--- a/src/com/android/camera/VideoCamera.java
+++ b/src/com/android/camera/VideoCamera.java
@@ -76,6 +76,7 @@ import android.view.WindowManager;
import android.view.MenuItem.OnMenuItemClickListener;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
+import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
@@ -339,10 +340,14 @@ public class VideoCamera extends NoSearchActivity
reviewControl.findViewById(R.id.btn_cancel).setOnClickListener(this);
reviewControl.findViewById(R.id.btn_done).setOnClickListener(this);
findViewById(R.id.btn_play).setOnClickListener(this);
- ImageView retake =
- (ImageView) reviewControl.findViewById(R.id.btn_retake);
+ View retake = reviewControl.findViewById(R.id.btn_retake);
retake.setOnClickListener(this);
- retake.setImageResource(R.drawable.btn_ic_review_retake_video);
+ if (retake instanceof ImageView) {
+ ((ImageView) retake).setImageResource(R.drawable.btn_ic_review_retake_video);
+ } else {
+ ((Button) retake).setCompoundDrawablesWithIntrinsicBounds(
+ R.drawable.ic_switch_video_holo_dark, 0, 0, 0);
+ }
} else {
setContentView(R.layout.video_camera);
@@ -1434,18 +1439,29 @@ public class VideoCamera extends NoSearchActivity
View button = findViewById(id);
fadeIn(((View) button.getParent()));
}
+
+ // Remove the text of the cancel button
+ View view = findViewById(R.id.btn_cancel);
+ if (view instanceof Button) ((Button) view).setText("");
}
private void hideAlert() {
mVideoFrame.setVisibility(View.INVISIBLE);
fadeIn(findViewById(R.id.shutter_button));
+ mShutterButton.setEnabled(true);
+ if (mCameraPicker != null) mCameraPicker.setEnabled(true);
+
+ // Restore the text of the cancel button
+ View view = findViewById(R.id.btn_cancel);
+ if (view instanceof Button) {
+ ((Button) view).setText(R.string.review_cancel);
+ }
+
int[] pickIds = {R.id.btn_retake, R.id.btn_done, R.id.btn_play};
for (int id : pickIds) {
View button = findViewById(id);
- fadeOut(((View) button.getParent()));
+ ((View) button.getParent()).setVisibility(View.GONE);
}
- if (mCameraPicker != null) mCameraPicker.setEnabled(true);
- mShutterButton.setEnabled(true);
}
private static void fadeIn(View view) {