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

import android.text.TextUtils;

/** BlockTypes that we know about
 * Unknown blocks will still be displayed using the rules for BASIC blocks
 */
public enum BlockType {
    UNKNOWN,
    BASIC,
    USER,
    USER_HEADER,
    USER_COMMENT,
    FOOTER;

    public static BlockType fromString(String blockType) {
        if (TextUtils.isEmpty(blockType)) return UNKNOWN;

        switch (blockType) {
            case "basic":
                return BASIC;
            case "user":
                return USER;
            case "user_header":
                return USER_HEADER;
            case "user_comment":
                return USER_COMMENT;
            case "footer":
                return FOOTER;
            default:
                return UNKNOWN;
        }
    }
}