diff options
-rw-r--r-- | res/layout-w1024dp/preview_frame_video.xml | 12 | ||||
-rw-r--r-- | res/layout-w1024dp/review_control.xml | 42 | ||||
-rw-r--r-- | res/layout/preview_frame_video.xml | 10 | ||||
-rw-r--r-- | res/layout/review_control.xml | 10 | ||||
-rw-r--r-- | res/values-w1024dp/styles.xml | 1 | ||||
-rw-r--r-- | src/com/android/camera/Camera.java | 13 | ||||
-rw-r--r-- | src/com/android/camera/VideoCamera.java | 18 | ||||
-rw-r--r-- | src/com/android/camera/ui/Rotatable.java | 21 | ||||
-rw-r--r-- | src/com/android/camera/ui/RotateImageView.java | 8 | ||||
-rw-r--r-- | src/com/android/camera/ui/RotateLayout.java | 4 |
10 files changed, 102 insertions, 37 deletions
diff --git a/res/layout-w1024dp/preview_frame_video.xml b/res/layout-w1024dp/preview_frame_video.xml index 8b7cb2b..cb9c1c8 100644 --- a/res/layout-w1024dp/preview_frame_video.xml +++ b/res/layout-w1024dp/preview_frame_video.xml @@ -29,7 +29,6 @@ android:layout_height="match_parent" /> <com.android.camera.ui.RotateLayout android:id="@+id/recording_time_rect" style="@style/ViewfinderLableLayout"> - <include layout="@layout/viewfinder_labels_video" android:id="@+id/labels_w1024" /> </com.android.camera.ui.RotateLayout> <ImageView android:id="@+id/review_image" @@ -37,9 +36,14 @@ android:layout_height="match_parent" android:visibility="gone" android:background="@android:color/black"/> - <ImageButton android:id="@+id/btn_play" - style="@style/ReviewPlayIcon" - android:onClick="onPlayButtonClicked" /> + <com.android.camera.ui.RotateImageView + android:id="@+id/btn_play" + style="@style/ReviewControlIcon" + android:layout_centerInParent="true" + android:src="@drawable/ic_gallery_play" + android:background="@drawable/bg_pressed" + android:visibility="gone" + android:onClick="onReviewPlayClicked" /> <TextView android:id="@+id/bg_replace_message" android:layout_width="300dp" android:layout_height="wrap_content" diff --git a/res/layout-w1024dp/review_control.xml b/res/layout-w1024dp/review_control.xml index ba16b7b..ad973e8 100644 --- a/res/layout-w1024dp/review_control.xml +++ b/res/layout-w1024dp/review_control.xml @@ -18,16 +18,22 @@ android:id="@+id/review_control" android:layout_width="match_parent" android:layout_height="match_parent"> - <LinearLayout style="@style/ReviewControlGroup" + <com.android.camera.ui.RotateLayout android:id="@+id/btn_done" - android:onClick="onDoneButtonClicked" + android:layout_width="wrap_content" + android:layout_height="wrap_content" android:layout_alignParentTop="true" + android:layout_centerHorizontal="true" + android:visibility="gone" android:layout_marginTop="36dp"> - <ImageView style="@style/ReviewControlIcon" - android:src="@drawable/ic_menu_done_holo_light" /> - <TextView style="@style/ReviewControlText" - android:text="@string/review_ok" /> - </LinearLayout> + <LinearLayout style="@style/ReviewControlGroup" + android:onClick="onReviewDoneClicked"> + <ImageView style="@style/ReviewControlIcon" + android:src="@drawable/ic_menu_done_holo_light" /> + <TextView style="@style/ReviewControlText" + android:text="@string/review_ok" /> + </LinearLayout> + </com.android.camera.ui.RotateLayout> <ImageView android:id="@+id/btn_retake" android:layout_width="wrap_content" android:layout_height="wrap_content" @@ -36,16 +42,22 @@ android:clickable="true" android:focusable="true" android:visibility="gone" - android:onClick="onRetakeButtonClicked" + android:onClick="onReviewRetakeClicked" android:background="@drawable/btn_shutter_retake" /> - <LinearLayout style="@style/ReviewControlGroup" + <com.android.camera.ui.RotateLayout android:id="@+id/btn_cancel" - android:onClick="onCancelButtonClicked" + android:layout_width="wrap_content" + android:layout_height="wrap_content" android:layout_alignParentBottom="true" + android:layout_centerHorizontal="true" + android:visibility="gone" android:layout_marginBottom="36dp"> - <ImageView style="@style/ReviewControlIcon" - android:src="@drawable/ic_menu_cancel_holo_light" /> - <TextView style="@style/ReviewControlText" - android:text="@string/review_cancel" /> - </LinearLayout> + <LinearLayout style="@style/ReviewControlGroup" + android:onClick="onReviewCancelClicked"> + <ImageView style="@style/ReviewControlIcon" + android:src="@drawable/ic_menu_cancel_holo_light" /> + <TextView style="@style/ReviewControlText" + android:text="@string/review_cancel" /> + </LinearLayout> + </com.android.camera.ui.RotateLayout> </RelativeLayout> diff --git a/res/layout/preview_frame_video.xml b/res/layout/preview_frame_video.xml index 04c25e8..c2823ee 100644 --- a/res/layout/preview_frame_video.xml +++ b/res/layout/preview_frame_video.xml @@ -37,9 +37,13 @@ android:layout_height="match_parent" android:visibility="gone" android:background="@android:color/black"/> - <ImageButton android:id="@+id/btn_play" - style="@style/ReviewPlayIcon" - android:onClick="onPlayButtonClicked"/> + <com.android.camera.ui.RotateImageView + android:id="@+id/btn_play" + style="@style/ReviewControlIcon" + android:layout_centerInParent="true" + android:src="@drawable/ic_gallery_play" + android:visibility="gone" + android:onClick="onReviewPlayClicked"/> <TextView android:id="@+id/bg_replace_message" android:layout_width="300dp" android:layout_height="wrap_content" diff --git a/res/layout/review_control.xml b/res/layout/review_control.xml index 6e725e5..6a25d2c 100644 --- a/res/layout/review_control.xml +++ b/res/layout/review_control.xml @@ -18,12 +18,12 @@ android:id="@+id/review_control" android:layout_width="match_parent" android:layout_height="match_parent"> - <ImageView android:id="@+id/btn_done" + <com.android.camera.ui.RotateImageView android:id="@+id/btn_done" style="@style/ReviewControlIcon" android:visibility="gone" android:layout_alignParentTop="true" android:layout_marginTop="20dp" - android:onClick="onDoneButtonClicked" + android:onClick="onReviewDoneClicked" android:src="@drawable/ic_menu_done_holo_light" /> <ImageView android:id="@+id/btn_retake" android:layout_width="wrap_content" @@ -32,13 +32,13 @@ android:clickable="true" android:focusable="true" android:visibility="gone" - android:onClick="onRetakeButtonClicked" + android:onClick="onReviewRetakeClicked" android:background="@drawable/btn_shutter_retake" /> - <ImageView android:id="@+id/btn_cancel" + <com.android.camera.ui.RotateImageView android:id="@+id/btn_cancel" style="@style/ReviewControlIcon" android:visibility="gone" android:layout_alignParentBottom="true" android:layout_marginBottom="20dp" - android:onClick="onCancelButtonClicked" + android:onClick="onReviewCancelClicked" android:src="@drawable/ic_menu_cancel_holo_light" /> </RelativeLayout> diff --git a/res/values-w1024dp/styles.xml b/res/values-w1024dp/styles.xml index cda7e86..1e354e2 100644 --- a/res/values-w1024dp/styles.xml +++ b/res/values-w1024dp/styles.xml @@ -25,7 +25,6 @@ <item name="android:gravity">center</item> <item name="android:layout_alignParentLeft">true</item> <item name="android:layout_marginLeft">50dp</item> - <item name="android:visibility">gone</item> <item name="android:clickable">true</item> <item name="android:focusable">true</item> <item name="android:background">@drawable/bg_pressed</item> diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java index 33e73ca..5a8d138 100644 --- a/src/com/android/camera/Camera.java +++ b/src/com/android/camera/Camera.java @@ -19,6 +19,7 @@ package com.android.camera; import com.android.camera.ui.CameraPicker; import com.android.camera.ui.FaceView; import com.android.camera.ui.IndicatorControlContainer; +import com.android.camera.ui.Rotatable; import com.android.camera.ui.RotateImageView; import com.android.camera.ui.RotateLayout; import com.android.camera.ui.SharePopup; @@ -155,6 +156,8 @@ public class Camera extends ActivityBase implements FocusManager.Listener, private ModePicker mModePicker; private FaceView mFaceView; private RotateLayout mFocusIndicator; + private Rotatable mReviewCancelButton; + private Rotatable mReviewDoneButton; // mCropValue and mSaveUri are used only if isImageCaptureIntent() is true. private String mCropValue; @@ -936,6 +939,8 @@ public class Camera extends ActivityBase implements FocusManager.Listener, mIsImageCaptureIntent = isImageCaptureIntent(); setContentView(R.layout.camera); if (mIsImageCaptureIntent) { + mReviewDoneButton = (Rotatable) findViewById(R.id.btn_done); + mReviewCancelButton = (Rotatable) findViewById(R.id.btn_cancel); findViewById(R.id.btn_cancel).setVisibility(View.VISIBLE); } else { mThumbnailView = (RotateImageView) findViewById(R.id.thumbnail); @@ -1136,6 +1141,8 @@ public class Camera extends ActivityBase implements FocusManager.Listener, if (mZoomControl != null) mZoomControl.setDegree(degree); if (mFocusIndicator != null) mFocusIndicator.setOrientation(degree); if (mFaceView != null) mFaceView.setOrientation(degree); + if (mReviewCancelButton != null) mReviewCancelButton.setOrientation(degree); + if (mReviewDoneButton != null) mReviewDoneButton.setOrientation(degree); } @Override @@ -1163,18 +1170,18 @@ public class Camera extends ActivityBase implements FocusManager.Listener, } @OnClickAttr - public void onRetakeButtonClicked(View v) { + public void onReviewRetakeClicked(View v) { hidePostCaptureAlert(); startPreview(); } @OnClickAttr - public void onDoneButtonClicked(View v) { + public void onReviewDoneClicked(View v) { doAttach(); } @OnClickAttr - public void onCancelButtonClicked(View v) { + public void onReviewCancelClicked(View v) { doCancel(); } diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java index aa90f55..a880a01 100644 --- a/src/com/android/camera/VideoCamera.java +++ b/src/com/android/camera/VideoCamera.java @@ -19,6 +19,7 @@ package com.android.camera; import com.android.camera.ui.CameraPicker; import com.android.camera.ui.IndicatorControlContainer; import com.android.camera.ui.IndicatorControlWheelContainer; +import com.android.camera.ui.Rotatable; import com.android.camera.ui.RotateImageView; import com.android.camera.ui.RotateLayout; import com.android.camera.ui.SharePopup; @@ -158,6 +159,9 @@ public class VideoCamera extends ActivityBase private Thumbnail mThumbnail; // An imageview showing showing the last captured picture thumbnail. private RotateImageView mThumbnailView; + private Rotatable mReviewCancelButton; + private Rotatable mReviewDoneButton; + private Rotatable mReviewPlayButton; private ModePicker mModePicker; private ShutterButton mShutterButton; private TextView mRecordingTimeView; @@ -376,6 +380,9 @@ public class VideoCamera extends ActivityBase mIsVideoCaptureIntent = isVideoCaptureIntent(); setContentView(R.layout.video_camera); if (mIsVideoCaptureIntent) { + mReviewDoneButton = (Rotatable) findViewById(R.id.btn_done); + mReviewPlayButton = (Rotatable) findViewById(R.id.btn_play); + mReviewCancelButton = (Rotatable) findViewById(R.id.btn_cancel); findViewById(R.id.btn_cancel).setVisibility(View.VISIBLE); } else { initThumbnailButton(); @@ -534,6 +541,9 @@ public class VideoCamera extends ActivityBase if (mModePicker != null) mModePicker.setDegree(degree); if (mSharePopup != null) mSharePopup.setOrientation(degree); if (mIndicatorControlContainer != null) mIndicatorControlContainer.setDegree(degree); + if (mReviewDoneButton != null) mReviewDoneButton.setOrientation(degree); + if (mReviewPlayButton != null) mReviewPlayButton.setOrientation(degree); + if (mReviewCancelButton!= null) mReviewCancelButton.setOrientation(degree); // We change the orientation of the linearlayout only for phone UI because when in portrait // the width is not enough. if (mLabelsLinearLayout != null) { @@ -563,23 +573,23 @@ public class VideoCamera extends ActivityBase } @OnClickAttr - public void onRetakeButtonClicked(View v) { + public void onReviewRetakeClicked(View v) { deleteCurrentVideo(); hideAlert(); } @OnClickAttr - public void onPlayButtonClicked(View v) { + public void onReviewPlayClicked(View v) { startPlayVideoActivity(); } @OnClickAttr - public void onDoneButtonClicked(View v) { + public void onReviewDoneClicked(View v) { doReturnToCaller(true); } @OnClickAttr - public void onCancelButtonClicked(View v) { + public void onReviewCancelClicked(View v) { stopVideoRecording(); doReturnToCaller(false); } diff --git a/src/com/android/camera/ui/Rotatable.java b/src/com/android/camera/ui/Rotatable.java new file mode 100644 index 0000000..e9192c4 --- /dev/null +++ b/src/com/android/camera/ui/Rotatable.java @@ -0,0 +1,21 @@ +/* + * 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. + */ + +package com.android.camera.ui; + +public interface Rotatable { + public void setOrientation(int orientation); +} diff --git a/src/com/android/camera/ui/RotateImageView.java b/src/com/android/camera/ui/RotateImageView.java index 81faaec..390d705 100644 --- a/src/com/android/camera/ui/RotateImageView.java +++ b/src/com/android/camera/ui/RotateImageView.java @@ -16,6 +16,8 @@ package com.android.camera.ui; +import com.android.camera.ui.Rotatable; + import android.content.Context; import android.graphics.Bitmap; import android.graphics.Canvas; @@ -32,7 +34,7 @@ import android.widget.ImageView; /** * A @{code ImageView} which can rotate it's content. */ -public class RotateImageView extends ColorFilterImageView { +public class RotateImageView extends ColorFilterImageView implements Rotatable { @SuppressWarnings("unused") private static final String TAG = "RotateImageView"; @@ -64,6 +66,10 @@ public class RotateImageView extends ColorFilterImageView { return mTargetDegree; } + public void setOrientation(int orientation) { + setDegree(orientation); + } + // Rotate the view counter-clockwise public void setDegree(int degree) { // make sure in the range of [0, 359] diff --git a/src/com/android/camera/ui/RotateLayout.java b/src/com/android/camera/ui/RotateLayout.java index 1dfeae9..24815f8 100644 --- a/src/com/android/camera/ui/RotateLayout.java +++ b/src/com/android/camera/ui/RotateLayout.java @@ -16,6 +16,8 @@ package com.android.camera.ui; +import com.android.camera.ui.Rotatable; + import android.content.Context; import android.util.AttributeSet; import android.view.View; @@ -23,7 +25,7 @@ import android.view.ViewGroup; // A RotateLayout is designed to display a single item and provides the // capabilities to rotate the item. -public class RotateLayout extends ViewGroup { +public class RotateLayout extends ViewGroup implements Rotatable { private static final String TAG = "RotateLayout"; private int mOrientation; private View mChild; |