1010import android .widget .TextView ;
1111import android .widget .Toast ;
1212
13- import com .airbnb .android .airmapview .AirMapInterface ;
14- import com .airbnb .android .airmapview .AirMapMarker ;
15- import com .airbnb .android .airmapview .AirMapView ;
16- import com .airbnb .android .airmapview .AirMapViewTypes ;
17- import com .airbnb .android .airmapview .DefaultAirMapViewBuilder ;
18- import com .airbnb .android .airmapview .listeners .OnCameraChangeListener ;
19- import com .airbnb .android .airmapview .listeners .OnCameraMoveListener ;
20- import com .airbnb .android .airmapview .listeners .OnLatLngScreenLocationCallback ;
21- import com .airbnb .android .airmapview .listeners .OnInfoWindowClickListener ;
22- import com .airbnb .android .airmapview .listeners .OnMapClickListener ;
23- import com .airbnb .android .airmapview .listeners .OnMapInitializedListener ;
24- import com .airbnb .android .airmapview .listeners .OnMapMarkerClickListener ;
13+ import com .airbnb .android .airmapview .*;
14+ import com .airbnb .android .airmapview .listeners .*;
15+ import com .google .android .gms .maps .GoogleMapOptions ;
2516import com .google .android .gms .maps .model .LatLng ;
2617import com .google .android .gms .maps .model .Marker ;
2718
@@ -75,6 +66,15 @@ public class MainActivity extends ActionBarActivity
7566 }
7667 } else if (id == R .id .action_web_map ) {
7768 airMapInterface = mapViewBuilder .builder (AirMapViewTypes .WEB ).build ();
69+ } else if (id == R .id .action_web_map_no_touch || id == R .id .action_native_map_no_touch ) {
70+ try {
71+ airMapInterface = createMapWithTouchDisabled (id == R .id .action_web_map_no_touch ? AirMapViewTypes .WEB : AirMapViewTypes .NATIVE );
72+ } catch (UnsupportedOperationException e ) {
73+ Toast .makeText (this , "Sorry, native Google Maps are not supported by this device. " +
74+ "Please make sure you have Google Play Services installed." ,
75+ Toast .LENGTH_SHORT ).show ();
76+ }
77+
7878 } else if (id == R .id .action_clear_logs ) {
7979 textLogs .setText ("" );
8080 }
@@ -86,6 +86,14 @@ public class MainActivity extends ActionBarActivity
8686 return super .onOptionsItemSelected (item );
8787 }
8888
89+ private AirMapInterface createMapWithTouchDisabled (AirMapViewTypes type ) {
90+ AirGoogleMapOptions options = new AirGoogleMapOptions (new GoogleMapOptions ());
91+ // options.setTouchEnabled(false);
92+
93+ AirMapInterface airMapInterface = mapViewBuilder .builder (type ).withOptions (options ).build ();
94+ return airMapInterface ;
95+ }
96+
8997 @ Override public void onCameraChanged (LatLng latLng , int zoom ) {
9098 appendLog ("Map onCameraChanged triggered with lat: " + latLng .latitude + ", lng: "
9199 + latLng .longitude );
@@ -98,6 +106,7 @@ public class MainActivity extends ActionBarActivity
98106 addMarker ("Performance Bikes" , new LatLng (37.773975 , -122.40205 ), 2 );
99107 addMarker ("REI" , new LatLng (37.772127 , -122.404411 ), 3 );
100108 map .animateCenterZoom (airbnbLatLng , 10 );
109+ map .setTouchEnabled (false );
101110 }
102111
103112 private void addMarker (String title , LatLng latLng , int id ) {
0 commit comments