Code cleanup.
parent
d771451aab
commit
90238d5515
|
@ -193,7 +193,7 @@ public class PlacesFragment extends Fragment {
|
||||||
request.setLocation(location);
|
request.setLocation(location);
|
||||||
request.setSearchRadius(AppConstants.DEF_PLACES_RADIUS);
|
request.setSearchRadius(AppConstants.DEF_PLACES_RADIUS);
|
||||||
request.setSearchItemType(GooglePlacesConstants.PLACES_SEARCH_TYPE);
|
request.setSearchItemType(GooglePlacesConstants.PLACES_SEARCH_TYPE);
|
||||||
new GooglePlacesWorker(getActivity(), this).execute(request);
|
new GooglePlacesWorker(getActivity()).execute(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadNextPage() {
|
public void loadNextPage() {
|
||||||
|
@ -216,7 +216,7 @@ public class PlacesFragment extends Fragment {
|
||||||
request.setSearchRadius(AppConstants.DEF_PLACES_RADIUS);
|
request.setSearchRadius(AppConstants.DEF_PLACES_RADIUS);
|
||||||
request.setSearchItemType(GooglePlacesConstants.PLACES_SEARCH_TYPE);
|
request.setSearchItemType(GooglePlacesConstants.PLACES_SEARCH_TYPE);
|
||||||
request.setPageToken(nextPageToken);
|
request.setPageToken(nextPageToken);
|
||||||
new GooglePlacesWorker(getActivity(), this).execute(request);
|
new GooglePlacesWorker(getActivity()).execute(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNextPageToken(String nextPageToken) {
|
public void setNextPageToken(String nextPageToken) {
|
||||||
|
|
|
@ -36,13 +36,9 @@ public class GooglePlacesWorker extends AsyncTask<GooglePlacesRequest, Integer,
|
||||||
|
|
||||||
private static final Logger lg = LoggerFactory.getLogger(GooglePlacesWorker.class);
|
private static final Logger lg = LoggerFactory.getLogger(GooglePlacesWorker.class);
|
||||||
|
|
||||||
private final Context ctx;
|
|
||||||
private final PlacesUtils placesUtils;
|
private final PlacesUtils placesUtils;
|
||||||
private final PlacesFragment placesFragment;
|
|
||||||
|
|
||||||
public GooglePlacesWorker(Context ctx, PlacesFragment placesFragment) {
|
public GooglePlacesWorker(Context ctx) {
|
||||||
this.ctx = ctx;
|
|
||||||
this.placesFragment = placesFragment;
|
|
||||||
this.placesUtils = new PlacesUtils(ctx, AppConstants.GOOGLE_API_KEY);
|
this.placesUtils = new PlacesUtils(ctx, AppConstants.GOOGLE_API_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,17 +83,9 @@ public class GooglePlacesWorker extends AsyncTask<GooglePlacesRequest, Integer,
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(List<GooglePlacesResponse> googlePlacesResponses) {
|
protected void onPostExecute(List<GooglePlacesResponse> googlePlacesResponses) {
|
||||||
lg.debug("Post execute {}", 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) {
|
for (GooglePlacesResponse response : googlePlacesResponses) {
|
||||||
// placesFragment.setNextPageToken(response.getNextPageToken());
|
|
||||||
// ListView places = (ListView) view.findViewById(R.id.google_places);
|
|
||||||
EventBus.getDefault().post(response);
|
EventBus.getDefault().post(response);
|
||||||
// places.setAdapter(new PlacesAdapter(ctx, response));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue