dispatching touch events - android

I have 12 horoscope sign images which are placed in 360 degree circular position. ImageButtons are being used to display the horoSignImages. ImageButton has selector that show pressed and unpressed states for horosSignImage. The signWheel rotates by using gestuer.
Problem is that, When i tap right over the horosignImage to rotate the wheel, the imageButton catches the event and wheel is not rotated upon scrolling the finger. I want to animate the image its pressed state when the user taps right over it, meanwhile the wheel should rotate if the user scrolls his finger. Wheel rotation only works if i tap outside the horosignImage and scroll the finger.
Any suggestions to solve this problem?

Sadly I don't have the answer, but your problem seems to be similar to Passing touch events to the parent view
In both cases you want the touch event handled by the imageButton as well as the signWheel.

Related

OpenGL sprite looses focus on fast move

I'm making simple app where user can move squares with finger on screen. First I'm checking if touch coords are on square to allow the move. Then square is moving along GLSurfaceView#onTouchEvent event coordinates.
It works OK. But when finger is moving too quick (like swipe) square looses the focus and stays still. It seems that OpenGL renders square after the move event occurs, so coordinates check fail.
Please point some keywords to figure out the question (googling gives same links again and again) or some docs. Thanks.
You need hold focus on sprite. If sprite got event "down" it holds focus until doesn't get "up" or "cancel" event. So, while sprite holds focus all touch events send to it.

Getting onTouch() when user's finger is already on the screen

I dynamically create a View with onTouchListner. The problem is it doesn't work when the view is being created the same time the user keeps his finger on the screen.
To trigger onTouch() user has to put his finger off the screen and touch it again.
How to solve that?
May be you can try to track coordinates of the touch event when user moves the finger.If the Coordinates are in your views coordinates boundary you can intercept that event and play sound.

have textview change style/attribute on touch roll-off

Ok, I simply can't figure this out for the life of me. I created a custom textview and I basically want it to be a button. I have all my code working except that I can't get it to detect when touched, and then the touch event rolls out of its boundary. Say the textview lights up grey when touched, then if the user drags their finger away to the left or right, I want to have the grey disappear and reset to its normal background color.
I realize I can just use the standard android button, but I don't like how it delays on changing color for the touch event. Maybe someone knows where the stock Button.java class code is, for the android API so I can look at that for hints?
I have tried getting the dimensions of the button with an on global listener and then tracking user touch events to be within those dimensions. And the dimensions and touch location are reported correctly and works sometimes, but it simply doesn't work reliably, maybe due to the user moving too quickly, for example. Even if I set the touch boundary a few pixels inside of the actual boundary.

Pinch Zoom with gallery

I'm trying to combine the capability of doing image zoom/panning
inside of a Gallery view. The problem is controlling which touch
events are processed by each. In a horizontal drag on the image, the
ImageView needs to process the drag in order to pan, up until the edge
of the image is reached then the gallery view needs to process the
touch event so that it can swipe over to the next photo.
It seems that if I return false from the imageview's ontouchevent,
then I won't be notified of the panning-drag move events.
What I tried to do was return true from the imageview's ontouchevent
until the edge of the image was hit then return false. However I
believe that this doesn't cause the Gallery to begin processing these
events, as it missed the initial touchdown event.
My next thought is to somehow turn the containing activity into the
touch handler, and somehow stop the Gallery and ImageView from getting
touch events normally, and have the activity forward the touch event's
manually. Not sure if this is possible or if there is an example.
My last resort will be to simply not use the android.widget.Gallery,
which I want to avoid because I want the widget to "feel" the same as
other places on the phone, and I like code re-use. Unfortunately I
might have to do this, as I see all other apps that have this zoom/pan
capability don't seem to use the Gallery widget (Gallery3D etc).
My question is, what's the best way to design for this situation where
motionevents need to split between two views? Any ideas would be
greatly appreciated thank you.
please follow the links here.
http://jmsliu.com/138/android-infinite-loop-gallery.html

Android: My imageview is rotated, but its touch area isn't

I have a rectangular Imageview that responds to touch (it rotates by a specific number of degrees, using animation). The imageview has an ontouchlistener attached to it.
However, once it has rotated, it still responds to touch only at its original (pre-rotation) location. Even though I have setfillafter to true.
My theory is that the rotation is for display purposes only... is there a way to detect a touch on a rectangular imageview rotated at an angle - e.g. 45 degrees?
When animation is applied to a view in android, only the pixels of the view are shifted while the hit area remains in the same position.
To actually move a view, you will need to add a animation listener to the view and manually change the view position on animation end.

Categories

Resources