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 --- src/com/android/camera/PreviewFrameLayout.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/com/android/camera') 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