Created
June 19, 2014 06:18
-
-
Save AKiniyalocts/20a16814248225149525 to your computer and use it in GitHub Desktop.
Converter for forecast io icons to meteoicons
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Created by anthony on 6/19/14. | |
* | |
* Instansiate this class with a string (The icon name you want to convert) then call getIconTextCode() | |
* on that instantiation to return the appropriate character for that forecast IO icon, utilized in the ttf font file. | |
* | |
* Icons: http://www.alessioatzeni.com/meteocons/ | |
* Forecast IO lib: https://github.com/dvdme/forecastio-lib-java | |
* | |
* This was made assumming you are using the meteo .ttf and not the actual icons. | |
* | |
* It's obviously very simple, just thought I would create a gist to save other people time from having to create it | |
* as well :) | |
* | |
*/ | |
public class MeteoIconParser { | |
private String mIconName; | |
public IconParser(String iconName){ | |
mIconName = iconName; | |
} | |
public String getIconTextCode(){ | |
if (mIconName.equals("\"clear-day\"")) | |
return "B"; | |
else if(mIconName.equals("\"clear-night\"")) | |
return "2"; | |
else if(mIconName.equals("\"rain\"")) | |
return "R"; | |
else if(mIconName.equals("\"snow\"")) | |
return "W"; | |
else if(mIconName.equals("\"sleet\"")) | |
return "X"; | |
else if(mIconName.equals("\"wind\"")) | |
return "S"; | |
else if(mIconName.equals("\"fog\"")) | |
return "L"; | |
else if(mIconName.equals("\"cloudy\"")) | |
return "N"; | |
else if(mIconName.equals("\"partly-cloudy-day\"")) | |
return "H"; | |
else if(mIconName.equals("\"partly-cloudy-night\"")) | |
return "4"; | |
else | |
//default icon | |
return "H"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If Forecast IO adds additional icons, I will do my best to keep this updated.