X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=altosdroid%2Fsrc%2Forg%2Faltusmetrum%2FAltosDroid%2FAltosMapOnline.java;h=9e5d6deea091acc9f9a8588956f9140adc28a149;hp=47113fab80cb6fc3580bc1683dcbafcf18336fbb;hb=1085ec5d57e0ed5d132f2bbdac1a0b6a32c0ab4a;hpb=90ba010aaa84a7d8b93c63543568a16ab0cb5984 diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/AltosMapOnline.java b/altosdroid/src/org/altusmetrum/AltosDroid/AltosMapOnline.java index 47113fab..9e5d6dee 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/AltosMapOnline.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/AltosMapOnline.java @@ -3,7 +3,8 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -19,7 +20,7 @@ package org.altusmetrum.AltosDroid; import java.util.*; -import org.altusmetrum.altoslib_9.*; +import org.altusmetrum.altoslib_11.*; import com.google.android.gms.maps.*; import com.google.android.gms.maps.model.*; @@ -102,7 +103,7 @@ class RocketOnline implements Comparable { } } -public class AltosMapOnline implements AltosDroidMapInterface, GoogleMap.OnMarkerClickListener, GoogleMap.OnMapClickListener { +public class AltosMapOnline implements AltosDroidMapInterface, GoogleMap.OnMarkerClickListener, GoogleMap.OnMapClickListener, AltosMapTypeListener { public SupportMapFragment mMapFragment; private GoogleMap mMap; private boolean mapLoaded = false; @@ -124,7 +125,8 @@ public class AltosMapOnline implements AltosDroidMapInterface, GoogleMap.OnMarke public void onCreateView(AltosDroid altos_droid) { this.altos_droid = altos_droid; - final int map_type = altos_droid.map_type; + final int map_type = AltosPreferences.map_type(); + AltosPreferences.register_map_type_listener(this); mMapFragment = new SupportMapFragment() { @Override public void onActivityCreated(Bundle savedInstanceState) { @@ -144,9 +146,9 @@ public class AltosMapOnline implements AltosDroidMapInterface, GoogleMap.OnMarke }; } -// public void onActivityCreated() { -// getChildFragmentManager().beginTransaction().add(R.id.map, mMapFragment).commit(); -// } + public void onDestroyView() { + AltosPreferences.unregister_map_type_listener(this); + } private double pixel_distance(LatLng a, LatLng b) { Projection projection = mMap.getProjection(); @@ -190,7 +192,7 @@ public class AltosMapOnline implements AltosDroidMapInterface, GoogleMap.OnMarke public void setupMap(int map_type) { mMap = mMapFragment.getMap(); if (mMap != null) { - set_map_type(map_type); + map_type_changed(map_type); mMap.setMyLocationEnabled(true); mMap.getUiSettings().setTiltGesturesEnabled(false); mMap.getUiSettings().setZoomControlsEnabled(false); @@ -308,7 +310,7 @@ public class AltosMapOnline implements AltosDroidMapInterface, GoogleMap.OnMarke } - public void set_map_type(int map_type) { + public void map_type_changed(int map_type) { if (mMap != null) { if (map_type == AltosMap.maptype_hybrid) mMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);