urbanairship-core/src/main/java/com/urbanairship/iam/html/HtmlDisplayContent.java
@NonNull
    public static HtmlDisplayContent parseJson(JsonValue json) throws JsonException {
        JsonMap content = json.optMap();

        Builder builder = newBuilder();

        // Dismiss button color
        if (content.containsKey(DISMISS_BUTTON_COLOR_KEY)) {
            try {
                builder.setDismissButtonColor(Color.parseColor(content.opt(DISMISS_BUTTON_COLOR_KEY).getString("")));
            } catch (IllegalArgumentException e) {
                throw new JsonException("Invalid dismiss button color: " + content.opt(DISMISS_BUTTON_COLOR_KEY), e);
            }
        }

        // URL
        if (content.containsKey(URL_KEY)) {
            builder.setUrl(content.opt(URL_KEY).getString());
        }

        // Background color
        if (content.containsKey(BACKGROUND_COLOR_KEY)) {
            try {
                builder.setBackgroundColor(Color.parseColor(content.opt(BACKGROUND_COLOR_KEY).getString("")));
            } catch (IllegalArgumentException e) {
                throw new JsonException("Invalid background color: " + content.opt(BACKGROUND_COLOR_KEY), e);
            }
        }

        // Border radius
        if (content.containsKey(BORDER_RADIUS_KEY)) {
            if (!content.opt(BORDER_RADIUS_KEY).isNumber()) {
                throw new JsonException("Border radius must be a number " + content.opt(BORDER_RADIUS_KEY));
            }

            builder.setBorderRadius(content.opt(BORDER_RADIUS_KEY).getNumber().floatValue());
        }

        // Allow Fullscreen display
        if (content.containsKey(ALLOW_FULLSCREEN_DISPLAY_KEY)) {
            if (!content.opt(ALLOW_FULLSCREEN_DISPLAY_KEY).isBoolean()) {
                throw new JsonException("Allow fullscreen display must be a boolean " + content.opt(ALLOW_FULLSCREEN_DISPLAY_KEY));
            }

            builder.setAllowFullscreenDisplay(content.opt(ALLOW_FULLSCREEN_DISPLAY_KEY).getBoolean(false));
        }

        try {
            return builder.build();
        } catch (IllegalArgumentException e) {
            throw new JsonException("Invalid html message JSON: " + content, e);
        }
    }
/**
     * Parses HTML display JSON.
     *
     *
     * @param json The json payload.
     * @return The parsed display content.
     * @throws JsonException If the json was unable to be parsed.
     */
Parses HTML display JSON.
@param json The json payload.
@return The parsed display content.
@throws JsonException If the json was unable to be parsed.
Parses HTML display JSON . @param json The json payload . @return The parsed display content . @throws JsonException If the json was unable to be parsed .
@NonNull
    public static HtmlDisplayContent parseJson(JsonValue json) throws JsonException {
        JsonMap content = json.optMap();
        Builder builder = newBuilder();
        if (content.containsKey(DISMISS_BUTTON_COLOR_KEY)) {
            try {
                builder.setDismissButtonColor(Color.parseColor(content.opt(DISMISS_BUTTON_COLOR_KEY).getString("")));
            } catch (IllegalArgumentException e) {
                throw new JsonException("Invalid dismiss button color: " + content.opt(DISMISS_BUTTON_COLOR_KEY), e);
            }
        }
        if (content.containsKey(URL_KEY)) {
            builder.setUrl(content.opt(URL_KEY).getString());
        }
        if (content.containsKey(BACKGROUND_COLOR_KEY)) {
            try {
                builder.setBackgroundColor(Color.parseColor(content.opt(BACKGROUND_COLOR_KEY).getString("")));
            } catch (IllegalArgumentException e) {
                throw new JsonException("Invalid background color: " + content.opt(BACKGROUND_COLOR_KEY), e);
            }
        }
        if (content.containsKey(BORDER_RADIUS_KEY)) {
            if (!content.opt(BORDER_RADIUS_KEY).isNumber()) {
                throw new JsonException("Border radius must be a number " + content.opt(BORDER_RADIUS_KEY));
            }
            builder.setBorderRadius(content.opt(BORDER_RADIUS_KEY).getNumber().floatValue());
        }
        if (content.containsKey(ALLOW_FULLSCREEN_DISPLAY_KEY)) {
            if (!content.opt(ALLOW_FULLSCREEN_DISPLAY_KEY).isBoolean()) {
                throw new JsonException("Allow fullscreen display must be a boolean " + content.opt(ALLOW_FULLSCREEN_DISPLAY_KEY));
            }
            builder.setAllowFullscreenDisplay(content.opt(ALLOW_FULLSCREEN_DISPLAY_KEY).getBoolean(false));
        }
        try {
            return builder.build();
        } catch (IllegalArgumentException e) {
            throw new JsonException("Invalid html message JSON: " + content, e);
        }
    }
@ NonNull public static HtmlDisplayContent parseJson ( JsonValue json ) throws JsonException { JsonMap content = json . optMap ( ) ; Builder builder = newBuilder ( ) ; if ( content . containsKey ( DISMISS_BUTTON_COLOR_KEY ) ) { try { builder . setDismissButtonColor ( Color . parseColor ( content . opt ( DISMISS_BUTTON_COLOR_KEY ) . getString ( "" ) ) ) ; } catch ( IllegalArgumentException e ) { throw new JsonException ( "Invalid dismiss button color: " + content . opt ( DISMISS_BUTTON_COLOR_KEY ) , e ) ; } } if ( content . containsKey ( URL_KEY ) ) { builder . setUrl ( content . opt ( URL_KEY ) . getString ( ) ) ; } if ( content . containsKey ( BACKGROUND_COLOR_KEY ) ) { try { builder . setBackgroundColor ( Color . parseColor ( content . opt ( BACKGROUND_COLOR_KEY ) . getString ( "" ) ) ) ; } catch ( IllegalArgumentException e ) { throw new JsonException ( "Invalid background color: " + content . opt ( BACKGROUND_COLOR_KEY ) , e ) ; } } if ( content . containsKey ( BORDER_RADIUS_KEY ) ) { if ( ! content . opt ( BORDER_RADIUS_KEY ) . isNumber ( ) ) { throw new JsonException ( "Border radius must be a number " + content . opt ( BORDER_RADIUS_KEY ) ) ; } builder . setBorderRadius ( content . opt ( BORDER_RADIUS_KEY ) . getNumber ( ) . floatValue ( ) ) ; } if ( content . containsKey ( ALLOW_FULLSCREEN_DISPLAY_KEY ) ) { if ( ! content . opt ( ALLOW_FULLSCREEN_DISPLAY_KEY ) . isBoolean ( ) ) { throw new JsonException ( "Allow fullscreen display must be a boolean " + content . opt ( ALLOW_FULLSCREEN_DISPLAY_KEY ) ) ; } builder . setAllowFullscreenDisplay ( content . opt ( ALLOW_FULLSCREEN_DISPLAY_KEY ) . getBoolean ( false ) ) ; } try { return builder . build ( ) ; } catch ( IllegalArgumentException e ) { throw new JsonException ( "Invalid html message JSON: " + content , e ) ; } }
Parses HTML display JSON.
Parses HTML display JSON .
// Dismiss button color // URL // Background color // Border radius // Allow Fullscreen display