diff options
author | Wu-cheng Li <wuchengli@google.com> | 2011-10-26 18:49:04 +0800 |
---|---|---|
committer | Wu-cheng Li <wuchengli@google.com> | 2011-10-27 15:30:52 +0800 |
commit | 4c7b291018e08dbb4bc1712d95117a294fa1416c (patch) | |
tree | 0dfd47973b87b02027b13b82578c4d1319bd9f94 /src/com/android/camera/PreviewFrameLayout.java | |
parent | 5ac06dce20d61113fae6295036905db0bfaf1d7e (diff) | |
download | LegacyCamera-4c7b291018e08dbb4bc1712d95117a294fa1416c.zip LegacyCamera-4c7b291018e08dbb4bc1712d95117a294fa1416c.tar.gz LegacyCamera-4c7b291018e08dbb4bc1712d95117a294fa1416c.tar.bz2 |
Make PreviewFrameLayout and ControlPanelLayout work in potrait mode.
+ Move tablet resource to sw600dp and sw800dp
bug:5446617
Change-Id: Iaf2a442e621ed071d7639972a529dd263e3ce628
Diffstat (limited to 'src/com/android/camera/PreviewFrameLayout.java')
-rw-r--r-- | src/com/android/camera/PreviewFrameLayout.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/com/android/camera/PreviewFrameLayout.java b/src/com/android/camera/PreviewFrameLayout.java index 5d31e2b..8429259 100644 --- a/src/com/android/camera/PreviewFrameLayout.java +++ b/src/com/android/camera/PreviewFrameLayout.java @@ -16,10 +16,9 @@ package com.android.camera; -import com.android.camera.R; - +import android.app.Activity; import android.content.Context; -import android.graphics.Rect; +import android.content.pm.ActivityInfo; import android.util.AttributeSet; import android.widget.RelativeLayout; /** @@ -31,14 +30,21 @@ public class PreviewFrameLayout extends RelativeLayout { public void onSizeChanged(); } - private double mAspectRatio = 4.0 / 3.0; + private double mAspectRatio; public PreviewFrameLayout(Context context, AttributeSet attrs) { super(context, attrs); + setAspectRatio(4.0 / 3.0); } public void setAspectRatio(double ratio) { if (ratio <= 0.0) throw new IllegalArgumentException(); + + if (((Activity) getContext()).getRequestedOrientation() + == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) { + ratio = 1 / ratio; + } + if (mAspectRatio != ratio) { mAspectRatio = ratio; requestLayout(); |