diff options
author | Roman Birg <roman@cyngn.com> | 2016-04-12 14:16:10 -0700 |
---|---|---|
committer | Roman Birg <roman@cyngn.com> | 2016-04-12 14:16:10 -0700 |
commit | cb7c7f6c57ae9528390d13e17acbf3adb5731948 (patch) | |
tree | 9b08507a837f4aaf8d3c9bd58b7e730e6191cef1 | |
parent | e76e0c90983ecc8658193d6dd49bfddfb7793de2 (diff) | |
download | android_packages_apps_WundergroundWeatherProvider-cb7c7f6c57ae9528390d13e17acbf3adb5731948.tar.gz android_packages_apps_WundergroundWeatherProvider-cb7c7f6c57ae9528390d13e17acbf3adb5731948.tar.bz2 android_packages_apps_WundergroundWeatherProvider-cb7c7f6c57ae9528390d13e17acbf3adb5731948.zip |
Wunderground: fix city disambiguation req
It was wrapped in another results array.
Ticket: CYNGNOS-2419
Change-Id: Iae0ab2d71ab937216242dc0f41a19fce6aea473e
Signed-off-by: Roman Birg <roman@cyngn.com>
-rw-r--r-- | app/src/main/java/org/cyanogenmod/wundergroundcmweatherprovider/wunderground/responses/WundergroundReponse.java | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/app/src/main/java/org/cyanogenmod/wundergroundcmweatherprovider/wunderground/responses/WundergroundReponse.java b/app/src/main/java/org/cyanogenmod/wundergroundcmweatherprovider/wunderground/responses/WundergroundReponse.java index 79f49bd..62fd68b 100644 --- a/app/src/main/java/org/cyanogenmod/wundergroundcmweatherprovider/wunderground/responses/WundergroundReponse.java +++ b/app/src/main/java/org/cyanogenmod/wundergroundcmweatherprovider/wunderground/responses/WundergroundReponse.java @@ -21,7 +21,7 @@ import com.google.gson.annotations.SerializedName; import org.cyanogenmod.wundergroundcmweatherprovider.wunderground.responses.citylookup.CityDisambiguationResponse; import java.io.Serializable; -import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import cyanogenmod.weatherservice.ServiceRequest; @@ -33,8 +33,8 @@ public class WundergroundReponse implements Serializable { @SerializedName("forecast") private ForecastResponse forecastResponse; - @SerializedName("results") - private List<CityDisambiguationResponse> cityDisambiguationResponseList = new ArrayList<>(); + @SerializedName("response") + private CityDisambiguationResponseInner disambiguationResponse; private ServiceRequest serviceRequest; @@ -60,22 +60,37 @@ public class WundergroundReponse implements Serializable { } public List<CityDisambiguationResponse> getCityDisambiguation() { - return cityDisambiguationResponseList; + return disambiguationResponse != null + ? disambiguationResponse.cityDisambiguationResponseList : null; } public void setCityDisambiguationResponseList( List<CityDisambiguationResponse> cityDisambiguationResponseList) { - this.cityDisambiguationResponseList = cityDisambiguationResponseList; + if (disambiguationResponse != null) { + disambiguationResponse.cityDisambiguationResponseList = cityDisambiguationResponseList; + } } public ServiceRequest getServiceRequest() { return serviceRequest; } + public class CityDisambiguationResponseInner { + @SerializedName("results") + private List<CityDisambiguationResponse> cityDisambiguationResponseList; + + @Override + public String toString() { + return "CityDisambiguationResponseInner [" + (cityDisambiguationResponseList != null + ? Arrays.toString(cityDisambiguationResponseList.toArray()) : "") + " ]"; + } + } + @Override public String toString() { return "WundergroundResponse:\n" - + "Forecast: " + forecastResponse.toString() + "\n" - + "Current Observation: " + currentObservationResponse.toString(); + + "CityDisambiguationResponse: " + disambiguationResponse + "\n" + + "Forecast: " + forecastResponse + "\n" + + "Current Observation: " + currentObservationResponse; } } |