diff --git a/app/src/main/java/pl/tpolgrabia/urbanexplorer/adapters/PlacesAdapter.java b/app/src/main/java/pl/tpolgrabia/urbanexplorer/adapters/PlacesAdapter.java index 42c55ce..ed5865c 100644 --- a/app/src/main/java/pl/tpolgrabia/urbanexplorer/adapters/PlacesAdapter.java +++ b/app/src/main/java/pl/tpolgrabia/urbanexplorer/adapters/PlacesAdapter.java @@ -54,7 +54,11 @@ public class PlacesAdapter extends ArrayAdapter { placeAddressWidget.setText(item.getVicinity()); TextView placeRateWidget = (TextView) resultView.findViewById(R.id.place_rate); - placeRateWidget.setText("" + item.getRating()); + if (item.getRating() != null && !item.getRating().equals(Double.NaN)) { + placeRateWidget.setText("" + item.getRating()); + } else { + placeRateWidget.setText("N/A"); + } ImageView placePreviewWidget = (ImageView)resultView.findViewById(R.id.place_img_preview); placePreviewWidget.setImageBitmap(BitmapFactory.decodeResource(getContext().getResources(), R.drawable.noimage)); diff --git a/app/src/main/java/pl/tpolgrabia/urbanexplorer/dto/GooglePlacesResponse.java b/app/src/main/java/pl/tpolgrabia/urbanexplorer/dto/GooglePlacesResponse.java index 2a8bca4..3def24e 100644 --- a/app/src/main/java/pl/tpolgrabia/urbanexplorer/dto/GooglePlacesResponse.java +++ b/app/src/main/java/pl/tpolgrabia/urbanexplorer/dto/GooglePlacesResponse.java @@ -12,6 +12,7 @@ public class GooglePlacesResponse { private String nextPageToken; private String originalPageToken; + private String status; public List getPlaces() { return places; @@ -37,12 +38,21 @@ public class GooglePlacesResponse { return originalPageToken; } + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + @Override public String toString() { return "GooglePlacesResponse{" + "places=" + places + ", nextPageToken='" + nextPageToken + '\'' + ", originalPageToken='" + originalPageToken + '\'' + + ", status='" + status + '\'' + '}'; } } diff --git a/app/src/main/java/pl/tpolgrabia/urbanexplorer/fragments/PlacesFragment.java b/app/src/main/java/pl/tpolgrabia/urbanexplorer/fragments/PlacesFragment.java index 708ecec..b9cfef4 100644 --- a/app/src/main/java/pl/tpolgrabia/urbanexplorer/fragments/PlacesFragment.java +++ b/app/src/main/java/pl/tpolgrabia/urbanexplorer/fragments/PlacesFragment.java @@ -179,6 +179,8 @@ public class PlacesFragment extends Fragment { if ((places == null || places.isEmpty()) && !noMoreResults) { fetchNearbyPlacesAndPresent(location); + } else { + lg.debug("Places: {}, no more results: {}", places, noMoreResults); } } diff --git a/app/src/main/java/pl/tpolgrabia/urbanexplorer/worker/GooglePlacesWorker.java b/app/src/main/java/pl/tpolgrabia/urbanexplorer/worker/GooglePlacesWorker.java index 9fbe2ef..780b909 100644 --- a/app/src/main/java/pl/tpolgrabia/urbanexplorer/worker/GooglePlacesWorker.java +++ b/app/src/main/java/pl/tpolgrabia/urbanexplorer/worker/GooglePlacesWorker.java @@ -3,31 +3,21 @@ package pl.tpolgrabia.urbanexplorer.worker; import android.content.Context; import android.location.Location; import android.os.AsyncTask; -import android.view.View; -import android.widget.ListView; +import android.widget.Toast; import org.apache.http.HttpStatus; import org.greenrobot.eventbus.EventBus; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import pl.tpolgrabia.googleutils.callback.PlacesCallback; -import pl.tpolgrabia.googleutils.dto.GooglePlacePhoto; import pl.tpolgrabia.googleutils.dto.GooglePlaceResponse; -import pl.tpolgrabia.googleutils.dto.GooglePlaceResult; import pl.tpolgrabia.googleutils.utils.PlacesUtils; import pl.tpolgrabia.urbanexplorer.AppConstants; -import pl.tpolgrabia.urbanexplorer.R; -import pl.tpolgrabia.urbanexplorer.adapters.PlacesAdapter; import pl.tpolgrabia.urbanexplorer.dto.GooglePlacesRequest; import pl.tpolgrabia.urbanexplorer.dto.GooglePlacesResponse; -import pl.tpolgrabia.urbanexplorer.fragments.PlacesFragment; import retrofit2.Response; import java.io.IOException; import java.util.ArrayList; -import java.util.HashSet; import java.util.List; -import java.util.Set; -import java.util.concurrent.Semaphore; /** * Created by tpolgrabia on 03.10.16. @@ -37,9 +27,11 @@ public class GooglePlacesWorker extends AsyncTask