Android Open Source - sunshine Day Forecast






From Project

Back to project page sunshine.

License

The source code is released under:

Apache License

If you think the Android project sunshine 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.zmb.sunshine.data;
//from  ww  w  .  j a v  a2s .co m
import java.util.Date;

/**
 * An object to represent a single day in the weekly forecast.
 * All units are metric.
 */
public class DayForecast {

    private final double mHighTemperature;
    private final double mLowTemperature;
    private final DayOfWeek mDay;
    private final String mDescription;
    private final Date mDate;

    // TODO: add humidity, pressure, wind speed, wind direction

    public DayForecast(double high, double low, DayOfWeek day, String desc, Date date) {
        mHighTemperature = high;
        mLowTemperature = low;
        mDay = day;
        mDescription = desc;
        mDate = date;
    }

    /**
     * Get the high temperature for the day. (degrees Celsius)
     * @return
     */
    public double getHighTemperature() {
        return mHighTemperature;
    }

    /**
     * Get the low temperature for the day. (degrees Celsius)
     * @return
     */
    public double getLowTemperature() {
        return mLowTemperature;
    }

    public DayOfWeek getDay() {
        return mDay;
    }

    public Date getDate() {
        return mDate;
    }

    public String getDescription() {
        return mDescription;
    }

    @Override
    public String toString() {
        return toStringImperial();
    }

    public String toStringMetric() {
        return mDay.toString() + " - " + mDescription + " - " +
                (int)mHighTemperature + " / " + (int)mLowTemperature;
    }

    public String toStringImperial() {
        return mDay.toString() + " - " + mDescription + " - " +
                (int)Convert.toFahrenheit(mHighTemperature) + " / " +
                (int)Convert.toFahrenheit(mLowTemperature);
    }
}




Java Source Code List

com.zmb.sunshine.ApplicationTest.java
com.zmb.sunshine.DetailActivity.java
com.zmb.sunshine.DetailFragment.java
com.zmb.sunshine.ForecastAdapter.java
com.zmb.sunshine.ForecastFragment.java
com.zmb.sunshine.MainActivity.java
com.zmb.sunshine.SettingsActivity.java
com.zmb.sunshine.SettingsFragment.java
com.zmb.sunshine.Sunshine.java
com.zmb.sunshine.data.AWeatherDataParser.java
com.zmb.sunshine.data.Convert.java
com.zmb.sunshine.data.DayForecast.java
com.zmb.sunshine.data.DayOfWeek.java
com.zmb.sunshine.data.IWeatherDataParser.java
com.zmb.sunshine.data.WeatherParseException.java
com.zmb.sunshine.data.WeatherProvider.java
com.zmb.sunshine.data.db.AndroidDatabaseManager.java
com.zmb.sunshine.data.db.WeatherContract.java
com.zmb.sunshine.data.db.WeatherDbHelper.java
com.zmb.sunshine.data.openweathermap.OpenWeatherMapParser.java
com.zmb.sunshine.data.worldweatheronline.WorldWeatherOnlineParser.java
com.zmb.sunshine.sync.DummyAuthenticatorService.java
com.zmb.sunshine.sync.DummyAuthenticator.java
com.zmb.sunshine.sync.SunshineSyncAdapter.java
com.zmb.sunshine.sync.SunshineSyncService.java
com.zmb.sunshine.widget.SunshineWidget.java
com.zmb.utils.IoUtils.java