summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdnan Begovic <adnan@cyngn.com>2016-05-06 01:33:06 (GMT)
committerAdnan Begovic <adnan@cyngn.com>2016-05-06 01:33:06 (GMT)
commit18838318e646e9d49404e4843b981ecbc46c6abd (patch)
treed3443618cd0a1365620698eb6903a4d153fa4636
parent067b133a078cc33f4596380e745c8d6c43bbca5c (diff)
downloadandroid_packages_apps_YahooWeatherProvider-18838318e646e9d49404e4843b981ecbc46c6abd.zip
android_packages_apps_YahooWeatherProvider-18838318e646e9d49404e4843b981ecbc46c6abd.tar.gz
android_packages_apps_YahooWeatherProvider-18838318e646e9d49404e4843b981ecbc46c6abd.tar.bz2
YahooCM: Fix location response and add new iconography.
-rw-r--r--app/src/main/java/org/cyanogenmod/yahooweatherprovider/ConverterUtils.java49
-rw-r--r--app/src/main/java/org/cyanogenmod/yahooweatherprovider/yahoo/response/Admin1.java64
-rw-r--r--app/src/main/java/org/cyanogenmod/yahooweatherprovider/yahoo/response/Admin2.java64
-rw-r--r--app/src/main/java/org/cyanogenmod/yahooweatherprovider/yahoo/response/Locality1.java54
-rw-r--r--app/src/main/java/org/cyanogenmod/yahooweatherprovider/yahoo/response/Place.java40
-rw-r--r--app/src/main/java/org/cyanogenmod/yahooweatherprovider/yahoo/response/Postal.java54
-rwxr-xr-x[-rw-r--r--]app/src/main/res/mipmap-hdpi/ic_launcher.pngbin3418 -> 2545 bytes
-rwxr-xr-x[-rw-r--r--]app/src/main/res/mipmap-mdpi/ic_launcher.pngbin2206 -> 1705 bytes
-rwxr-xr-x[-rw-r--r--]app/src/main/res/mipmap-xhdpi/ic_launcher.pngbin4842 -> 3504 bytes
-rwxr-xr-x[-rw-r--r--]app/src/main/res/mipmap-xxhdpi/ic_launcher.pngbin7718 -> 5537 bytes
-rwxr-xr-x[-rw-r--r--]app/src/main/res/mipmap-xxxhdpi/ic_launcher.pngbin10486 -> 7843 bytes
11 files changed, 319 insertions, 6 deletions
diff --git a/app/src/main/java/org/cyanogenmod/yahooweatherprovider/ConverterUtils.java b/app/src/main/java/org/cyanogenmod/yahooweatherprovider/ConverterUtils.java
index 28d61c0..6a81b4e 100644
--- a/app/src/main/java/org/cyanogenmod/yahooweatherprovider/ConverterUtils.java
+++ b/app/src/main/java/org/cyanogenmod/yahooweatherprovider/ConverterUtils.java
@@ -16,9 +16,13 @@
package org.cyanogenmod.yahooweatherprovider;
+import org.cyanogenmod.yahooweatherprovider.yahoo.response.Admin1;
+import org.cyanogenmod.yahooweatherprovider.yahoo.response.Admin2;
import org.cyanogenmod.yahooweatherprovider.yahoo.response.Admin3;
import org.cyanogenmod.yahooweatherprovider.yahoo.response.Forecast;
+import org.cyanogenmod.yahooweatherprovider.yahoo.response.Locality1;
import org.cyanogenmod.yahooweatherprovider.yahoo.response.Place;
+import org.cyanogenmod.yahooweatherprovider.yahoo.response.Postal;
import java.util.ArrayList;
import java.util.List;
@@ -44,10 +48,49 @@ public class ConverterUtils {
public static List<WeatherLocation> convertPlacesToWeatherLocations(List<Place> places) {
List<WeatherLocation> ret = new ArrayList<>();
for (Place place : places) {
- Admin3 admin3 = place.getAdmin();
+ Postal postal = place.getPostal();
+ Admin1 admin1 = place.getAdmin1();
+ if (admin1 != null && admin1.getContent() != null) {
+ WeatherLocation weatherLocation = new WeatherLocation.Builder(admin1.getWoeid(),
+ admin1.getContent())
+ .setCountry(place.getCountry().getContent())
+ .setCountryId(place.getCountry().getCode())
+ .setPostalCode(postal == null ? "" : postal.getContent())
+ .build();
+ ret.add(weatherLocation);
+ }
+
+ Admin2 admin2 = place.getAdmin2();
+ if (admin2 != null && admin2.getContent() != null) {
+ WeatherLocation weatherLocation = new WeatherLocation.Builder(admin2.getWoeid(),
+ admin2.getContent())
+ .setCountry(place.getCountry().getContent())
+ .setCountryId(place.getCountry().getCode())
+ .setPostalCode(postal == null ? "" : postal.getContent())
+ .build();
+ ret.add(weatherLocation);
+ }
+
+ Admin3 admin3 = place.getAdmin3();
if (admin3 != null && admin3.getContent() != null) {
- WeatherLocation weatherLocation = new WeatherLocation.Builder(place.getWoeid(),
- admin3.getContent()).build();
+ WeatherLocation weatherLocation = new WeatherLocation.Builder(admin3.getWoeid(),
+ admin3.getContent())
+ .setCountry(place.getCountry().getContent())
+ .setCountryId(place.getCountry().getCode())
+ .setPostalCode(postal == null ? "" : postal.getContent())
+ .build();
+ ret.add(weatherLocation);
+ }
+
+ Locality1 locality1 = place.getLocality1();
+ if (locality1 != null && locality1.getContent() != null) {
+ WeatherLocation weatherLocation = new WeatherLocation.Builder(
+ locality1.getWoeid(),
+ locality1.getContent())
+ .setCountry(place.getCountry().getContent())
+ .setCountryId(place.getCountry().getCode())
+ .setPostalCode(postal == null ? "" : postal.getContent())
+ .build();
ret.add(weatherLocation);
}
}
diff --git a/app/src/main/java/org/cyanogenmod/yahooweatherprovider/yahoo/response/Admin1.java b/app/src/main/java/org/cyanogenmod/yahooweatherprovider/yahoo/response/Admin1.java
new file mode 100644
index 0000000..67ba44d
--- /dev/null
+++ b/app/src/main/java/org/cyanogenmod/yahooweatherprovider/yahoo/response/Admin1.java
@@ -0,0 +1,64 @@
+/**
+ * Copyright (C) 2016 The CyanogenMod Project
+ * <p/>
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.cyanogenmod.yahooweatherprovider.yahoo.response;
+
+public class Admin1 {
+ private String content;
+
+ private String woeid;
+
+ private String code;
+
+ private String type;
+
+ public String getContent() {
+ return content;
+ }
+
+ public void setContent(String content) {
+ this.content = content;
+ }
+
+ public String getWoeid() {
+ return woeid;
+ }
+
+ public void setWoeid(String woeid) {
+ this.woeid = woeid;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public void setCode(String code) {
+ this.code = code;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ @Override
+ public String toString() {
+ return "[content = " + content + ", woeid = " + woeid + ", code = " + code + ", type = " + type + "]";
+ }
+} \ No newline at end of file
diff --git a/app/src/main/java/org/cyanogenmod/yahooweatherprovider/yahoo/response/Admin2.java b/app/src/main/java/org/cyanogenmod/yahooweatherprovider/yahoo/response/Admin2.java
new file mode 100644
index 0000000..436073a
--- /dev/null
+++ b/app/src/main/java/org/cyanogenmod/yahooweatherprovider/yahoo/response/Admin2.java
@@ -0,0 +1,64 @@
+/**
+ * Copyright (C) 2016 The CyanogenMod Project
+ * <p/>
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.cyanogenmod.yahooweatherprovider.yahoo.response;
+
+public class Admin2 {
+ private String content;
+
+ private String woeid;
+
+ private String code;
+
+ private String type;
+
+ public String getContent() {
+ return content;
+ }
+
+ public void setContent(String content) {
+ this.content = content;
+ }
+
+ public String getWoeid() {
+ return woeid;
+ }
+
+ public void setWoeid(String woeid) {
+ this.woeid = woeid;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public void setCode(String code) {
+ this.code = code;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ @Override
+ public String toString() {
+ return "[content = " + content + ", woeid = " + woeid + ", code = " + code + ", type = " + type + "]";
+ }
+}
diff --git a/app/src/main/java/org/cyanogenmod/yahooweatherprovider/yahoo/response/Locality1.java b/app/src/main/java/org/cyanogenmod/yahooweatherprovider/yahoo/response/Locality1.java
new file mode 100644
index 0000000..901090b
--- /dev/null
+++ b/app/src/main/java/org/cyanogenmod/yahooweatherprovider/yahoo/response/Locality1.java
@@ -0,0 +1,54 @@
+/**
+ * Copyright (C) 2016 The CyanogenMod Project
+ * <p/>
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.cyanogenmod.yahooweatherprovider.yahoo.response;
+
+public class Locality1 {
+ private String content;
+
+ private String woeid;
+
+ private String type;
+
+ public String getContent() {
+ return content;
+ }
+
+ public void setContent(String content) {
+ this.content = content;
+ }
+
+ public String getWoeid() {
+ return woeid;
+ }
+
+ public void setWoeid(String woeid) {
+ this.woeid = woeid;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ @Override
+ public String toString() {
+ return "[content = " + content + ", woeid = " + woeid + ", type = " + type + "]";
+ }
+} \ No newline at end of file
diff --git a/app/src/main/java/org/cyanogenmod/yahooweatherprovider/yahoo/response/Place.java b/app/src/main/java/org/cyanogenmod/yahooweatherprovider/yahoo/response/Place.java
index 5c784dc..03c9011 100644
--- a/app/src/main/java/org/cyanogenmod/yahooweatherprovider/yahoo/response/Place.java
+++ b/app/src/main/java/org/cyanogenmod/yahooweatherprovider/yahoo/response/Place.java
@@ -21,7 +21,13 @@ public class Place {
private Country country;
- private Admin3 admin1;
+ private Admin1 admin1;
+ private Admin2 admin2;
+ private Admin3 admin3;
+
+ private Postal postal;
+
+ private Locality1 locality1;
public String getWoeid() {
return woeid;
@@ -39,14 +45,42 @@ public class Place {
this.country = country;
}
- public Admin3 getAdmin () {
+ public Admin1 getAdmin1() {
return admin1;
}
- public void setAdmin (Admin3 admin1) {
+ public void setAdmin1(Admin1 admin1) {
this.admin1 = admin1;
}
+ public Admin2 getAdmin2() {
+ return admin2;
+ }
+
+ public void setAdmin2(Admin2 admin2) {
+ this.admin2 = admin2;
+ }
+
+ public Admin3 getAdmin3() {
+ return admin3;
+ }
+
+ public void setAdmin3(Admin3 admin3) {
+ this.admin3 = admin3;
+ }
+
+ public Postal getPostal() {
+ return postal;
+ }
+
+ public void setPostal(Postal postal) {
+ this.postal = postal;
+ }
+
+ public Locality1 getLocality1() {
+ return locality1;
+ }
+
@Override
public String toString() {
return "[woeid = " + woeid + ", country = " + country + "]";
diff --git a/app/src/main/java/org/cyanogenmod/yahooweatherprovider/yahoo/response/Postal.java b/app/src/main/java/org/cyanogenmod/yahooweatherprovider/yahoo/response/Postal.java
new file mode 100644
index 0000000..d3e1db1
--- /dev/null
+++ b/app/src/main/java/org/cyanogenmod/yahooweatherprovider/yahoo/response/Postal.java
@@ -0,0 +1,54 @@
+/**
+ * Copyright (C) 2016 The CyanogenMod Project
+ * <p/>
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.cyanogenmod.yahooweatherprovider.yahoo.response;
+
+public class Postal {
+ private String content;
+
+ private String woeid;
+
+ private String type;
+
+ public String getContent() {
+ return content;
+ }
+
+ public void setContent(String content) {
+ this.content = content;
+ }
+
+ public String getWoeid() {
+ return woeid;
+ }
+
+ public void setWoeid(String woeid) {
+ this.woeid = woeid;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ @Override
+ public String toString() {
+ return "ClassPojo [content = " + content + ", woeid = " + woeid + ", type = " + type + "]";
+ }
+} \ No newline at end of file
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png
index cde69bc..48f6fcc 100644..100755
--- a/app/src/main/res/mipmap-hdpi/ic_launcher.png
+++ b/app/src/main/res/mipmap-hdpi/ic_launcher.png
Binary files differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png
index c133a0c..a6f0b2b 100644..100755
--- a/app/src/main/res/mipmap-mdpi/ic_launcher.png
+++ b/app/src/main/res/mipmap-mdpi/ic_launcher.png
Binary files differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png
index bfa42f0..077efae 100644..100755
--- a/app/src/main/res/mipmap-xhdpi/ic_launcher.png
+++ b/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Binary files differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
index 324e72c..af77731 100644..100755
--- a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
+++ b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
index aee44e1..3d23400 100644..100755
--- a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
+++ b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Binary files differ