10
10
import com .mapbox .mapboxsdk .annotations .IconFactory ;
11
11
import com .mapbox .mapboxsdk .annotations .Marker ;
12
12
13
+ import io .reactivex .Observable ;
13
14
import java .io .IOException ;
14
15
import java .util .ArrayList ;
15
16
import java .util .Collections ;
@@ -127,6 +128,12 @@ public NearbyPlacesInfo loadAttractionsFromLocation(LatLng curLatLng, LatLng sea
127
128
}
128
129
}
129
130
131
+ public Observable <List <Place >> queryWikiDataForMonuments (
132
+ LatLng latLng , String language )
133
+ throws IOException {
134
+ return nearbyPlaces .queryWikiDataForMonuments (latLng , language );
135
+ }
136
+
130
137
/**
131
138
* Loads attractions from location for list view, we need to return Place data type.
132
139
*
@@ -168,6 +175,7 @@ public static List<NearbyBaseMarker> loadAttractionsFromLocationToBaseMarkerOpti
168
175
VectorDrawableCompat vectorDrawable = null ;
169
176
VectorDrawableCompat vectorDrawableGreen = null ;
170
177
VectorDrawableCompat vectorDrawableGrey = null ;
178
+ VectorDrawableCompat vectorDrawableMonuments = null ;
171
179
vectorDrawable = null ;
172
180
try {
173
181
vectorDrawable = VectorDrawableCompat .create (
@@ -176,41 +184,49 @@ public static List<NearbyBaseMarker> loadAttractionsFromLocationToBaseMarkerOpti
176
184
context .getResources (), R .drawable .ic_custom_map_marker_green , context .getTheme ());
177
185
vectorDrawableGrey = VectorDrawableCompat .create (
178
186
context .getResources (), R .drawable .ic_custom_map_marker_grey , context .getTheme ());
187
+ vectorDrawableMonuments = VectorDrawableCompat
188
+ .create (context .getResources (), R .drawable .ic_custom_map_marker_monuments ,
189
+ context .getTheme ());
179
190
} catch (Resources .NotFoundException e ) {
180
191
// ignore when running tests.
181
192
}
182
193
if (vectorDrawable != null ) {
183
194
Bitmap icon = UiUtils .getBitmap (vectorDrawable );
184
195
Bitmap iconGreen = UiUtils .getBitmap (vectorDrawableGreen );
185
196
Bitmap iconGrey = UiUtils .getBitmap (vectorDrawableGrey );
197
+ Bitmap iconMonuments = UiUtils .getBitmap (vectorDrawableMonuments );
186
198
187
199
for (Place place : placeList ) {
200
+ NearbyBaseMarker nearbyBaseMarker = new NearbyBaseMarker ();
188
201
String distance = formatDistanceBetween (curLatLng , place .location );
189
202
place .setDistance (distance );
190
203
191
- NearbyBaseMarker nearbyBaseMarker = new NearbyBaseMarker ();
192
204
nearbyBaseMarker .title (place .name );
193
205
nearbyBaseMarker .position (
194
- new com .mapbox .mapboxsdk .geometry .LatLng (
195
- place .location .getLatitude (),
196
- place .location .getLongitude ()));
206
+ new com .mapbox .mapboxsdk .geometry .LatLng (
207
+ place .location .getLatitude (),
208
+ place .location .getLongitude ()));
197
209
nearbyBaseMarker .place (place );
198
210
// Check if string is only spaces or empty, if so place doesn't have any picture
199
- if (!place .pic .trim ().isEmpty ()) {
211
+
212
+ if (place .isMonument ()) {
213
+ nearbyBaseMarker .icon (IconFactory .getInstance (context )
214
+ .fromBitmap (iconMonuments ));
215
+ }
216
+ else if (!place .pic .trim ().isEmpty ()) {
200
217
if (iconGreen != null ) {
201
218
nearbyBaseMarker .icon (IconFactory .getInstance (context )
202
- .fromBitmap (iconGreen ));
219
+ .fromBitmap (iconGreen ));
203
220
}
204
221
} else if (!place .exists ) { // Means that the topic of the Wikidata item does not exist in the real world anymore, for instance it is a past event, or a place that was destroyed
205
222
if (iconGrey != null ) {
206
223
nearbyBaseMarker .icon (IconFactory .getInstance (context )
207
- .fromBitmap (iconGrey ));
224
+ .fromBitmap (iconGrey ));
208
225
}
209
226
} else {
210
227
nearbyBaseMarker .icon (IconFactory .getInstance (context )
211
- .fromBitmap (icon ));
228
+ .fromBitmap (icon ));
212
229
}
213
-
214
230
baseMarkerOptions .add (nearbyBaseMarker );
215
231
}
216
232
}
0 commit comments