Created
November 25, 2016 14:11
-
-
Save SpiritOfDarkDragon/71b9261e50fc0a28e2bd191796f63066 to your computer and use it in GitHub Desktop.
ENUM
This file contains hidden or 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
public enum IconMapMarker { | |
PARK(R.mipmap.ic_map_park, R.mipmap.ic_map_park_p, 1), | |
WC(R.mipmap.ic_map_wc, R.mipmap.ic_map_wc_p, 2), | |
INFO(R.mipmap.ic_map_info, R.mipmap.ic_map_info_p, 3), | |
PARKING(R.mipmap.ic_map_parking, R.mipmap.ic_map_parking_p, 4), | |
FERRIS_WHEEL(R.mipmap.ic_map_ferris_wheel, R.mipmap.ic_map_ferris_wheel_p, 5), | |
RINK(R.mipmap.ic_map_rink, R.mipmap.ic_map_rink_p, 6), | |
FOOTBALL(R.mipmap.ic_map_football, R.mipmap.ic_map_football_p, 7), | |
FOOD(R.mipmap.ic_map_food, R.mipmap.ic_map_food_p, 8), | |
PLAYGROUND(R.mipmap.ic_map_playground, R.mipmap.ic_map_playground_p, 9), | |
BIKE(R.mipmap.ic_map_bike, R.mipmap.ic_map_bike_p, 10), | |
FOUNTAIN(R.mipmap.ic_map_fountain, R.mipmap.ic_map_fountain_p, 11), | |
STORE(R.mipmap.ic_map_store, R.mipmap.ic_map_store_p, 12), | |
EXIT(R.mipmap.ic_map_exit, R.mipmap.ic_map_exit_p, 13), | |
MUSIC(R.mipmap.ic_map_music, R.mipmap.ic_map_music_p, 14), | |
BOOK(R.mipmap.ic_map_book, R.mipmap.ic_map_book_p, 15), | |
ARBOR(R.mipmap.ic_map_arbor, R.mipmap.ic_map_arbor_p, 16), | |
TRIUMPHAL_ARCH(R.mipmap.ic_map_triumphal_arch, R.mipmap.ic_map_triumphal_arch_p, 17), | |
WTF(R.mipmap.ic_map_wtf, R.mipmap.ic_map_wtf_p, 18), | |
TREE(R.mipmap.ic_map_tree, R.mipmap.ic_map_tree_p, 19), | |
SNOWFLAKE(R.mipmap.ic_map_snowflake, R.mipmap.ic_map_snowflake_p, 20); | |
private int unselectedId; | |
private int selectedId; | |
private Integer jsonValue; | |
IconMapMarker(int unselectedId, int selectedId, int jsonValue) { | |
this.unselectedId = unselectedId; | |
this.selectedId = selectedId; | |
this.jsonValue = jsonValue; | |
} | |
public int getUnselectedId() { | |
return unselectedId; | |
} | |
public int getSelectedId() { | |
return selectedId; | |
} | |
public static IconMapMarker fromJson(Integer value) { | |
for (IconMapMarker mapMarker : values()) { | |
if (mapMarker.jsonValue.equals(value)) { | |
return mapMarker; | |
} | |
} | |
return PARK; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment