Android Open Source - cirrus Icon






From Project

Back to project page cirrus.

License

The source code is released under:

Apache License

If you think the Android project cirrus 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.inktomi.cirrus.forecast;
//from  w  w  w.  j  ava2s  . com
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Provides a mapping in case clients want to use their own icons instead of the provided NDFD ones.
 *
 * Created by mruno on 8/13/13.
 */
public enum Icon {
    FOG("Fog", "^n?(fg)\\d*$", "http://forecasts.weather.gov/weather/images/fcicons/fg.jpg"),
    SCATTERED_FOG("Scattered Fog", "^n?(sctfg)\\d*$", "http://forecasts.weather.gov/weather/images/fcicons/sctfg.jpg"),
    BROKEN_FOG("Broken Fog", "^n?(bknfg)\\d*$", "http://forecasts.weather.gov/weather/images/fcicons/sctfg.jpg"),
    BLIZZARD("Blizzard", "^n?(blizzard)\\d*$", "http://forecasts.weather.gov/weather/images/fcicons/blizzard.jpg"),
    DUST("Dust", "^n?(du)\\d*$", "http://forecasts.weather.gov/weather/images/fcicons/du.jpg"),
    SMOKE("Smoke", "^n?(fu)\\d*$", "http://forecasts.weather.gov/weather/images/fcicons/fu.jpg"),
    ICE_PELLET("Ice Pellets", "^n?(ip)\\d*$", "http://forecasts.weather.gov/weather/images/fcicons/ip.jpg"),
    HAIL("Hail", "^n?(ip)\\d*$", "http://forecasts.weather.gov/weather/images/fcicons/ip.jpg"),
    SHOWER("Showers", "^n?(shwrs)\\d*$", "http://forecasts.weather.gov/weather/images/fcicons/hi_shwrs.jpg"),
    SHOWERING_RAIN("Showering Rain", "^n?(shra)\\d*$", "http://forecasts.weather.gov/weather/images/fcicons/shra.jpg"),
    RAIN("Rain", "^n?(ra)\\d*$", "http://graphical.weather.gov/xml/xml_fields_icon_weather_conditions.php"),
    SNOW("Snow", "^n?(sn)\\d*$", "http://forecasts.weather.gov/weather/images/fcicons/sn.jpg"),
    RAIN_AND_SNOW("Rain & Snow", "^n?(rasn)\\d*$", "http://graphical.weather.gov/xml/xml_fields_icon_weather_conditions.php"),
    FREEZING_RAIN("Freezing Rain", "^n?(fzra)\\d*$", "http://forecasts.weather.gov/weather/images/fcicons/fzra.jpg"),
    MIXED("Mixed", "^n?(mix)\\d*$", "http://forecasts.weather.gov/weather/images/fcicons/mix.jpg"),
    RAIN_AND_ICE_PELLETS("Rain & Ice Pellets", "^n?(raip)\\d*$", "http://forecasts.weather.gov/weather/images/fcicons/raip.jpg"),
    THUNDERSTORM("Thunderstorms", "^n?(tsra)\\d*$", "http://forecasts.weather.gov/weather/images/fcicons/tsra.jpg"),
    SCATTERED_THUNDERSTORM("Scattered Thunderstorms", "^n?(scttsra)\\d*$", "http://forecasts.weather.gov/weather/images/fcicons/scttsra.jpg"),
    CLEAR("Clear", "^n?(skc)\\d*$", "http://forecasts.weather.gov/weather/images/fcicons/skc.jpg"),
    FEW_CLOUDS("Few Clouds", "^n?(few)\\d*$", "http://forecasts.weather.gov/weather/images/fcicons/few.jpg"),
    SCATTERED_CLOUDS("Scattered Clouds", "^n?(sct)\\d*$", "http://forecasts.weather.gov/weather/images/fcicons/sct.jpg"),
    BROKEN_CLOUDS("Broken Clouds", "^n?(bkn)\\d*$", "http://forecasts.weather.gov/weather/images/fcicons/bkn.jpg"),
    OVERCAST("Overcast", "^n?(ovc)\\d*$", "http://forecasts.weather.gov/weather/images/fcicons/ovc.jpg"),
    HOT("Hot", "^n?(hot)\\d*$", "http://forecasts.weather.gov/weather/images/fcicons/hot.jpg"),
    COLD("Cold", "^n?(cold)\\d*$", "http://forecasts.weather.gov/weather/images/fcicons/cold.jpg"),
    WIND("Windy", "^n?(wind)\\d*$", "http://forecasts.weather.gov/weather/images/fcicons/wind.jpg");

    private final String weatherType;
    private final String weatherRegex;
    private final String iconUrl;

    Icon(String weatherType, String weatherRegex, String iconUrl) {
        this.weatherType = weatherType;
        this.weatherRegex = weatherRegex;
        this.iconUrl = iconUrl;
    }

    public String getWeatherType() {
        return weatherType;
    }

    public Pattern getWeatherRegex() {
        return Pattern.compile(weatherRegex);
    }

    public String getIconUrl() {
        return iconUrl;
    }

    public static Icon getByIconName(String iconName){
        for( Icon condition : Icon.values() ) {
            Matcher matcher = condition.getWeatherRegex().matcher(iconName);

            if( matcher.matches() ){
                return condition;
            }
        }

        return null;
    }
}




Java Source Code List

com.android.volley.AuthFailureError.java
com.android.volley.CacheDispatcher.java
com.android.volley.Cache.java
com.android.volley.DefaultRetryPolicy.java
com.android.volley.ExecutorDelivery.java
com.android.volley.NetworkDispatcher.java
com.android.volley.NetworkError.java
com.android.volley.NetworkResponse.java
com.android.volley.Network.java
com.android.volley.NoConnectionError.java
com.android.volley.ParseError.java
com.android.volley.RequestQueue.java
com.android.volley.Request.java
com.android.volley.ResponseDelivery.java
com.android.volley.Response.java
com.android.volley.RetryPolicy.java
com.android.volley.ServerError.java
com.android.volley.TimeoutError.java
com.android.volley.VolleyError.java
com.android.volley.VolleyLog.java
com.android.volley.toolbox.AndroidAuthenticator.java
com.android.volley.toolbox.Authenticator.java
com.android.volley.toolbox.BasicNetwork.java
com.android.volley.toolbox.ByteArrayPool.java
com.android.volley.toolbox.ClearCacheRequest.java
com.android.volley.toolbox.DiskBasedCache.java
com.android.volley.toolbox.HttpClientStack.java
com.android.volley.toolbox.HttpHeaderParser.java
com.android.volley.toolbox.HttpStack.java
com.android.volley.toolbox.HurlStack.java
com.android.volley.toolbox.ImageLoader.java
com.android.volley.toolbox.ImageRequest.java
com.android.volley.toolbox.JsonArrayRequest.java
com.android.volley.toolbox.JsonObjectRequest.java
com.android.volley.toolbox.JsonRequest.java
com.android.volley.toolbox.NetworkImageView.java
com.android.volley.toolbox.NoCache.java
com.android.volley.toolbox.PoolingByteArrayOutputStream.java
com.android.volley.toolbox.RequestFuture.java
com.android.volley.toolbox.StringRequest.java
com.android.volley.toolbox.Volley.java
com.inktomi.cirrus.BitmapLruCache.java
com.inktomi.cirrus.CirrusClient.java
com.inktomi.cirrus.DateTransform.java
com.inktomi.cirrus.EnumTransform.java
com.inktomi.cirrus.NDFDRequest.java
com.inktomi.cirrus.SampleActivity.java
com.inktomi.cirrus.URLStrings.java
com.inktomi.cirrus.WeatherUtils.java
com.inktomi.cirrus.forecast.Anomaly.java
com.inktomi.cirrus.forecast.Area.java
com.inktomi.cirrus.forecast.Categories.java
com.inktomi.cirrus.forecast.Category.java
com.inktomi.cirrus.forecast.Circle.java
com.inktomi.cirrus.forecast.City.java
com.inktomi.cirrus.forecast.ConciseName.java
com.inktomi.cirrus.forecast.CreationDate.java
com.inktomi.cirrus.forecast.DataSource.java
com.inktomi.cirrus.forecast.Data.java
com.inktomi.cirrus.forecast.Datum.java
com.inktomi.cirrus.forecast.DecimalVal.java
com.inktomi.cirrus.forecast.Error.java
com.inktomi.cirrus.forecast.Field.java
com.inktomi.cirrus.forecast.Head.java
com.inktomi.cirrus.forecast.HeightUnits.java
com.inktomi.cirrus.forecast.Height.java
com.inktomi.cirrus.forecast.Icon.java
com.inktomi.cirrus.forecast.Layer.java
com.inktomi.cirrus.forecast.Level.java
com.inktomi.cirrus.forecast.LikelihoodUnits.java
com.inktomi.cirrus.forecast.Location.java
com.inktomi.cirrus.forecast.MoreWeatherInformation.java
com.inktomi.cirrus.forecast.NwsZone.java
com.inktomi.cirrus.forecast.OperationalMode.java
com.inktomi.cirrus.forecast.Parameters.java
com.inktomi.cirrus.forecast.PercentageValue.java
com.inktomi.cirrus.forecast.Point.java
com.inktomi.cirrus.forecast.Probability.java
com.inktomi.cirrus.forecast.Product.java
com.inktomi.cirrus.forecast.ProductionCenter.java
com.inktomi.cirrus.forecast.Radius.java
com.inktomi.cirrus.forecast.Rectangle.java
com.inktomi.cirrus.forecast.Source.java
com.inktomi.cirrus.forecast.SrsName.java
com.inktomi.cirrus.forecast.StartValidTime.java
com.inktomi.cirrus.forecast.TemperatureValue.java
com.inktomi.cirrus.forecast.TimeCoordinate.java
com.inktomi.cirrus.forecast.TimeLayout.java
com.inktomi.cirrus.forecast.Uncertainty.java
com.inktomi.cirrus.forecast.ValueForRange.java
com.inktomi.cirrus.forecast.ValueList.java
com.inktomi.cirrus.forecast.WeatherResponse.java
com.inktomi.cirrus.forecast.WindDirectionValue.java
com.inktomi.cirrus.forecast.WindspeedValue.java