subclass of google maps Android MapView not responding to touch - android

I am making a custom sub class of google maps api v2's MapView class on Android. I have it partly working but I cannot get it to respond to touches properly. I have tried OnTouch, onTouchEvent, and dispatchTouchEvent.
After some debugging I have found that only dispatchTouchEvent is intercepting any touches, and it seems only to be receiving single touch events nothing else.
Is there something else I have to do to get my custom MapView to respond to touch properly?
Thanks.
Update:
I have been able to get it to respond to double clicking, it seems that it is not detecting any sort of sliding and other related events.

Related

Listen to all (device-wide) touch events in Android

I am working on a background service that runs to give sound feedback device-wide whenever the user is touching the screen. I tried to create an overlay with a custom view to listen to touches and pass them down to the views below in a similar direction to what was attempted in this question but my overlay seemed to be either consuming all the touch events or if I returned false only the down touch was detected.
I was wondering if there was perhaps an accessibility route I could take? Basically I need a way to get the information of any current touches on the screen (preferably multitouch) I don't need to alter the touch event or anything, just need the information.

Map interactions not working when event starts on a marker [Mapbox]

I've got a Mapbox map working with custom markers. I've got an issue in that when I'm interacting with the map, regardless of type (zoom, pan, tilt etc) and number of fingers used, if one finger starts on a marker then that event will not work. The marker click listener doesn't get called, so it seems that the marker isn't consuming the event. I'd added logging to the other event listeners on the Mapbox view and none of them are being called either (OnCameraChangeListener, OnMapClickListener, OnScrollListener, OnFlingListener etc)
Debug mode on the Mapbox view is enabled.
The problem is that we have a lot of markers in a very small area, and it's almost impossible to manipulate the map.
We are working on a fix for this, you can track the progress here. One thing to note is that the fix most likely will break a few APIs in the SDK which means the fix won't make it till the 5.0 release of the Mapbox Android SDK. Hope this helps!

Disable all MapView gestures and add an OnClickListener to the MapView

I need to have a MapView that with all the gestures disabled. It's basically just for a little view in a fragment that when you press on it, it goes to a LocationPickerFragment. I don't think I'm doing it in the right way or neither the recommended way (as isn't working), but maybe you could give me a clue? I want to disable all the google maps stuff and add to the MapView an OnClickListener or other listener that allow me to execute some code when the user presses on the MapView.
To learn how to disable gesture, you can read this.
For example, To disable rotate gestures, you do
myMap.getUiSettings().setRotateGesturesEnabled(false); // Care to use getUiSettings(), not getUiSetting()
OnClickListerner can be read here. It is called when the user makes a tap gesture on the map, but only if none of the overlays of the map handled the gesture.
onMapClick(LatLng point)
There is googleMap.getUiSettings().setAllGesturesEnabled(false); to disable all gestures.

Android Wear Overlay Pass on Touch Events

I have an Android Wear app in which I use a transparent overlay view to recieve touch events. I need to be able to receive all touch events that happen anywhere on the screen, and also be able to see their coordinates.
All research I have found says that I cannot recieve all touch events and pass them on. However, Wear Mini Launcher and Swipify are both doing something like this.
Here is where I have looked:
Android overlay to grab ALL touch, and pass them on?
https://stackoverflow.com/questions/19356834/overlay-view-which-intercepts-some-events
Android - Intercept and pass on all touch events
Android : Multi touch and TYPE_SYSTEM_OVERLAY
Creating a system overlay window (always on top)
Getting the View that is receiving all the touch events
Android Jelly Bean service that receives all touch events
TYPE_SYSTEM_OVERLAY in ICS
Overlay App that reacts only on some touch events
This must be possible to do somehow. Maybe an overlay view is not the right way to approach this? Any pointers?
I had quite a bit of trouble with this as well using the same links that you provided. But then I found this: http://www.piwai.info/chatheads-basics/
It's basically the same as the other solutions, except that the arguments to the WindowManager LayoutParams are TYPE_PHONE and FLAG_NOT_FOCUSABLE.
Not only did this solution work for me (I was testing on an LG Urbane), the onTouchEvent callback had all the actions (down, move, and up), which the other solutions said you wouldn't get.
Since all the touch events are passed through the view, in theory we can use gesture detectors to get callbacks for things like double taps and flings. I haven't tried this yet, though.
Regardless, the above link should get you past the initial problems you're facing.

Android Overlay doesn't dispatch events

So i wrote an Overlay with the WindowManager.LayoutParams.TYPE_PHONE Flag, everything seems to work as it should with the Problem that i want to align the Elements inside the Overlay on bottom of the Screen.
I did this via android:layout_alignParentBottom="true".
Now the Problem is that every touch event inside the Layout gets dispatched to me, while i only want the touches which hit my Controls. I tried calling return super.onTouchEvent(event); with no succes. Is there any way to return the touch events back to Android so they get handled properly?
Solved my Problem via the Interactive Overlay example, if you got the same or a similar problem the example might help you. http://www.jawsware.mobi/code_OverlayView/

Categories

Resources