From 2bc4714bcd7233cd7a3fd0bb4aa261c48d2d9f79 Mon Sep 17 00:00:00 2001 From: Cheng-Ru Lin Date: Wed, 30 Sep 2009 11:57:50 +0800 Subject: Fine tune some UI stuff. 1. Use no animation between camera / review mode. Thus, we must have same layout for three types of control panel. 2. Since we have better algorithm to calculate the preview size. Let the gripper be the same in mdpi and hdpi devices. 3. Keep some border on the right size of image view. Otherwise, it looks odds in HVGA devices. Change-Id: I65b13222cace230f09e6b33f311fd2b79758e93e --- AndroidManifest.xml | 1 + res/drawable-mdpi/btn_gripper.png | Bin 379 -> 345 bytes res/layout/attach_camera_control.xml | 2 +- res/layout/camera_control.xml | 3 +-- res/layout/review_control.xml | 2 +- src/com/android/camera/PreviewFrameLayout.java | 11 +++++++++-- 6 files changed, 13 insertions(+), 6 deletions(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 8bd652a..823dcd9 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -125,6 +125,7 @@ diff --git a/res/drawable-mdpi/btn_gripper.png b/res/drawable-mdpi/btn_gripper.png index 93fcd89..5c70bbc 100644 Binary files a/res/drawable-mdpi/btn_gripper.png and b/res/drawable-mdpi/btn_gripper.png differ diff --git a/res/layout/attach_camera_control.xml b/res/layout/attach_camera_control.xml index 5de98a6..f4650b4 100644 --- a/res/layout/attach_camera_control.xml +++ b/res/layout/attach_camera_control.xml @@ -18,7 +18,7 @@ xmlns:camera="http://schemas.android.com/apk/res/com.android.camera" android:id="@+id/control_bar" android:layout_height="fill_parent" - android:layout_width="77dp" + android:layout_width="76dp" android:layout_marginTop="13dp" android:layout_marginBottom="10dp" android:layout_alignParentRight="true"> diff --git a/res/layout/camera_control.xml b/res/layout/camera_control.xml index 982d707..8f7f6c8 100644 --- a/res/layout/camera_control.xml +++ b/res/layout/camera_control.xml @@ -18,8 +18,7 @@ android:id="@+id/control_bar" android:orientation="vertical" android:layout_height="fill_parent" - android:layout_width="wrap_content" - android:layout_marginRight="0dp" + android:layout_width="76dp" android:layout_marginTop="13dp" android:layout_marginBottom="10dp" android:layout_alignParentRight="true"> diff --git a/res/layout/review_control.xml b/res/layout/review_control.xml index c470653..a1291a5 100644 --- a/res/layout/review_control.xml +++ b/res/layout/review_control.xml @@ -19,7 +19,7 @@ android:id="@+id/button_bar" android:gravity="center_horizontal" android:layout_height="fill_parent" - android:layout_width="77dp" + android:layout_width="76dp" android:layout_marginTop="13dp" android:layout_marginBottom="10dp" android:layout_alignParentRight="true"> diff --git a/src/com/android/camera/PreviewFrameLayout.java b/src/com/android/camera/PreviewFrameLayout.java index 459338c..7ef9206 100644 --- a/src/com/android/camera/PreviewFrameLayout.java +++ b/src/com/android/camera/PreviewFrameLayout.java @@ -16,14 +16,18 @@ package com.android.camera; +import android.app.Activity; import android.content.Context; import android.util.AttributeSet; +import android.util.DisplayMetrics; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.FrameLayout; public class PreviewFrameLayout extends ViewGroup { + private static final int MIN_HORIZONTAL_MARGIN = 10; // 10dp + public interface OnSizeChangedListener { public void onSizeChanged(); } @@ -32,10 +36,12 @@ public class PreviewFrameLayout extends ViewGroup { private ImageView mGripper; private FrameLayout mFrame; private OnSizeChangedListener mSizeListener; - + private DisplayMetrics mMetrics = new DisplayMetrics(); public PreviewFrameLayout(Context context, AttributeSet attrs) { super(context, attrs); + ((Activity) context).getWindowManager() + .getDefaultDisplay().getMetrics(mMetrics); } public void setOnSizeChangedListener(OnSizeChangedListener listener) { @@ -74,7 +80,8 @@ public class PreviewFrameLayout extends ViewGroup { gripperHeight = mGripper.getMeasuredHeight(); } - int frameWidth = getMeasuredWidth() - gripperWidth; + int frameWidth = getMeasuredWidth() - (int) Math.max( + gripperWidth, MIN_HORIZONTAL_MARGIN * mMetrics.density); int frameHeight = getMeasuredHeight(); FrameLayout f = mFrame; -- cgit v1.1