Completed finished (panoramio was shut down :)).

master
Tomasz Półgrabia 2016-11-20 17:55:34 +01:00
parent 0258ac81b4
commit aaead3085b
2 changed files with 30 additions and 12 deletions

View File

@ -20,13 +20,13 @@ import pl.tpolgrabia.panoramiobindings.utils.PanoramioUtils;
import pl.tpolgrabia.urbanexplorer.AppConstants; import pl.tpolgrabia.urbanexplorer.AppConstants;
import pl.tpolgrabia.urbanexplorer.MainActivity; import pl.tpolgrabia.urbanexplorer.MainActivity;
import pl.tpolgrabia.urbanexplorer.R; import pl.tpolgrabia.urbanexplorer.R;
import pl.tpolgrabia.urbanexplorer.callbacks.*;
import pl.tpolgrabia.panoramiobindings.dto.PanoramioImageInfo; import pl.tpolgrabia.panoramiobindings.dto.PanoramioImageInfo;
import pl.tpolgrabia.urbanexplorer.callbacks.geocoder.GeocodedLocationCallback; import pl.tpolgrabia.urbanexplorer.callbacks.geocoder.GeocodedLocationCallback;
import pl.tpolgrabia.urbanexplorer.callbacks.panoramio.FetchAdditionalPanoramioPhotosCallback; import pl.tpolgrabia.urbanexplorer.callbacks.panoramio.FetchAdditionalPanoramioPhotosCallback;
import pl.tpolgrabia.urbanexplorer.callbacks.panoramio.FetchPanoramioPhotosCallback;
import pl.tpolgrabia.urbanexplorer.callbacks.panoramio.PanoramioLocationCallback; import pl.tpolgrabia.urbanexplorer.callbacks.panoramio.PanoramioLocationCallback;
import pl.tpolgrabia.urbanexplorer.callbacks.panoramio.PanoramioProviderCallback; import pl.tpolgrabia.urbanexplorer.callbacks.panoramio.PanoramioProviderCallback;
import pl.tpolgrabia.urbanexplorer.dto.PanoramioRequest;
import pl.tpolgrabia.urbanexplorer.worker.PanoramioWorker;
import pl.tpolgrabia.urbanexplorerutils.events.DataLoadingFinishEvent; import pl.tpolgrabia.urbanexplorerutils.events.DataLoadingFinishEvent;
import pl.tpolgrabia.urbanexplorerutils.events.RefreshEvent; import pl.tpolgrabia.urbanexplorerutils.events.RefreshEvent;
import pl.tpolgrabia.urbanexplorer.handlers.PanoramioItemLongClickHandler; import pl.tpolgrabia.urbanexplorer.handlers.PanoramioItemLongClickHandler;
@ -259,16 +259,26 @@ public class HomeFragment extends Fragment {
Toast.makeText(getActivity(), "Location is still not available", Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), "Location is still not available", Toast.LENGTH_SHORT).show();
return; return;
} }
PanoramioUtils.fetchPanoramioImages(
activity, PanoramioRequest req = new PanoramioRequest();
location.getLatitude(), req.setLatitude(location.getLatitude());
location.getLongitude(), req.setLongitude(location.getLongitude());
SettingsUtils.fetchRadiusX(getActivity()), req.setOffset(0L);
SettingsUtils.fetchRadiusY(getActivity()), req.setCount(fetchLocationPageSize());
0L, req.setRadiusX(SettingsUtils.fetchRadiusX(getActivity()));
fetchLocationPageSize(), req.setRadiusY(SettingsUtils.fetchRadiusY(getActivity()));
new FetchPanoramioPhotosCallback(this, activity) new PanoramioWorker(this).execute(req);
);
// PanoramioUtils.fetchPanoramioImages(
// activity,
// location.getLatitude(),
// location.getLongitude(),
// SettingsUtils.fetchRadiusX(getActivity()),
// SettingsUtils.fetchRadiusY(getActivity()),
// 0L,
// fetchLocationPageSize(),
// new FetchPanoramioPhotosCallback(this, activity)
// );
} }
public Semaphore getLoading() { public Semaphore getLoading() {

View File

@ -7,6 +7,7 @@ import org.slf4j.LoggerFactory;
import pl.tpolgrabia.panoramiobindings.dto.PanoramioResponse; import pl.tpolgrabia.panoramiobindings.dto.PanoramioResponse;
import pl.tpolgrabia.panoramiobindings.utils.PanoramioUtils; import pl.tpolgrabia.panoramiobindings.utils.PanoramioUtils;
import pl.tpolgrabia.urbanexplorer.dto.PanoramioRequest; import pl.tpolgrabia.urbanexplorer.dto.PanoramioRequest;
import pl.tpolgrabia.urbanexplorer.fragments.HomeFragment;
import retrofit2.Response; import retrofit2.Response;
import java.io.IOException; import java.io.IOException;
@ -19,6 +20,11 @@ import java.util.List;
public class PanoramioWorker extends AsyncTask<PanoramioRequest, Integer, List<PanoramioResponse>> { public class PanoramioWorker extends AsyncTask<PanoramioRequest, Integer, List<PanoramioResponse>> {
private static final Logger lg = LoggerFactory.getLogger(PanoramioWorker.class); private static final Logger lg = LoggerFactory.getLogger(PanoramioWorker.class);
private final HomeFragment homeFragment;
public PanoramioWorker(HomeFragment homeFragment) {
this.homeFragment = homeFragment;
}
@Override @Override
protected List<PanoramioResponse> doInBackground(PanoramioRequest... params) { protected List<PanoramioResponse> doInBackground(PanoramioRequest... params) {
@ -57,5 +63,7 @@ public class PanoramioWorker extends AsyncTask<PanoramioRequest, Integer, List<P
super.onPostExecute(panoramioResponses); super.onPostExecute(panoramioResponses);
lg.warn("NOT IMPLEMENTED"); lg.warn("NOT IMPLEMENTED");
// TODO implement this // TODO implement this
} }
} }