Back to project page WeatherBar.
The source code is released under:
MIT License
If you think the Android project WeatherBar listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.cjbarker.wb.ws; /* www . j a va 2 s.c o m*/ import com.cjbarker.wb.Util; public interface Weather { public enum Unit { Celcius, Farenheit; } public class Temperature { public double hi; public double low; public double current; public Unit unit; public String toString() { return "Current " + current + "\n" + "High " + hi + "\n" + "Low " + low; } } public class Location { public double latitude; public double longitude; public String city; public String state; public Location() {} public Location(double lat, double lon) { this.latitude = lat; this.longitude = lon; } public Location(String city, String state) { this.city = city; this.state = state; } public boolean isEmpty() { return ( (this.longitude == 0.0 && this.latitude == 0.0) && (Util.isEmpty(this.city) || Util.isEmpty(this.state)) ); } public String toString() { if (Util.isEmpty(city) || Util.isEmpty(state)) { return "Lat " + latitude + " Lon " + longitude; } else { return city + ", " + state; } } } public class Sun { public String rise; public String set; public int timeZone; public String toString() { return "Rise " + rise + "\n" + "Set " + set; } } public class Wind { public double speed; public double gust; public int degree; public String toString() { return "Winds at " + speed + " with Gusts up to " + gust; } } public class Forecast { public Location location; public Sun sun; public Temperature temperature; public Wind wind; public String cloudDescp; public int precipitation; public int humidity; public String toString() { return location.toString() + "\n" + sun.toString() + "\n" + temperature.toString() + "\n" + wind.toString() + "\n" + cloudDescp + "\n" + "Precp " + precipitation + "%\n" + "Humidity " + humidity + "%"; } } public Forecast getToday(Location loc); public Forecast getForecast(Location loc, long daytime); public String getApiUrl(); }