diff options
author | Danny Baumann <dannybaumann@web.de> | 2016-04-19 11:28:06 +0200 |
---|---|---|
committer | Danny Baumann <dannybaumann@web.de> | 2016-04-25 10:41:08 +0200 |
commit | 3790102575878c57f1fd47260fa03eaa6ff71798 (patch) | |
tree | 7aa2370edd50b19a41bfd9ecf123ab21e6640294 /src/com/android/camera/PreviewGestures.java | |
parent | 1f7404e8d825878afef2b4c38e30470ac95e9ba5 (diff) | |
download | android_packages_apps_Snap-3790102575878c57f1fd47260fa03eaa6ff71798.tar.gz android_packages_apps_Snap-3790102575878c57f1fd47260fa03eaa6ff71798.tar.bz2 android_packages_apps_Snap-3790102575878c57f1fd47260fa03eaa6ff71798.zip |
Improve RTL layout behaviour.
- Swap top menu items order in RTL
- Swipe in menu from the right in RTL
- Make it possible to select scene/filter items in RTL
- Remove/clean up some nonsense code
Change-Id: I884a06f5cc6e72a1d2ee19dbdf32ce511c8466ec
JIRA:NIGHTLIES-2849
Diffstat (limited to 'src/com/android/camera/PreviewGestures.java')
-rw-r--r-- | src/com/android/camera/PreviewGestures.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/com/android/camera/PreviewGestures.java b/src/com/android/camera/PreviewGestures.java index 42d64bb3c..913dd1e3c 100644 --- a/src/com/android/camera/PreviewGestures.java +++ b/src/com/android/camera/PreviewGestures.java @@ -96,7 +96,7 @@ public class PreviewGestures else if (mVideoMenu != null) orientation = mVideoMenu.getOrientation(); - if (isLeftSwipe(orientation, deltaX, deltaY)) { + if (isSwipeForMenu(orientation, deltaX, deltaY)) { waitUntilNextDown = true; if (mPhotoMenu != null && !mPhotoMenu.isMenuBeingShown()) mPhotoMenu.openFirstLevel(); @@ -107,7 +107,16 @@ public class PreviewGestures return false; } - private boolean isLeftSwipe(int orientation, int deltaX, int deltaY) { + private boolean isSwipeForMenu(int orientation, int deltaX, int deltaY) { + if (mOverlay.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) { + // in RTL we want to track swipes from right, else swipes from left + if (orientation == 90 || orientation == 270) { + deltaY = -deltaY; + } else { + deltaX = -deltaX; + } + } + switch (orientation) { case 90: return deltaY > 0 && Math.abs(deltaY) > 2 * Math.abs(deltaX); |