diff options
author | Danny Baumann <dannybaumann@web.de> | 2016-03-27 14:31:16 +0200 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2016-04-03 04:41:55 -0700 |
commit | 222c665b32fcc14a97494c896c22012d10ddd8a3 (patch) | |
tree | c950b9cf8f26e97de6d42ec98d185335715ca381 /src/com/android/camera/ui/CameraRootView.java | |
parent | ba9f88b3d6930bbd686e23672d3b1203dd1a3015 (diff) | |
download | android_packages_apps_Snap-222c665b32fcc14a97494c896c22012d10ddd8a3.tar.gz android_packages_apps_Snap-222c665b32fcc14a97494c896c22012d10ddd8a3.tar.bz2 android_packages_apps_Snap-222c665b32fcc14a97494c896c22012d10ddd8a3.zip |
Properly respect navigation bar size when laying out menus.
For top level menus, add padding so all menu items can be scrolled to
not be covered by the navigation bar. For sub menus, place them to not
be covered by the navigation bar.
Change-Id: I22961c19b7bf80a26eec03b5feabfda10e910669
Diffstat (limited to 'src/com/android/camera/ui/CameraRootView.java')
-rw-r--r-- | src/com/android/camera/ui/CameraRootView.java | 35 |
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; } |