aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdnan Begovic <adnan@cyngn.com>2016-04-13 16:42:10 -0700
committerAdnan Begovic <adnan@cyngn.com>2016-04-13 16:47:40 -0700
commit6a921abb220881d71688767bda814e2e3e4a11ca (patch)
tree07a76e80cc433f163a4a166999771ebd5d8b2632
parentcb7c7f6c57ae9528390d13e17acbf3adb5731948 (diff)
downloadandroid_packages_apps_WundergroundWeatherProvider-6a921abb220881d71688767bda814e2e3e4a11ca.tar.gz
android_packages_apps_WundergroundWeatherProvider-6a921abb220881d71688767bda814e2e3e4a11ca.tar.bz2
android_packages_apps_WundergroundWeatherProvider-6a921abb220881d71688767bda814e2e3e4a11ca.zip
WundergroundCM: Update for weather api changes.
Change-Id: If9a2190755a46754f89527f9b320341f2e2ab941
-rw-r--r--app/build.gradle3
-rw-r--r--app/src/main/java/org/cyanogenmod/wundergroundcmweatherprovider/DebugActivity.java24
-rw-r--r--app/src/main/java/org/cyanogenmod/wundergroundcmweatherprovider/WundergroundWeatherProviderService.java6
-rw-r--r--app/src/main/java/org/cyanogenmod/wundergroundcmweatherprovider/wunderground/ConverterUtils.java5
4 files changed, 21 insertions, 17 deletions
diff --git a/app/build.gradle b/app/build.gradle
index 8de55e5..3669a47 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -24,10 +24,9 @@ android {
}
dependencies {
- compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.squareup.retrofit2:retrofit:2.0.1'
compile 'com.squareup.retrofit2:converter-gson:2.0.1'
- compile 'org.cyanogenmod:platform.sdk:5.0-20160408.205900-3'
+ compile 'org.cyanogenmod:platform.sdk:5.0-20160413.232559-9'
compile 'com.squareup.okhttp3:okhttp:3.2.0'
compile 'com.squareup.dagger:dagger-compiler:1.2.2'
compile 'com.squareup.okhttp3:logging-interceptor:3.0.1'
diff --git a/app/src/main/java/org/cyanogenmod/wundergroundcmweatherprovider/DebugActivity.java b/app/src/main/java/org/cyanogenmod/wundergroundcmweatherprovider/DebugActivity.java
index 88b28b8..5bc2dc9 100644
--- a/app/src/main/java/org/cyanogenmod/wundergroundcmweatherprovider/DebugActivity.java
+++ b/app/src/main/java/org/cyanogenmod/wundergroundcmweatherprovider/DebugActivity.java
@@ -45,6 +45,7 @@ import javax.inject.Inject;
import cyanogenmod.providers.WeatherContract;
import cyanogenmod.weather.CMWeatherManager;
+import cyanogenmod.weather.RequestInfo;
import cyanogenmod.weather.WeatherInfo;
import cyanogenmod.weather.WeatherLocation;
@@ -182,7 +183,7 @@ public class DebugActivity extends WUBaseActivity implements
private void requestWeatherInfoByWeatherLocation(int type) {
WeatherLocation weatherLocation = new WeatherLocation.Builder("Seattle", "Seattle")
.setPostalCode("98121")
- .setCountry("US", "US")
+ .setCountry("US")
.setState("WA")
.build();
@@ -290,18 +291,21 @@ public class DebugActivity extends WUBaseActivity implements
@Override
public void onWeatherRequestCompleted(int i, WeatherInfo weatherInfo) {
switch (i) {
- case CMWeatherManager.WEATHER_REQUEST_COMPLETED:
+ case CMWeatherManager.RequestStatus.COMPLETED:
Log.d(TAG, "Weather request completed: " + weatherInfo.toString());
break;
- case CMWeatherManager.WEATHER_REQUEST_FAILED:
+ case CMWeatherManager.RequestStatus.FAILED:
Log.d(TAG, "Weather request failed!");
break;
- case CMWeatherManager.WEATHER_REQUEST_ALREADY_IN_PROGRESS:
+ case CMWeatherManager.RequestStatus.ALREADY_IN_PROGRESS:
Log.d(TAG, "Weather request already in progress");
break;
- case CMWeatherManager.WEATHER_REQUEST_SUBMITTED_TOO_SOON:
+ case CMWeatherManager.RequestStatus.SUBMITTED_TOO_SOON:
Log.d(TAG, "Weather request submitted too soon");
break;
+ case CMWeatherManager.RequestStatus.NO_MATCH_FOUND:
+ Log.d(TAG, "Weather request match not found");
+ break;
}
}
@@ -413,10 +417,14 @@ public class DebugActivity extends WUBaseActivity implements
}
@Override
- public void onLookupCityRequestCompleted(ArrayList<WeatherLocation> arrayList) {
+ public void onLookupCityRequestCompleted(int state, List<WeatherLocation> arrayList) {
Log.d(TAG, "Received disambiguation:");
- for (WeatherLocation weatherLocation : arrayList) {
- Log.d(TAG, "Weather location: " + weatherLocation);
+ if (state == CMWeatherManager.RequestStatus.COMPLETED) {
+ for (WeatherLocation weatherLocation : arrayList) {
+ Log.d(TAG, "Weather location: " + weatherLocation);
+ }
+ } else {
+ Log.d(TAG, "Received state " + state);
}
}
}
diff --git a/app/src/main/java/org/cyanogenmod/wundergroundcmweatherprovider/WundergroundWeatherProviderService.java b/app/src/main/java/org/cyanogenmod/wundergroundcmweatherprovider/WundergroundWeatherProviderService.java
index 0c301bb..c09ff9d 100644
--- a/app/src/main/java/org/cyanogenmod/wundergroundcmweatherprovider/WundergroundWeatherProviderService.java
+++ b/app/src/main/java/org/cyanogenmod/wundergroundcmweatherprovider/WundergroundWeatherProviderService.java
@@ -268,8 +268,7 @@ public class WundergroundWeatherProviderService extends WeatherProviderService
weatherInfoBuilder.setForecast(dayForecasts);
ServiceRequestResult serviceRequestResult =
- new ServiceRequestResult.Builder()
- .setWeatherInfo(weatherInfoBuilder.build())
+ new ServiceRequestResult.Builder(weatherInfoBuilder.build())
.build();
serviceRequest.complete(serviceRequestResult);
}
@@ -284,8 +283,7 @@ public class WundergroundWeatherProviderService extends WeatherProviderService
cityDisambiguationResponses);
ServiceRequestResult serviceRequestResult =
- new ServiceRequestResult.Builder()
- .setLocationLookupList(weatherLocations)
+ new ServiceRequestResult.Builder(weatherLocations)
.build();
serviceRequest.complete(serviceRequestResult);
}
diff --git a/app/src/main/java/org/cyanogenmod/wundergroundcmweatherprovider/wunderground/ConverterUtils.java b/app/src/main/java/org/cyanogenmod/wundergroundcmweatherprovider/wunderground/ConverterUtils.java
index 3fd193a..cd20467 100644
--- a/app/src/main/java/org/cyanogenmod/wundergroundcmweatherprovider/wunderground/ConverterUtils.java
+++ b/app/src/main/java/org/cyanogenmod/wundergroundcmweatherprovider/wunderground/ConverterUtils.java
@@ -50,9 +50,8 @@ public class ConverterUtils {
ArrayList<WeatherLocation> weatherLocations = new ArrayList<>();
for (CityDisambiguationResponse cityDisambiguationResponse : cityDisambiguationResponses) {
WeatherLocation weatherLocation = new WeatherLocation.Builder(
- cityDisambiguationResponse.getCity(), cityDisambiguationResponse.getCity())
- .setCountry(cityDisambiguationResponse.getCountry(),
- cityDisambiguationResponse.getCountry())
+ cityDisambiguationResponse.getCity())
+ .setCountry(cityDisambiguationResponse.getCountry())
.build();
weatherLocations.add(weatherLocation);
}