Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rotation Gesture Detector Only works with Single ImageView. #5

Open
kirtan007 opened this issue Oct 25, 2013 · 12 comments
Open

Rotation Gesture Detector Only works with Single ImageView. #5

kirtan007 opened this issue Oct 25, 2013 · 12 comments

Comments

@kirtan007
Copy link

If I created Two ImageView instances in Single Activity and Attach Separate Instances of Rotation Gesture Detector to them the Only Rotation Listener for First ImageView Is Working Second Image's Rotation Gestures are not being able to detect .Please provide some solution to that its been 8 hours I am searching for solution.

Thanks.

@Almeros
Copy link
Owner

Almeros commented Dec 17, 2013

Did you set different OnTouchListener instances for the two ImageViews? Can't see why it wouldn't work, but also don't know how you setup your classes.

@jpjodoin
Copy link

I had a similar issue. Problem was that TwoFingerGestureDetecture.getRaw Y was returning a negative value which would discard everything in the RotateGestureDetector has sloppy gesture. Returning simply event.getRawY() has resolved my issue.

So, for those having the issue, just replace in TwoFingerGestureDetector.java:
protected static float getRawX(MotionEvent event, int pointerIndex) {
return event.getRawX();}
protected static float getRawY(MotionEvent event, int pointerIndex) {
return event.getRawY();}

@gmavenis
Copy link

gmavenis commented Jan 8, 2015

I have more images on 1 Activity, but I can only touch on top image.
If I set as below, it's still not working:
android:layout_width="wrap_content"
android:layout_height="wrap_content"

I dont want process if touch outside of image. Please help.
Thanks.

@jpjodoin
Copy link

jpjodoin commented Jan 8, 2015

@gmavenis You can try my solution, it works for me. Let me know.

@AndroidDeveloperLB
Copy link

Did you guys solve this issue somehow?
EDIT: seems that "jpjodoin" solution works well. Can this please be an official fix and be pushed into the repo?

@AndroidDeveloperLB
Copy link

Anyway, I've made a fork that has this issue fixed:
https://github.com/AndroidDeveloperLB/android-gesture-detectors

@airtel121
Copy link

Still not worked for more then one images

@AndroidDeveloperLB
Copy link

@airtel121 Have you tried my fork ?

@airtel121
Copy link

Yes i replace TwoFingerGestureDetector.java from your fork.But only upper image is sensing the touch i set width and height to fill_parent so.
But if i set to wrap_content then image only scale inside its default location.

@airtel121
Copy link

How to archive functionality for example if i have two image inside FrameLayout having width and height set to fill_parent.
-If i touch 1st image it should drag,rotate,zoom inside whole screen and if i touch second image it should drag,rotate,zoom inside whole screen.
Note:two image is just for sample purpose there may be multiple image inside FrameLayout and can be added dynamically.

@AndroidDeveloperLB
Copy link

First, you should avoid setting them both to fill_parent. Use wrap_content or a fixed sized.
You can check out my sample here:
https://github.com/AndroidDeveloperLB/MultiTouchPlaceholderView

Not exactly what you want, but you can modify it to your needs.

mariopce pushed a commit to mariopce/android-gesture-detectors that referenced this issue Jan 22, 2019
@mariopce
Copy link

Fixed and tested on my fork

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants