summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2016-11-29 13:55:17 +0100
committerMichael Bestas <mikeioannina@gmail.com>2017-01-04 22:00:45 +0200
commitfaba8b3739e1bb0ede3f366e7a41cc5c6bedaf2d (patch)
tree5a24e7df045841f3c9db04e6942a80d6472f05b9
parent117a398da61cf28218d96add271c49cad1cb1260 (diff)
downloadandroid_packages_apps_Snap-faba8b3739e1bb0ede3f366e7a41cc5c6bedaf2d.zip
android_packages_apps_Snap-faba8b3739e1bb0ede3f366e7a41cc5c6bedaf2d.tar.gz
android_packages_apps_Snap-faba8b3739e1bb0ede3f366e7a41cc5c6bedaf2d.tar.bz2
Improve RTL layout behaviour.
- 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
-rw-r--r--src/com/android/camera/PhotoMenu.java203
-rw-r--r--src/com/android/camera/PhotoUI.java42
-rw-r--r--src/com/android/camera/PreviewGestures.java12
-rw-r--r--src/com/android/camera/VideoMenu.java173
-rw-r--r--src/com/android/camera/VideoUI.java42
5 files changed, 163 insertions, 309 deletions
diff --git a/src/com/android/camera/PhotoMenu.java b/src/com/android/camera/PhotoMenu.java
index 8a91df2..9554de7 100644
--- a/src/com/android/camera/PhotoMenu.java
+++ b/src/com/android/camera/PhotoMenu.java
@@ -111,8 +111,8 @@ public class PhotoMenu extends MenuController
private boolean mIsCDSUpdated = false;
private int mPrivateCounter = 0;
private static final int ANIMATION_DURATION = 300;
- private static final int CLICK_THRESHOLD = 200;
private int previewMenuSize;
+ private Rect mTmpRect = new Rect();
private TsMakeupManager mTsMakeupManager;
private MakeupLevelListener mMakeupListener;
private MakeupHandler mHandler = new MakeupHandler();
@@ -370,37 +370,20 @@ public class PhotoMenu extends MenuController
mPopupStatus = POPUP_IN_ANIMATION_SLIDE;
ViewPropertyAnimator vp = v.animate();
- if (View.LAYOUT_DIRECTION_RTL == TextUtils
- .getLayoutDirectionFromLocale(Locale.getDefault())) {
- switch (mUI.getOrientation()) {
- case 0:
- vp.translationXBy(v.getWidth());
- break;
- case 90:
- vp.translationYBy(-2 * v.getHeight());
- break;
- case 180:
- vp.translationXBy(-2 * v.getWidth());
- break;
- case 270:
- vp.translationYBy(v.getHeight());
- break;
- }
- } else {
- switch (mUI.getOrientation()) {
- case 0:
- vp.translationXBy(-v.getWidth());
- break;
- case 90:
- vp.translationYBy(2 * v.getHeight());
- break;
- case 180:
- vp.translationXBy(2 * v.getWidth());
- break;
- case 270:
- vp.translationYBy(-v.getHeight());
- break;
- }
+ int sign = mUI.isRtl() ? -1 : 1;
+ switch (mUI.getOrientation()) {
+ case 0:
+ vp.translationXBy(sign * -v.getWidth());
+ break;
+ case 90:
+ vp.translationYBy(sign * 2 * v.getHeight());
+ break;
+ case 180:
+ vp.translationXBy(sign * 2 * v.getWidth());
+ break;
+ case 270:
+ vp.translationYBy(sign * -v.getHeight());
+ break;
}
vp.setListener(new AnimatorListener() {
@Override
@@ -454,54 +437,29 @@ public class PhotoMenu extends MenuController
orientation = 0;
ViewPropertyAnimator vp = v.animate();
+ int sign = mUI.isRtl() ? -1 : 1;
float dest;
- if (View.LAYOUT_DIRECTION_RTL == TextUtils
- .getLayoutDirectionFromLocale(Locale.getDefault())) {
- switch (orientation) {
- case 0:
- dest = v.getX();
- v.setX(-(dest - delta));
- vp.translationX(dest);
- break;
- case 90:
- dest = v.getY();
- v.setY(-(dest + delta));
- vp.translationY(dest);
- break;
- case 180:
- dest = v.getX();
- v.setX(-(dest + delta));
- vp.translationX(dest);
- break;
- case 270:
- dest = v.getY();
- v.setY(-(dest - delta));
- vp.translationY(dest);
- break;
- }
- } else {
- switch (orientation) {
- case 0:
- dest = v.getX();
- v.setX(dest - delta);
- vp.translationX(dest);
- break;
- case 90:
- dest = v.getY();
- v.setY(dest + delta);
- vp.translationY(dest);
- break;
- case 180:
- dest = v.getX();
- v.setX(dest + delta);
- vp.translationX(dest);
- break;
- case 270:
- dest = v.getY();
- v.setY(dest - delta);
- vp.translationY(dest);
- break;
- }
+ switch (orientation) {
+ case 0:
+ dest = v.getX();
+ v.setX(sign * (dest - delta));
+ vp.translationX(dest);
+ break;
+ case 90:
+ dest = v.getY();
+ v.setY(sign * (dest + delta));
+ vp.translationY(dest);
+ break;
+ case 180:
+ dest = v.getX();
+ v.setX(sign * (dest + delta));
+ vp.translationX(dest);
+ break;
+ case 270:
+ dest = v.getY();
+ v.setY(sign * (dest - delta));
+ vp.translationY(dest);
+ break;
}
vp.setDuration(ANIMATION_DURATION).start();
}
@@ -524,13 +482,9 @@ public class PhotoMenu extends MenuController
return;
mPreviewMenuStatus = PREVIEW_MENU_IN_ANIMATION;
- ViewPropertyAnimator vp = v.animate();
- if (View.LAYOUT_DIRECTION_RTL == TextUtils
- .getLayoutDirectionFromLocale(Locale.getDefault())) {
- vp.translationXBy(v.getWidth()).setDuration(ANIMATION_DURATION);
- } else {
- vp.translationXBy(-v.getWidth()).setDuration(ANIMATION_DURATION);
- }
+ ViewPropertyAnimator vp = v.animate()
+ .translationXBy(-v.getWidth() * (mUI.isRtl() ? -1 : 1))
+ .setDuration(ANIMATION_DURATION);
vp.setListener(new AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
@@ -573,28 +527,20 @@ public class PhotoMenu extends MenuController
|| mPopupStatus == POPUP_IN_ANIMATION_SLIDE
|| mPopupStatus == POPUP_IN_ANIMATION_FADE)
return false;
- if (mUI.getMenuLayout() == null)
- return false;
- Rect rec = new Rect();
- mUI.getMenuLayout().getChildAt(0).getHitRect(rec);
- return rec.contains((int) ev.getX(), (int) ev.getY());
+ return isOverView(mUI.getMenuLayout(), ev);
}
public boolean isOverPreviewMenu(MotionEvent ev) {
if (mPreviewMenuStatus != PREVIEW_MENU_ON)
return false;
- if (mUI.getPreviewMenuLayout() == null)
+ return isOverView(mUI.getPreviewMenuLayout(), ev);
+ }
+
+ private boolean isOverView(View view, MotionEvent ev) {
+ if (view == null)
return false;
- Rect rec = new Rect();
- mUI.getPreviewMenuLayout().getChildAt(0).getHitRect(rec);
- if (View.LAYOUT_DIRECTION_RTL == TextUtils
- .getLayoutDirectionFromLocale(Locale.getDefault())) {
- rec.left = mUI.getRootView().getWidth() - (rec.right-rec.left);
- rec.right = mUI.getRootView().getWidth();
- }
- rec.top += (int) mUI.getPreviewMenuLayout().getY();
- rec.bottom += (int) mUI.getPreviewMenuLayout().getY();
- return rec.contains((int) ev.getX(), (int) ev.getY());
+ view.getHitRect(mTmpRect);
+ return mTmpRect.contains((int) ev.getX(), (int) ev.getY());
}
public boolean isMenuBeingShown() {
@@ -966,9 +912,8 @@ public class PhotoMenu extends MenuController
addSceneMode();
ViewGroup menuLayout = mUI.getPreviewMenuLayout();
if (menuLayout != null) {
- View view = menuLayout.getChildAt(0);
mUI.adjustOrientation();
- animateSlideIn(view, previewMenuSize, false);
+ animateSlideIn(menuLayout, previewMenuSize, false);
}
}
});
@@ -1053,26 +998,15 @@ public class PhotoMenu extends MenuController
TextView label = (TextView) layout2.findViewById(R.id.label);
final int j = i;
- layout2.setOnTouchListener(new View.OnTouchListener() {
- private long startTime;
-
+ layout2.setOnClickListener(new View.OnClickListener() {
@Override
- public boolean onTouch(View v, MotionEvent event) {
- if (event.getAction() == MotionEvent.ACTION_DOWN) {
- startTime = System.currentTimeMillis();
- } else if (event.getAction() == MotionEvent.ACTION_UP) {
- if (System.currentTimeMillis() - startTime < CLICK_THRESHOLD) {
- pref.setValueIndex(j);
- onSettingChanged(pref);
- updateSceneModeIcon(pref);
- for (View v1 : views) {
- v1.setActivated(v1 == v);
- }
- animateSlideOutPreviewMenu();
- }
-
+ public void onClick(View v) {
+ pref.setValueIndex(j);
+ onSettingChanged(pref);
+ updateSceneModeIcon(pref);
+ for (View v1 : views) {
+ v1.setActivated(v1 == v);
}
- return true;
}
});
@@ -1123,9 +1057,8 @@ public class PhotoMenu extends MenuController
addFilterMode();
ViewGroup menuLayout = mUI.getPreviewMenuLayout();
if (menuLayout != null) {
- View view = mUI.getPreviewMenuLayout().getChildAt(0);
mUI.adjustOrientation();
- animateSlideIn(view, previewMenuSize, false);
+ animateSlideIn(menuLayout, previewMenuSize, false);
}
}
});
@@ -1198,24 +1131,14 @@ public class PhotoMenu extends MenuController
ImageView imageView = (ImageView) layout2.findViewById(R.id.image);
final int j = i;
- layout2.setOnTouchListener(new View.OnTouchListener() {
- private long startTime;
-
+ layout2.setOnClickListener(new View.OnClickListener() {
@Override
- public boolean onTouch(View v, MotionEvent event) {
- if (event.getAction() == MotionEvent.ACTION_DOWN) {
- startTime = System.currentTimeMillis();
- } else if (event.getAction() == MotionEvent.ACTION_UP) {
- if (System.currentTimeMillis() - startTime < CLICK_THRESHOLD) {
- pref.setValueIndex(j);
- changeFilterModeControlIcon(pref.getValue());
- onSettingChanged(pref);
- for (View v1 : views) {
- v1.setActivated(v1 == v);
- }
- }
+ public void onClick(View v) {
+ pref.setValueIndex(j);
+ onSettingChanged(pref);
+ for (View v1 : views) {
+ v1.setActivated(v1 == v);
}
- return true;
}
});
diff --git a/src/com/android/camera/PhotoUI.java b/src/com/android/camera/PhotoUI.java
index 85bd167..a4241b5 100644
--- a/src/com/android/camera/PhotoUI.java
+++ b/src/com/android/camera/PhotoUI.java
@@ -702,8 +702,11 @@ public class PhotoUI extends BaseUI implements PieListener,
mMakeupMenuLayout = layout;
}
+ public boolean isRtl() {
+ return mRootView.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;
+ }
+
public void showPopup(ListView popup, int level, boolean animate) {
- FrameLayout.LayoutParams params;
hideUI();
popup.setVisibility(View.VISIBLE);
@@ -711,16 +714,9 @@ public class PhotoUI extends BaseUI implements PieListener,
if (mMenuLayout == null) {
mMenuLayout = new RotateLayout(mActivity, null);
mMenuLayout.setRootView(mRootView);
- if (mRootView.getLayoutDirection() != View.LAYOUT_DIRECTION_RTL) {
- params = new FrameLayout.LayoutParams(
- CameraActivity.SETTING_LIST_WIDTH_1, LayoutParams.WRAP_CONTENT,
- Gravity.LEFT | Gravity.TOP);
- } else {
- params = new FrameLayout.LayoutParams(
- CameraActivity.SETTING_LIST_WIDTH_1, LayoutParams.WRAP_CONTENT,
- Gravity.RIGHT | Gravity.TOP);
- }
- mMenuLayout.setLayoutParams(params);
+ mMenuLayout.setLayoutParams(new FrameLayout.LayoutParams(
+ CameraActivity.SETTING_LIST_WIDTH_1, LayoutParams.WRAP_CONTENT,
+ Gravity.START | Gravity.TOP));
mRootView.addView(mMenuLayout);
}
mMenuLayout.addView(popup, new RotateLayout.LayoutParams(
@@ -733,15 +729,6 @@ public class PhotoUI extends BaseUI implements PieListener,
mSubMenuLayout.setRootView(mRootView);
mRootView.addView(mSubMenuLayout);
}
- if (mRootView.getLayoutDirection() != View.LAYOUT_DIRECTION_RTL) {
- params = new FrameLayout.LayoutParams(
- CameraActivity.SETTING_LIST_WIDTH_2, LayoutParams.WRAP_CONTENT,
- Gravity.LEFT | Gravity.TOP);
- } else {
- params = new FrameLayout.LayoutParams(
- CameraActivity.SETTING_LIST_WIDTH_2, LayoutParams.WRAP_CONTENT,
- Gravity.RIGHT | Gravity.TOP);
- }
int containerHeight = mRootView.getClientRectForOrientation(mOrientation).height();
int height = ((ListSubMenu) popup).getPreCalculatedHeight();
int yBase = ((ListSubMenu) popup).getYBase(), y = yBase;
@@ -749,12 +736,14 @@ public class PhotoUI extends BaseUI implements PieListener,
y = Math.max(0, containerHeight - height);
}
- if (mRootView.getLayoutDirection() != View.LAYOUT_DIRECTION_RTL) {
- params.setMargins(CameraActivity.SETTING_LIST_WIDTH_1, y, 0, 0);
- } else {
+ final FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
+ CameraActivity.SETTING_LIST_WIDTH_2, LayoutParams.WRAP_CONTENT,
+ Gravity.START | Gravity.TOP);
+ if (isRtl()) {
params.setMargins(0, y, CameraActivity.SETTING_LIST_WIDTH_1, 0);
+ } else {
+ params.setMargins(CameraActivity.SETTING_LIST_WIDTH_1, y, 0, 0);
}
-
mSubMenuLayout.setLayoutParams(params);
mSubMenuLayout.setOrientation(mOrientation, true);
@@ -838,6 +827,7 @@ public class PhotoUI extends BaseUI implements PieListener,
}
public boolean sendTouchToPreviewMenu(MotionEvent ev) {
+ ev.offsetLocation(-mPreviewMenuLayout.getLeft(), -mPreviewMenuLayout.getTop());
if (mPreviewMenuLayout != null) {
return mPreviewMenuLayout.dispatchTouchEvent(ev);
}
@@ -846,8 +836,8 @@ public class PhotoUI extends BaseUI implements PieListener,
public boolean sendTouchToMenu(MotionEvent ev) {
if (mMenuLayout != null) {
- View v = mMenuLayout.getChildAt(0);
- return v.dispatchTouchEvent(ev);
+ ev.offsetLocation(-mMenuLayout.getLeft(), -mMenuLayout.getTop());
+ return mMenuLayout.dispatchTouchEvent(ev);
}
return false;
}
diff --git a/src/com/android/camera/PreviewGestures.java b/src/com/android/camera/PreviewGestures.java
index 941516f..beeb6f2 100644
--- a/src/com/android/camera/PreviewGestures.java
+++ b/src/com/android/camera/PreviewGestures.java
@@ -98,7 +98,7 @@ public class PreviewGestures
else if (mCaptureUI != null)
orientation = mCaptureUI.getOrientation();
- if (isLeftSwipe(orientation, deltaX, deltaY)) {
+ if (isSwipeForMenu(orientation, deltaX, deltaY)) {
waitUntilNextDown = true;
if (mPhotoMenu != null && !mPhotoMenu.isMenuBeingShown())
mPhotoMenu.openFirstLevel();
@@ -112,7 +112,15 @@ public class PreviewGestures
}
}
- 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);
diff --git a/src/com/android/camera/VideoMenu.java b/src/com/android/camera/VideoMenu.java
index a510a51..87897bd 100644
--- a/src/com/android/camera/VideoMenu.java
+++ b/src/com/android/camera/VideoMenu.java
@@ -86,8 +86,8 @@ public class VideoMenu extends MenuController
private boolean mIsVideoCDSUpdated = false;
private int mPrivateCounter = 0;
private static final int ANIMATION_DURATION = 300;
- private static final int CLICK_THRESHOLD = 200;
private int previewMenuSize;
+ private Rect mTmpRect = new Rect();
private static final boolean PERSIST_4K_NO_LIMIT =
android.os.SystemProperties.getBoolean("persist.camcorder.4k.nolimit", false);
@@ -238,37 +238,21 @@ public class VideoMenu extends MenuController
mPopupStatus = POPUP_IN_ANIMATION_SLIDE;
ViewPropertyAnimator vp = v.animate();
- if (View.LAYOUT_DIRECTION_RTL == TextUtils
- .getLayoutDirectionFromLocale(Locale.getDefault())) {
- switch (mUI.getOrientation()) {
- case 0:
- vp.translationXBy(v.getWidth());
- break;
- case 90:
- vp.translationYBy(-2 * v.getHeight());
- break;
- case 180:
- vp.translationXBy(-2 * v.getWidth());
- break;
- case 270:
- vp.translationYBy(v.getHeight());
- break;
- }
- } else {
- switch (mUI.getOrientation()) {
- case 0:
- vp.translationXBy(-v.getWidth());
- break;
- case 90:
- vp.translationYBy(2 * v.getHeight());
- break;
- case 180:
- vp.translationXBy(2 * v.getWidth());
- break;
- case 270:
- vp.translationYBy(-v.getHeight());
- break;
- }
+ int sign = mUI.isRtl() ? -1 : 1;
+
+ switch (mUI.getOrientation()) {
+ case 0:
+ vp.translationXBy(-v.getWidth() * sign);
+ break;
+ case 90:
+ vp.translationYBy(2 * v.getHeight() * sign);
+ break;
+ case 180:
+ vp.translationXBy(2 * v.getWidth() * sign);
+ break;
+ case 270:
+ vp.translationYBy(-v.getHeight() * sign);
+ break;
}
vp.setListener(new AnimatorListener() {
@@ -325,54 +309,30 @@ public class VideoMenu extends MenuController
orientation = 0;
ViewPropertyAnimator vp = v.animate();
+ int sign = mUI.isRtl() ? -1 : 1;
float dest;
- if (View.LAYOUT_DIRECTION_RTL == TextUtils
- .getLayoutDirectionFromLocale(Locale.getDefault())) {
- switch (orientation) {
- case 0:
- dest = v.getX();
- v.setX(-(dest - delta));
- vp.translationX(dest);
- break;
- case 90:
- dest = v.getY();
- v.setY(-(dest + delta));
- vp.translationY(dest);
- break;
- case 180:
- dest = v.getX();
- v.setX(-(dest + delta));
- vp.translationX(dest);
- break;
- case 270:
- dest = v.getY();
- v.setY(-(dest - delta));
- vp.translationY(dest);
- break;
- }
- } else {
- switch (orientation) {
- case 0:
- dest = v.getX();
- v.setX(dest - delta);
- vp.translationX(dest);
- break;
- case 90:
- dest = v.getY();
- v.setY(dest + delta);
- vp.translationY(dest);
- break;
- case 180:
- dest = v.getX();
- v.setX(dest + delta);
- vp.translationX(dest);
- break;
- case 270:
- dest = v.getY();
- v.setY(dest - delta);
- vp.translationY(dest);
- break;
- }
+
+ switch (orientation) {
+ case 0:
+ dest = v.getX();
+ v.setX((dest - delta) * sign);
+ vp.translationX(dest);
+ break;
+ case 90:
+ dest = v.getY();
+ v.setY((dest + delta) * sign);
+ vp.translationY(dest);
+ break;
+ case 180:
+ dest = v.getX();
+ v.setX((dest + delta) * sign);
+ vp.translationX(dest);
+ break;
+ case 270:
+ dest = v.getY();
+ v.setY((dest - delta) * sign);
+ vp.translationY(dest);
+ break;
}
vp.setDuration(ANIMATION_DURATION).start();
@@ -389,13 +349,9 @@ public class VideoMenu extends MenuController
return;
mPreviewMenuStatus = PREVIEW_MENU_IN_ANIMATION;
- ViewPropertyAnimator vp = v.animate();
- if (View.LAYOUT_DIRECTION_RTL == TextUtils
- .getLayoutDirectionFromLocale(Locale.getDefault())) {
- vp.translationXBy(v.getWidth()).setDuration(ANIMATION_DURATION);
- } else {
- vp.translationXBy(-v.getWidth()).setDuration(ANIMATION_DURATION);
- }
+ ViewPropertyAnimator vp = v.animate()
+ .translationXBy(-v.getWidth() * (mUI.isRtl() ? -1 : 1))
+ .setDuration(ANIMATION_DURATION);
vp.setListener(new AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
@@ -426,23 +382,20 @@ public class VideoMenu extends MenuController
|| mPopupStatus == POPUP_IN_ANIMATION_SLIDE
|| mPopupStatus == POPUP_IN_ANIMATION_FADE)
return false;
- if (mUI.getMenuLayout() == null)
- return false;
- Rect rec = new Rect();
- mUI.getMenuLayout().getChildAt(0).getHitRect(rec);
- return rec.contains((int) ev.getX(), (int) ev.getY());
+ return isOverView(mUI.getMenuLayout(), ev);
}
public boolean isOverPreviewMenu(MotionEvent ev) {
if (mPreviewMenuStatus != PREVIEW_MENU_ON)
return false;
- if (mUI.getPreviewMenuLayout() == null)
+ return isOverView(mUI.getPreviewMenuLayout(), ev);
+ }
+
+ private boolean isOverView(View view, MotionEvent ev) {
+ if (view == null)
return false;
- Rect rec = new Rect();
- mUI.getPreviewMenuLayout().getChildAt(0).getHitRect(rec);
- rec.top += (int) mUI.getPreviewMenuLayout().getY();
- rec.bottom += (int) mUI.getPreviewMenuLayout().getY();
- return rec.contains((int) ev.getX(), (int) ev.getY());
+ view.getHitRect(mTmpRect);
+ return mTmpRect.contains((int) ev.getX(), (int) ev.getY());
}
public boolean isMenuBeingShown() {
@@ -526,9 +479,8 @@ public class VideoMenu extends MenuController
addFilterMode();
ViewGroup menuLayout = mUI.getPreviewMenuLayout();
if (menuLayout != null) {
- View view = menuLayout.getChildAt(0);
mUI.adjustOrientation();
- animateSlideIn(view, previewMenuSize, false);
+ animateSlideIn(menuLayout, previewMenuSize, false);
}
}
});
@@ -609,25 +561,14 @@ public class VideoMenu extends MenuController
ImageView imageView = (ImageView) layout2.findViewById(R.id.image);
final int j = i;
- layout2.setOnTouchListener(new View.OnTouchListener() {
- private long startTime;
-
+ layout2.setOnClickListener(new View.OnClickListener() {
@Override
- public boolean onTouch(View v, MotionEvent event) {
- if (event.getAction() == MotionEvent.ACTION_DOWN) {
- startTime = System.currentTimeMillis();
- } else if (event.getAction() == MotionEvent.ACTION_UP) {
- if (System.currentTimeMillis() - startTime < CLICK_THRESHOLD) {
- pref.setValueIndex(j);
- changeFilterModeControlIcon(pref.getValue());
- for (View v1 : views) {
- v1.setActivated(v1 == v);
- }
- onSettingChanged(pref);
- }
-
+ public void onClick(View v) {
+ pref.setValueIndex(j);
+ for (View v1 : views) {
+ v1.setActivated(v1 == v);
}
- return true;
+ onSettingChanged(pref);
}
});
diff --git a/src/com/android/camera/VideoUI.java b/src/com/android/camera/VideoUI.java
index bbec12c..fc42434 100644
--- a/src/com/android/camera/VideoUI.java
+++ b/src/com/android/camera/VideoUI.java
@@ -629,13 +629,14 @@ public class VideoUI extends BaseUI implements PieRenderer.PieListener,
}
public boolean sendTouchToPreviewMenu(MotionEvent ev) {
+ ev.offsetLocation(-mPreviewMenuLayout.getLeft(), -mPreviewMenuLayout.getTop());
return mPreviewMenuLayout.dispatchTouchEvent(ev);
}
public boolean sendTouchToMenu(MotionEvent ev) {
if (mMenuLayout != null) {
- View v = mMenuLayout.getChildAt(0);
- return v.dispatchTouchEvent(ev);
+ ev.offsetLocation(-mMenuLayout.getLeft(), -mMenuLayout.getTop());
+ return mMenuLayout.dispatchTouchEvent(ev);
}
return false;
}
@@ -663,7 +664,6 @@ public class VideoUI extends BaseUI implements PieRenderer.PieListener,
}
public void showPopup(ListView popup, int level, boolean animate) {
- FrameLayout.LayoutParams layoutParams;
hideUI();
popup.setVisibility(View.VISIBLE);
@@ -671,16 +671,9 @@ public class VideoUI extends BaseUI implements PieRenderer.PieListener,
if (mMenuLayout == null) {
mMenuLayout = new RotateLayout(mActivity, null);
mMenuLayout.setRootView(mRootView);
- if (mRootView.getLayoutDirection() != View.LAYOUT_DIRECTION_RTL) {
- layoutParams = new FrameLayout.LayoutParams(
- CameraActivity.SETTING_LIST_WIDTH_1, LayoutParams.WRAP_CONTENT,
- Gravity.LEFT | Gravity.TOP);
- } else {
- layoutParams = new FrameLayout.LayoutParams(
- CameraActivity.SETTING_LIST_WIDTH_1, LayoutParams.WRAP_CONTENT,
- Gravity.RIGHT | Gravity.TOP);
- }
- mMenuLayout.setLayoutParams(layoutParams);
+ mMenuLayout.setLayoutParams(new FrameLayout.LayoutParams(
+ CameraActivity.SETTING_LIST_WIDTH_1, LayoutParams.WRAP_CONTENT,
+ Gravity.START | Gravity.TOP));
mRootView.addView(mMenuLayout);
}
mMenuLayout.addView(popup, new RotateLayout.LayoutParams(
@@ -697,15 +690,6 @@ public class VideoUI extends BaseUI implements PieRenderer.PieListener,
mRootView.addView(mSubMenuLayout);
}
- if (mRootView.getLayoutDirection() != View.LAYOUT_DIRECTION_RTL) {
- layoutParams = new FrameLayout.LayoutParams(
- CameraActivity.SETTING_LIST_WIDTH_2, LayoutParams.WRAP_CONTENT,
- Gravity.LEFT | Gravity.TOP);
- } else {
- layoutParams = new FrameLayout.LayoutParams(
- CameraActivity.SETTING_LIST_WIDTH_2, LayoutParams.WRAP_CONTENT,
- Gravity.RIGHT | Gravity.TOP);
- }
final int containerHeight =
mRootView.getClientRectForOrientation(mOrientation).height();
@@ -715,10 +699,14 @@ public class VideoUI extends BaseUI implements PieRenderer.PieListener,
y = Math.max(0, containerHeight - height);
}
- if (mRootView.getLayoutDirection() != View.LAYOUT_DIRECTION_RTL) {
- layoutParams.setMargins(CameraActivity.SETTING_LIST_WIDTH_1, y, 0, 0);
- } else {
+ final FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
+ CameraActivity.SETTING_LIST_WIDTH_2, LayoutParams.WRAP_CONTENT,
+ Gravity.START | Gravity.TOP);
+
+ if (isRtl()) {
layoutParams.setMargins(0, y, CameraActivity.SETTING_LIST_WIDTH_1, 0);
+ } else {
+ layoutParams.setMargins(CameraActivity.SETTING_LIST_WIDTH_1, y, 0, 0);
}
mSubMenuLayout.setLayoutParams(layoutParams);
@@ -747,6 +735,10 @@ public class VideoUI extends BaseUI implements PieRenderer.PieListener,
return mPreviewMenuLayout;
}
+ public boolean isRtl() {
+ return mRootView.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;
+ }
+
public void showPopup(AbstractSettingPopup popup) {
hideUI();