Android Open Source - WeatherBar Weather






From Project

Back to project page WeatherBar.

License

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.

Java Source Code

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();
}




Java Source Code List

com.cjbarker.wb.Main.java
com.cjbarker.wb.Notifier.java
com.cjbarker.wb.Prefs.java
com.cjbarker.wb.Util.java
com.cjbarker.wb.receiver.BatteryLevel.java
com.cjbarker.wb.receiver.Connection.java
com.cjbarker.wb.receiver.Screen.java
com.cjbarker.wb.ws.ClientRequestTest.java
com.cjbarker.wb.ws.ClientRequest.java
com.cjbarker.wb.ws.ClientResponse.java
com.cjbarker.wb.ws.OpenWeatherTest.java
com.cjbarker.wb.ws.OpenWeather.java
com.cjbarker.wb.ws.WeatherTest.java
com.cjbarker.wb.ws.Weather.java