aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/connector/gc/GCSmiliesProvider.java
blob: eba93014362c081a8ec154439187e5c2a5e7f1c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package cgeo.geocaching.connector.gc;


public class GCSmiliesProvider {
    public enum Smiley {
        SMILE(":)"),
        BIG_SMILE(":D"),
        COOL("8D"),
        BLUSH(":I"),
        TONGUE(":P"),
        EVIL("}:)"),
        WINK(";)"),
        CLOWN(":o)"),
        BLACK_EYE("B)"),
        EIGHTBALL("8"),
        FROWN(":("),
        SHY("8)"),
        SHOCKED(":O"),
        ANGRY(":(!"),
        DEAD("xx("),
        SLEEPY("|)"),
        KISSES(":X"),
        APPROVE("^"),
        DISAPPROVE("V"),
        QUESTION("?");

        public final String text;

        Smiley(final String text) {
            this.text = text;
        }

        public int getItemId() {
            return text.hashCode();
        }
    }

    public static Smiley[] getSmilies() {
        return Smiley.values();
    }

    public static Smiley getSmiley(int itemId) {
        for (Smiley smiley : getSmilies()) {
            if (smiley.getItemId() == itemId) {
                return smiley;
            }
        }
        return null;
    }
}