diff --git a/OsmAnd/src/net/osmand/plus/exploreplaces/ExplorePlacesProviderJava.java b/OsmAnd/src/net/osmand/plus/exploreplaces/ExplorePlacesProviderJava.java index 929ebcda27b..abe53b5b85a 100644 --- a/OsmAnd/src/net/osmand/plus/exploreplaces/ExplorePlacesProviderJava.java +++ b/OsmAnd/src/net/osmand/plus/exploreplaces/ExplorePlacesProviderJava.java @@ -33,11 +33,11 @@ // TODO display all data downloaded even if maps are not loaded // TODO: why recreate provider when new points are loaded? that causes blinking // TODO: scheduleImageRefreshes in layer is incorrect it starts downloading all images and stops interacting -//. images for download should be correctly calculated before schedule based on overlap // TODO images shouldn't be queried if they are not visible in all lists! size doesn't matter ! // TODO show on map close button is not visible // TODO layer sometimes becomes non-interactive - MAP FPS drops // TODO Context menu doesn't work correctly and duplicates actual POI +// TODO compass is not rotating // Extra: display new categories from web public class ExplorePlacesProviderJava implements ExplorePlacesProvider { diff --git a/OsmAnd/src/net/osmand/plus/search/listitems/NearbyPlacesCard.java b/OsmAnd/src/net/osmand/plus/search/listitems/NearbyPlacesCard.java index 1db76b6ba30..67007aac2e3 100644 --- a/OsmAnd/src/net/osmand/plus/search/listitems/NearbyPlacesCard.java +++ b/OsmAnd/src/net/osmand/plus/search/listitems/NearbyPlacesCard.java @@ -25,6 +25,7 @@ public class NearbyPlacesCard extends FrameLayout implements ExplorePlacesProvider.ExplorePlacesListener { + private static final int DISPLAY_ITEMS = 25; private boolean collapsed; private ImageView explicitIndicator; private View titleContainer; @@ -81,7 +82,7 @@ private void setupRecyclerView() { nearByList.setLayoutManager(layoutManager); nearByList.setItemAnimator(null); visiblePlacesRect = app.getOsmandMap().getMapView().getCurrentRotatedTileBox().getLatLonBounds(); - adapter = new NearbyPlacesAdapter(app, app.getExplorePlacesProvider().getDataCollection(visiblePlacesRect), false, clickListener); + adapter = new NearbyPlacesAdapter(app, app.getExplorePlacesProvider().getDataCollection(visiblePlacesRect, DISPLAY_ITEMS), false, clickListener); nearByList.setAdapter(adapter); } @@ -97,7 +98,7 @@ private void updateExpandState() { private NearbyPlacesAdapter getNearbyAdapter() { if (adapter == null) { - List nearbyData = app.getExplorePlacesProvider().getDataCollection(visiblePlacesRect); + List nearbyData = app.getExplorePlacesProvider().getDataCollection(visiblePlacesRect, DISPLAY_ITEMS); adapter = new NearbyPlacesAdapter(app, nearbyData, false, clickListener); } return adapter; @@ -107,7 +108,7 @@ private NearbyPlacesAdapter getNearbyAdapter() { public void onNewExplorePlacesDownloaded() { isLoadingItems = false; AndroidUiHelper.updateVisibility(progressBar, app.getExplorePlacesProvider().isLoading()); - adapter.setItems(app.getExplorePlacesProvider().getDataCollection(visiblePlacesRect)); + adapter.setItems(app.getExplorePlacesProvider().getDataCollection(visiblePlacesRect, DISPLAY_ITEMS)); adapter.notifyDataSetChanged(); updateExpandState(); } @@ -131,7 +132,8 @@ private void onNearbyPlacesCollapseChanged() { private void startLoadingNearbyPlaces() { isLoadingItems = true; app.getExplorePlacesProvider().getDataCollection( - app.getOsmandMap().getMapView().getCurrentRotatedTileBox().getLatLonBounds() + app.getOsmandMap().getMapView().getCurrentRotatedTileBox().getLatLonBounds(), + DISPLAY_ITEMS ); AndroidUiHelper.updateVisibility(progressBar, app.getExplorePlacesProvider().isLoading()); } diff --git a/OsmAnd/src/net/osmand/plus/views/layers/ExploreTopPlacesLayer.java b/OsmAnd/src/net/osmand/plus/views/layers/ExploreTopPlacesLayer.java index 3c760eccf8d..0507d623a7d 100644 --- a/OsmAnd/src/net/osmand/plus/views/layers/ExploreTopPlacesLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/layers/ExploreTopPlacesLayer.java @@ -328,16 +328,14 @@ public LatLon getObjectLocation(Object o) { private void scheduleImageRefreshes(List nearbyPlacePoints) { Picasso.get().cancelTag(LOAD_NEARBY_IMAGES_TAG); - - List nearbyPlacePointsList = new ArrayList<>(); int ind = 0; for (ExploreTopPlacePoint point : nearbyPlacePoints) { - nearbyPlacePointsList.add(point); if (!Algorithms.isEmpty(point.getIconUrl()) && ind ++ < TOP_LOAD_PHOTOS) { Target imgLoadTarget = new Target() { @Override public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) { point.setImageBitmap(bitmap); + LOG.info(String.format("Picasso loaded %s", point.getIconUrl())); imagesUpdatedVersion++; }