diff options
21 files changed, 66 insertions, 17 deletions
diff --git a/res/drawable-hdpi/zoompicker_down_normal.9.png b/res/drawable-hdpi/zoompicker_down_normal.9.png Binary files differdeleted file mode 100644 index 63a6cd5..0000000 --- a/res/drawable-hdpi/zoompicker_down_normal.9.png +++ /dev/null diff --git a/res/drawable-hdpi/zoompicker_down_normal.png b/res/drawable-hdpi/zoompicker_down_normal.png Binary files differnew file mode 100644 index 0000000..d1d5ce0 --- /dev/null +++ b/res/drawable-hdpi/zoompicker_down_normal.png diff --git a/res/drawable-hdpi/zoompicker_down_pressed.9.png b/res/drawable-hdpi/zoompicker_down_pressed.9.png Binary files differdeleted file mode 100644 index 317ec35..0000000 --- a/res/drawable-hdpi/zoompicker_down_pressed.9.png +++ /dev/null diff --git a/res/drawable-hdpi/zoompicker_down_pressed.png b/res/drawable-hdpi/zoompicker_down_pressed.png Binary files differnew file mode 100644 index 0000000..088d287 --- /dev/null +++ b/res/drawable-hdpi/zoompicker_down_pressed.png diff --git a/res/drawable-hdpi/zoompicker_up_normal.9.png b/res/drawable-hdpi/zoompicker_up_normal.9.png Binary files differdeleted file mode 100644 index b0d30e4..0000000 --- a/res/drawable-hdpi/zoompicker_up_normal.9.png +++ /dev/null diff --git a/res/drawable-hdpi/zoompicker_up_normal.png b/res/drawable-hdpi/zoompicker_up_normal.png Binary files differnew file mode 100644 index 0000000..9cded59 --- /dev/null +++ b/res/drawable-hdpi/zoompicker_up_normal.png diff --git a/res/drawable-hdpi/zoompicker_up_pressed.9.png b/res/drawable-hdpi/zoompicker_up_pressed.9.png Binary files differdeleted file mode 100644 index e4af609..0000000 --- a/res/drawable-hdpi/zoompicker_up_pressed.9.png +++ /dev/null diff --git a/res/drawable-hdpi/zoompicker_up_pressed.png b/res/drawable-hdpi/zoompicker_up_pressed.png Binary files differnew file mode 100644 index 0000000..320bcaf --- /dev/null +++ b/res/drawable-hdpi/zoompicker_up_pressed.png diff --git a/res/drawable-mdpi/zoompicker_down_normal.9.png b/res/drawable-mdpi/zoompicker_down_normal.9.png Binary files differdeleted file mode 100755 index f17e8f9..0000000 --- a/res/drawable-mdpi/zoompicker_down_normal.9.png +++ /dev/null diff --git a/res/drawable-mdpi/zoompicker_down_normal.png b/res/drawable-mdpi/zoompicker_down_normal.png Binary files differnew file mode 100644 index 0000000..d1d5ce0 --- /dev/null +++ b/res/drawable-mdpi/zoompicker_down_normal.png diff --git a/res/drawable-mdpi/zoompicker_down_pressed.9.png b/res/drawable-mdpi/zoompicker_down_pressed.9.png Binary files differdeleted file mode 100755 index 777bcf5..0000000 --- a/res/drawable-mdpi/zoompicker_down_pressed.9.png +++ /dev/null diff --git a/res/drawable-mdpi/zoompicker_down_pressed.png b/res/drawable-mdpi/zoompicker_down_pressed.png Binary files differnew file mode 100644 index 0000000..088d287 --- /dev/null +++ b/res/drawable-mdpi/zoompicker_down_pressed.png diff --git a/res/drawable-mdpi/zoompicker_up_normal.9.png b/res/drawable-mdpi/zoompicker_up_normal.9.png Binary files differdeleted file mode 100755 index dcd26e0..0000000 --- a/res/drawable-mdpi/zoompicker_up_normal.9.png +++ /dev/null diff --git a/res/drawable-mdpi/zoompicker_up_normal.png b/res/drawable-mdpi/zoompicker_up_normal.png Binary files differnew file mode 100644 index 0000000..9cded59 --- /dev/null +++ b/res/drawable-mdpi/zoompicker_up_normal.png diff --git a/res/drawable-mdpi/zoompicker_up_pressed.9.png b/res/drawable-mdpi/zoompicker_up_pressed.9.png Binary files differdeleted file mode 100755 index 7dac778..0000000 --- a/res/drawable-mdpi/zoompicker_up_pressed.9.png +++ /dev/null diff --git a/res/drawable-mdpi/zoompicker_up_pressed.png b/res/drawable-mdpi/zoompicker_up_pressed.png Binary files differnew file mode 100644 index 0000000..320bcaf --- /dev/null +++ b/res/drawable-mdpi/zoompicker_up_pressed.png diff --git a/res/layout-xlarge/attach_camera_control.xml b/res/layout-xlarge/attach_camera_control.xml index b33085b..c84e7a6 100644 --- a/res/layout-xlarge/attach_camera_control.xml +++ b/res/layout-xlarge/attach_camera_control.xml @@ -18,11 +18,22 @@ xmlns:camera="http://schemas.android.com/apk/res/com.android.camera" android:id="@+id/control_bar" android:layout_height="match_parent" - android:layout_width="90dp" + android:layout_width="120dp" android:layout_marginTop="20dp" android:layout_marginBottom="20dp" android:layout_marginLeft="10dp" android:layout_marginRight="10dp"> + <TextView android:id="@+id/recording_time" + style="@style/RecordingTime" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentTop="true" + android:layout_centerHorizontal="true" + android:layout_marginTop="90dp" + android:drawablePadding="8dp" + android:drawableLeft="@drawable/ic_recording_indicator" + android:visibility="gone" /> + <LinearLayout android:orientation="vertical" android:gravity="top|center_horizontal" android:layout_alignParentTop="true" @@ -56,6 +67,7 @@ android:text="@string/review_play" /> </LinearLayout> </LinearLayout> + <com.android.camera.ShutterButton android:id="@+id/shutter_button" android:layout_centerInParent="true" android:layout_centerHorizontal="true" diff --git a/res/layout-xlarge/camera_control.xml b/res/layout-xlarge/camera_control.xml index 18fbcde..38c6200 100644 --- a/res/layout-xlarge/camera_control.xml +++ b/res/layout-xlarge/camera_control.xml @@ -19,18 +19,18 @@ android:id="@+id/control_panel" android:layout_height="match_parent" android:layout_width="230dp" - android:layout_marginTop="30dp" + android:layout_marginTop="40dp" android:layout_marginLeft="-46dp" - android:layout_marginBottom="25dp"> + android:layout_marginBottom="40dp"> <ViewStub android:id="@+id/zoom_stub" android:inflatedId="@+id/zoom_picker" android:layout="@layout/zoom_picker" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginLeft="7dp" + android:layout_width="45dp" + android:layout_height="150dp" + android:layout_marginLeft="21dp" android:layout_marginTop="10dp" /> <TextView android:id="@+id/recording_time" diff --git a/res/layout-xlarge/zoom_picker.xml b/res/layout-xlarge/zoom_picker.xml index fa373f4..a5ef7ad 100644 --- a/res/layout-xlarge/zoom_picker.xml +++ b/res/layout-xlarge/zoom_picker.xml @@ -18,26 +18,35 @@ --> <com.android.camera.ui.ZoomPicker xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="vertical"> + android:orientation="vertical" + android:gravity="center" + android:layout_width="45dp" + android:layout_height="150dp" + android:layout_alignParentTop="true" + android:layout_alignParentLeft="true" + android:background="@drawable/mode_switch_bg_v2"> <TextView android:id="@+id/zoom_ratio" + android:gravity="center" android:layout_width="match_parent" android:layout_height="wrap_content" - android:gravity="center" + android:layout_marginTop="10dp" + android:layout_marginBottom="20dp" android:singleLine="true" android:textColor="@android:color/white" - android:textSize="24dp" /> + android:textSize="16dp" /> <Button android:id="@+id/increment" - android:layout_width="match_parent" + android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="10dp" + android:layout_marginBottom="10dp" android:background="@drawable/btn_zoom_picker_up" /> <Button android:id="@+id/decrement" - android:layout_width="match_parent" + android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_marginTop="10dp" + android:layout_marginBottom="10dp" android:background="@drawable/btn_zoom_picker_down" /> </com.android.camera.ui.ZoomPicker> diff --git a/src/com/android/camera/Util.java b/src/com/android/camera/Util.java index 71d0c21..ac99956 100644 --- a/src/com/android/camera/Util.java +++ b/src/com/android/camera/Util.java @@ -54,10 +54,28 @@ public class Util { // Rotates the bitmap by the specified degree. // If a new bitmap is created, the original bitmap is recycled. public static Bitmap rotate(Bitmap b, int degrees) { - if (degrees != 0 && b != null) { + return rotateAndMirror(b, degrees, false); + } + + // Rotates and/or mirrors the bitmap. If a new bitmap is created, the + // original bitmap is recycled. + public static Bitmap rotateAndMirror(Bitmap b, int degrees, boolean mirror) { + if ((degrees != 0 || mirror) && b != null) { Matrix m = new Matrix(); m.setRotate(degrees, (float) b.getWidth() / 2, (float) b.getHeight() / 2); + if (mirror) { + m.postScale(-1, 1); + degrees = (degrees + 360) % 360; + if (degrees == 0 || degrees == 180) { + m.postTranslate((float) b.getWidth(), 0); + } else if (degrees == 90 || degrees == 270) { + m.postTranslate((float) b.getHeight(), 0); + } else { + throw new IllegalArgumentException("Invalid degrees=" + degrees); + } + } + try { Bitmap b2 = Bitmap.createBitmap( b, 0, 0, b.getWidth(), b.getHeight(), m, true); diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java index 0bda10d..c4ab942 100644 --- a/src/com/android/camera/VideoCamera.java +++ b/src/com/android/camera/VideoCamera.java @@ -206,6 +206,7 @@ public class VideoCamera extends NoSearchActivity private int mOrientation = OrientationEventListener.ORIENTATION_UNKNOWN; // The orientation compensation for icons and thumbnails. private int mOrientationCompensation = 0; + private int mOrientationHint; // the orientation hint for video playback // This Handler is used to post message back onto the main thread of the // application @@ -1124,6 +1125,7 @@ public class VideoCamera extends NoSearchActivity } } mMediaRecorder.setOrientationHint(rotation); + mOrientationHint = rotation; try { mMediaRecorder.prepare(); @@ -1413,9 +1415,17 @@ public class VideoCamera extends NoSearchActivity private void showAlert() { fadeOut(findViewById(R.id.shutter_button)); if (mCurrentVideoFilename != null) { - mVideoFrame.setImageBitmap( - ThumbnailUtils.createVideoThumbnail(mCurrentVideoFilename, - Video.Thumbnails.MINI_KIND)); + Bitmap src = ThumbnailUtils.createVideoThumbnail( + mCurrentVideoFilename, Video.Thumbnails.MINI_KIND); + // MetadataRetriever already rotates the thumbnail. We should rotate + // it back (and mirror if it is front-facing camera). + CameraInfo[] info = CameraHolder.instance().getCameraInfo(); + if (info[mCameraId].facing == CameraInfo.CAMERA_FACING_BACK) { + src = Util.rotateAndMirror(src, -mOrientationHint, false); + } else { + src = Util.rotateAndMirror(src, -mOrientationHint, true); + } + mVideoFrame.setImageBitmap(src); mVideoFrame.setVisibility(View.VISIBLE); } int[] pickIds = {R.id.btn_retake, R.id.btn_done, R.id.btn_play}; |