From 18838318e646e9d49404e4843b981ecbc46c6abd Mon Sep 17 00:00:00 2001 From: Adnan Begovic Date: Thu, 5 May 2016 18:33:06 -0700 Subject: YahooCM: Fix location response and add new iconography. --- .../yahooweatherprovider/ConverterUtils.java | 49 +++++++++++++++- .../yahoo/response/Admin1.java | 64 +++++++++++++++++++++ .../yahoo/response/Admin2.java | 64 +++++++++++++++++++++ .../yahoo/response/Locality1.java | 54 +++++++++++++++++ .../yahooweatherprovider/yahoo/response/Place.java | 40 ++++++++++++- .../yahoo/response/Postal.java | 54 +++++++++++++++++ app/src/main/res/mipmap-hdpi/ic_launcher.png | Bin 3418 -> 2545 bytes app/src/main/res/mipmap-mdpi/ic_launcher.png | Bin 2206 -> 1705 bytes app/src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 4842 -> 3504 bytes app/src/main/res/mipmap-xxhdpi/ic_launcher.png | Bin 7718 -> 5537 bytes app/src/main/res/mipmap-xxxhdpi/ic_launcher.png | Bin 10486 -> 7843 bytes 11 files changed, 319 insertions(+), 6 deletions(-) create mode 100644 app/src/main/java/org/cyanogenmod/yahooweatherprovider/yahoo/response/Admin1.java create mode 100644 app/src/main/java/org/cyanogenmod/yahooweatherprovider/yahoo/response/Admin2.java create mode 100644 app/src/main/java/org/cyanogenmod/yahooweatherprovider/yahoo/response/Locality1.java create mode 100644 app/src/main/java/org/cyanogenmod/yahooweatherprovider/yahoo/response/Postal.java mode change 100644 => 100755 app/src/main/res/mipmap-hdpi/ic_launcher.png mode change 100644 => 100755 app/src/main/res/mipmap-mdpi/ic_launcher.png mode change 100644 => 100755 app/src/main/res/mipmap-xhdpi/ic_launcher.png mode change 100644 => 100755 app/src/main/res/mipmap-xxhdpi/ic_launcher.png mode change 100644 => 100755 app/src/main/res/mipmap-xxxhdpi/ic_launcher.png 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 convertPlacesToWeatherLocations(List places) { List 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 + *

+ * 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 + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * 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 + *

+ * 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 + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * 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 + *

+ * 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 + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * 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 + *

+ * 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 + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * 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 old mode 100644 new mode 100755 index cde69bc..48f6fcc Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png old mode 100644 new mode 100755 index c133a0c..a6f0b2b Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png old mode 100644 new mode 100755 index bfa42f0..077efae Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png old mode 100644 new mode 100755 index 324e72c..af77731 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png old mode 100644 new mode 100755 index aee44e1..3d23400 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ -- cgit v1.2.3