2 * Copyright 2014 Gustavo Martin Morcuende
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package name.gumartinm.weather.information.service;
18 import name.gumartinm.weather.information.R;
20 import java.util.HashMap;
23 public enum IconsList {
26 public int getResourceDrawable() {
27 return R.drawable.weather_clear;
30 // TODO: I am sometimes receiving this code, there is no documentation about it on the
31 // openweathermap site.... But it exists!!! Some day, try to find out more information about it.
32 // see: http://openweathermap.org/img/w/01dd.png
35 public int getResourceDrawable() {
36 return R.drawable.weather_clear;
41 public int getResourceDrawable() {
42 return R.drawable.weather_clear_night;
47 public int getResourceDrawable() {
48 return R.drawable.weather_few_clouds;
53 public int getResourceDrawable() {
54 return R.drawable.weather_few_clouds_night;
59 public int getResourceDrawable() {
60 return R.drawable.weather_few_clouds;
65 public int getResourceDrawable() {
66 return R.drawable.weather_few_clouds;
71 public int getResourceDrawable() {
72 return R.drawable.weather_overcast;
77 public int getResourceDrawable() {
78 return R.drawable.weather_overcast;
83 public int getResourceDrawable() {
84 return R.drawable.weather_showers;
89 public int getResourceDrawable() {
90 return R.drawable.weather_showers;
95 public int getResourceDrawable() {
96 return R.drawable.weather_showers_scattered;
101 public int getResourceDrawable() {
102 return R.drawable.weather_showers_scattered;
107 public int getResourceDrawable() {
108 return R.drawable.weather_storm;
113 public int getResourceDrawable() {
114 return R.drawable.weather_storm;
119 public int getResourceDrawable() {
120 return R.drawable.weather_snow;
125 public int getResourceDrawable() {
126 return R.drawable.weather_snow;
131 public int getResourceDrawable() {
132 return R.drawable.weather_fog;
137 public int getResourceDrawable() {
138 return R.drawable.weather_fog;
142 private final String icon;
143 // Map with every enum constant. Class variable initializer. JLS§12.4.2
144 // Executed in textual order.
145 private static final Map<String, IconsList> codeMap = new HashMap<String, IconsList>();
147 // Static initializer. JLS§12.4.2 Executed in textual order.
149 for (final IconsList code : IconsList.values()) {
150 codeMap.put(code.getIcon(), code);
154 private IconsList(final String icon) {
158 public static final IconsList getIcon(final String icon) {
159 return codeMap.get(icon);
162 private String getIcon() {
166 public abstract int getResourceDrawable();