summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/ui/CameraRootView.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/camera/ui/CameraRootView.java')
-rw-r--r--src/com/android/camera/ui/CameraRootView.java35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/com/android/camera/ui/CameraRootView.java b/src/com/android/camera/ui/CameraRootView.java
index cd30e8e4f..6bf062b6c 100644
--- a/src/com/android/camera/ui/CameraRootView.java
+++ b/src/com/android/camera/ui/CameraRootView.java
@@ -37,6 +37,7 @@ public class CameraRootView extends FrameLayout {
private Object mDisplayListener;
private MyDisplayListener mListener;
private Rect mLastInsets = new Rect();
+ private Rect mTmpRect = new Rect();
public interface MyDisplayListener {
public void onDisplayChanged();
@@ -81,6 +82,40 @@ public class CameraRootView extends FrameLayout {
}
}
+ public Rect getInsetsForOrientation(int orientation) {
+ switch (orientation) {
+ case 90:
+ mTmpRect.set(mLastInsets.top, mLastInsets.right,
+ mLastInsets.bottom, mLastInsets.left);
+ break;
+ case 180:
+ mTmpRect.set(mLastInsets.right, mLastInsets.bottom,
+ mLastInsets.left, mLastInsets.top);
+ break;
+ case 270:
+ mTmpRect.set(mLastInsets.bottom, mLastInsets.left,
+ mLastInsets.top, mLastInsets.right);
+ break;
+ default:
+ mTmpRect.set(mLastInsets);
+ break;
+ }
+
+ return mTmpRect;
+ }
+
+ public Rect getClientRectForOrientation(int orientation) {
+ Rect result = getInsetsForOrientation(orientation);
+ if (orientation == 90 || orientation == 270) {
+ result.right = getHeight() - result.right;
+ result.bottom = getWidth() - result.bottom;
+ } else {
+ result.right = getWidth() - result.right;
+ result.bottom = getHeight() - result.bottom;
+ }
+ return result;
+ }
+
public void removeDisplayChangeListener() {
mListener = null;
}