summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/ui/RotatableLayout.java
diff options
context:
space:
mode:
authorDoris Liu <tianliu@google.com>2013-10-16 12:51:02 -0700
committerDoris Liu <tianliu@google.com>2013-10-16 12:55:15 -0700
commit0ba8eaaa5d26f0a806e7bc987676bbc29ad1085c (patch)
tree96f8e0784b7835984fe4b6b16ff74c43eca29afd /src/com/android/camera/ui/RotatableLayout.java
parentd3e75bd748ce2be8fdcb30575bbde9bd07536bd3 (diff)
downloadandroid_packages_apps_Snap-0ba8eaaa5d26f0a806e7bc987676bbc29ad1085c.tar.gz
android_packages_apps_Snap-0ba8eaaa5d26f0a806e7bc987676bbc29ad1085c.tar.bz2
android_packages_apps_Snap-0ba8eaaa5d26f0a806e7bc987676bbc29ad1085c.zip
Fix shutter covering pie menu
Bug: 11247988 Change-Id: I2018075a0b8adf7cacb302774ed64df92fc2fa7c
Diffstat (limited to 'src/com/android/camera/ui/RotatableLayout.java')
-rw-r--r--src/com/android/camera/ui/RotatableLayout.java25
1 files changed, 4 insertions, 21 deletions
diff --git a/src/com/android/camera/ui/RotatableLayout.java b/src/com/android/camera/ui/RotatableLayout.java
index 04c36331d..6867e6a8b 100644
--- a/src/com/android/camera/ui/RotatableLayout.java
+++ b/src/com/android/camera/ui/RotatableLayout.java
@@ -19,11 +19,8 @@ package com.android.camera.ui;
import android.app.Activity;
import android.content.Context;
import android.content.res.Configuration;
-import android.graphics.Point;
import android.util.AttributeSet;
-import android.view.Display;
import android.view.Gravity;
-import android.view.Surface;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
@@ -73,14 +70,16 @@ public class RotatableLayout extends FrameLayout {
// we need to rotate the view if necessary. After that, onConfigurationChanged
// call will track all the subsequent device rotation.
if (mPrevRotation == UNKOWN_ORIENTATION) {
- calculateDefaultOrientation();
+ mIsDefaultToPortrait = CameraUtil.isDefaultToPortrait((Activity) getContext());
if (mIsDefaultToPortrait) {
// Natural orientation for tablet is landscape
mPrevRotation = mInitialOrientation == Configuration.ORIENTATION_PORTRAIT ?
0 : 90;
} else {
+ // When tablet orientation is 0 or 270 (i.e. getUnifiedOrientation
+ // = 0 or 90), we load the layout resource without any rotation.
mPrevRotation = mInitialOrientation == Configuration.ORIENTATION_LANDSCAPE ?
- 0 : 90;
+ 0 : 270;
}
// check if there is any rotation before the view is attached to window
@@ -88,22 +87,6 @@ public class RotatableLayout extends FrameLayout {
}
}
- private void calculateDefaultOrientation() {
- Display currentDisplay = getDisplay();
- Point displaySize = new Point();
- currentDisplay.getSize(displaySize);
- int orientation = currentDisplay.getRotation();
- int naturalWidth, naturalHeight;
- if (orientation == Surface.ROTATION_0 || orientation == Surface.ROTATION_180) {
- naturalWidth = displaySize.x;
- naturalHeight = displaySize.y;
- } else {
- naturalWidth = displaySize.y;
- naturalHeight = displaySize.x;
- }
- mIsDefaultToPortrait = naturalWidth < naturalHeight;
- }
-
private void rotateIfNeeded() {
if (mPrevRotation == UNKOWN_ORIENTATION) {
return;