diff --git a/app/src/main/java/pl/tpolgrabia/urbanexplorer/fragments/HomeFragment.java b/app/src/main/java/pl/tpolgrabia/urbanexplorer/fragments/HomeFragment.java index a4f83c4..61c87b0 100644 --- a/app/src/main/java/pl/tpolgrabia/urbanexplorer/fragments/HomeFragment.java +++ b/app/src/main/java/pl/tpolgrabia/urbanexplorer/fragments/HomeFragment.java @@ -127,7 +127,34 @@ public class HomeFragment extends Fragment implements LocationListener { if (firstVisibleItem + visibleItemCount >= totalItemCount) { // scrolled to the bottom + Location location = locationService.getLastKnownLocation(locationProvider); + PanoramioUtils.fetchPanoramioImages( + getActivity(), + location.getLatitude(), + location.getLongitude(), + fetchRadiusX(), + fetchRadiusY(), + (long)(firstVisibleItem + visibleItemCount), + fetchLocationPageSize(), + new PanoramioResponseCallback() { + @Override + public void callback(PanoramioResponseStatus status, List images, Long imagesCount) { + if (status != PanoramioResponseStatus.SUCCESS) { + return; + } + PanoramioAdapter adapter = (PanoramioAdapter) locations.getAdapter(); + adapter.addAll(images); + + // TODO loading on end scroll should now working + // TODO we can remove pagination + // TODO we can think about removing first items also and last if the number + // TODO of items exceeds the limit (to save the memory) + + } + } + + ); }