Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Support Custom InfoWindow Tap Handling #2283

Closed
bleege opened this issue Sep 8, 2015 · 2 comments
Closed

Support Custom InfoWindow Tap Handling #2283

bleege opened this issue Sep 8, 2015 · 2 comments
Assignees
Labels
Android Mapbox Maps SDK for Android

Comments

@bleege
Copy link
Contributor

bleege commented Sep 8, 2015

The original implementation of Popups didn't bring the ability to custom respond to InfoWindow taps. Let's add this by creating a method in MarkerOptions that allows a Custom View.OnTouchListener to be set using via InfoWindow.setOnTouchListener().

@bleege bleege added the Android Mapbox Maps SDK for Android label Sep 8, 2015
@bleege bleege added this to the android-v0.1.0 milestone Sep 8, 2015
@bleege bleege self-assigned this Sep 8, 2015
@bleege bleege changed the title Support Custom InfoWindow Response Support Custom InfoWindow Tap Handling Sep 8, 2015
@bleege
Copy link
Contributor Author

bleege commented Sep 8, 2015

After looking at this a bit further, as attractive as having the following be possible via MarkerOptions is, it's not practical as the developer will still likely need to close the InfoWindow and the primary way for doing that is via Marker. This means storing a reference to the Marker.

        // Ideal World
        mMapView.addMarker(new MarkerOptions()
            .position(backLot)
            .title("Some Location")
            .snippet("Some Snippet Text")
            .infoWindowOnTouchListener(new View.OnTouchListener() {
                @Override
                public boolean onTouch(View view, MotionEvent motionEvent) {
                    if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
                        // No access to Marker.hideInfoWindow() or InfoWindow.close()
                    }
                    return true;
                }
            }));
        // Real World
        final Marker marker = mMapView.addMarker(new MarkerOptions()
            .position(backLot)
            .title("Some Location")
            .snippet("Some Snippet Text"));

        marker.setInfoWindowOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View view, MotionEvent motionEvent) {
                // Do Custom Stuff
                // Hide It
                marker.hideInfoWindow();
                return true;
            }
        });

bleege added a commit that referenced this issue Sep 8, 2015
…foWindowOnTouchListener(). Added Test to Custom Annotations in TestApp's MainActivity.
@bleege
Copy link
Contributor Author

bleege commented Sep 8, 2015

Merged!

@bleege bleege closed this as completed Sep 8, 2015
bleege added a commit that referenced this issue Sep 11, 2015
…foWindowOnTouchListener(). Added Test to Custom Annotations in TestApp's MainActivity.
AndwareSsj pushed a commit to AndwareSsj/mapbox-gl-native that referenced this issue Nov 6, 2015
….setInfoWindowOnTouchListener(). Added Test to Custom Annotations in TestApp's MainActivity.
AndwareSsj pushed a commit to AndwareSsj/mapbox-gl-native that referenced this issue Nov 6, 2015
….setInfoWindowOnTouchListener(). Added Test to Custom Annotations in TestApp's MainActivity.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android
Projects
None yet
Development

No branches or pull requests

2 participants