Code cleanup.

master
Tomasz Półgrabia 2016-10-04 22:34:30 +02:00
parent d771451aab
commit 90238d5515
2 changed files with 3 additions and 15 deletions

View File

@ -193,7 +193,7 @@ public class PlacesFragment extends Fragment {
request.setLocation(location);
request.setSearchRadius(AppConstants.DEF_PLACES_RADIUS);
request.setSearchItemType(GooglePlacesConstants.PLACES_SEARCH_TYPE);
new GooglePlacesWorker(getActivity(), this).execute(request);
new GooglePlacesWorker(getActivity()).execute(request);
}
public void loadNextPage() {
@ -216,7 +216,7 @@ public class PlacesFragment extends Fragment {
request.setSearchRadius(AppConstants.DEF_PLACES_RADIUS);
request.setSearchItemType(GooglePlacesConstants.PLACES_SEARCH_TYPE);
request.setPageToken(nextPageToken);
new GooglePlacesWorker(getActivity(), this).execute(request);
new GooglePlacesWorker(getActivity()).execute(request);
}
public void setNextPageToken(String nextPageToken) {

View File

@ -36,13 +36,9 @@ public class GooglePlacesWorker extends AsyncTask<GooglePlacesRequest, Integer,
private static final Logger lg = LoggerFactory.getLogger(GooglePlacesWorker.class);
private final Context ctx;
private final PlacesUtils placesUtils;
private final PlacesFragment placesFragment;
public GooglePlacesWorker(Context ctx, PlacesFragment placesFragment) {
this.ctx = ctx;
this.placesFragment = placesFragment;
public GooglePlacesWorker(Context ctx) {
this.placesUtils = new PlacesUtils(ctx, AppConstants.GOOGLE_API_KEY);
}
@ -87,17 +83,9 @@ public class GooglePlacesWorker extends AsyncTask<GooglePlacesRequest, Integer,
@Override
protected void onPostExecute(List<GooglePlacesResponse> googlePlacesResponses) {
lg.debug("Post execute {}", googlePlacesResponses);
// final View view = placesFragment.getView();
// if (view == null) {
// lg.error("Fragment not attached to the view");
// return;
// }
for (GooglePlacesResponse response : googlePlacesResponses) {
// placesFragment.setNextPageToken(response.getNextPageToken());
// ListView places = (ListView) view.findViewById(R.id.google_places);
EventBus.getDefault().post(response);
// places.setAdapter(new PlacesAdapter(ctx, response));
}
}
}