aboutsummaryrefslogtreecommitdiff
path: root/WordPress/src/main/java/org/wordpress/android/ui/notifications/blocks/NoteBlockRangeType.java
blob: 6018de45a3580c3d81bbfda9cd277427b78028e7 (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
package org.wordpress.android.ui.notifications.blocks;

import android.text.TextUtils;

/**
 * Known NoteBlock Range types
 */
public enum NoteBlockRangeType {
    POST,
    SITE,
    COMMENT,
    USER,
    STAT,
    BLOCKQUOTE,
    FOLLOW,
    NOTICON,
    LIKE,
    MATCH,
    UNKNOWN;

    public static NoteBlockRangeType fromString(String value) {
        if (TextUtils.isEmpty(value)) return UNKNOWN;

        switch (value) {
            case "post":
                return POST;
            case "site":
                return SITE;
            case "comment":
                return COMMENT;
            case "user":
                return USER;
            case "stat":
                return STAT;
            case "blockquote":
                return BLOCKQUOTE;
            case "follow":
                return FOLLOW;
            case "noticon":
                return NOTICON;
            case "like":
                return LIKE;
            case "match":
                return MATCH;
            default:
                return UNKNOWN;
        }
    }
}