Skip to content

wrparrish/RxGoogleMaps

 
 

Repository files navigation

RxGoogleMaps

Download API

A library which provides an RxJava wrapper for google maps. It is something similar to [Jake Whartons rxBindings] (https://github.com/JakeWharton/RxBinding) but for google maps.

This is currently using play services 8.4.0

Download

compile 'com.sdoward:rxgooglemaps:0.2@aar'
compile 'compile io.reactivex:rxjava:1.1.0'
compile 'com.google.android.gms:play-services-maps:8.4.0'

Usage

MapFragment mapFragment = (MapFragment) getFragmentManager().findFragmentById(R.id.map);
mapObservableProvider = new MapObservableProvider(mapFragment);
mapObservableProvider.getMapClickObservable()
        .subscribe(new Action1<LatLng>() {
            @Override
            public void call(LatLng latLng) {
                Log.d(MapsActivity.class.getName(), "map click");
            }
        });

You can find a more comprehensive example in the Example module.

API

There is one class to interact with which is MapObservableProvider. This has 3 constructors which accepts either...

  • MapFragment
  • SupportMapFragment
  • MapView

This provides the following observables...

  • MapReady
  • MapClick
  • MapLngClick
  • PolylineClick
  • PolygonClick
  • GroundOverlayClick
  • MarkerClick
  • InfoWindowClick
  • InfoWindowLongClick
  • InfoWindowClose
  • DragChange
  • CameraChange
  • IndoorBuildingChange

Example Setup

To use the example add apikey=<your google api key> to local.properties

License

Copyright (C) 2015 Sam Doward

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

Rx Wrapper For Google maps

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%