diff --git a/src/main/java/se/michaelthelin/spotify/model_objects/miscellaneous/CurrentlyPlayingContext.java b/src/main/java/se/michaelthelin/spotify/model_objects/miscellaneous/CurrentlyPlayingContext.java index a146fae98..a2ec3e1cf 100644 --- a/src/main/java/se/michaelthelin/spotify/model_objects/miscellaneous/CurrentlyPlayingContext.java +++ b/src/main/java/se/michaelthelin/spotify/model_objects/miscellaneous/CurrentlyPlayingContext.java @@ -24,6 +24,8 @@ public class CurrentlyPlayingContext extends AbstractModelObject { private final String repeat_state; /** If shuffle is on or off. */ private final Boolean shuffle_state; + /** If smart shuffle is on or off. */ + private final Boolean smart_shuffle; /** The context in which the track is being played. */ private final Context context; /** Unix timestamp when the request was made. */ @@ -45,6 +47,7 @@ private CurrentlyPlayingContext(final Builder builder) { this.device = builder.device; this.repeat_state = builder.repeat_state; this.shuffle_state = builder.shuffle_state; + this.smart_shuffle = builder.smart_shuffle; this.context = builder.context; this.timestamp = builder.timestamp; this.progress_ms = builder.progress_ms; @@ -81,6 +84,15 @@ public Boolean getShuffle_state() { return shuffle_state; } + /** + * Get the smart shuffle state of the device. + * + * @return If smart shuffle is on or off. + */ + public Boolean getSmart_shuffle() { + return smart_shuffle; + } + /** * Get the context from where the currently playing item is played from. * @@ -147,7 +159,7 @@ public Actions getActions() { @Override public String toString() { return "CurrentlyPlayingContext(device=" + device + ", repeat_state=" + repeat_state + ", shuffle_state=" - + shuffle_state + ", context=" + context + ", timestamp=" + timestamp + ", progress_ms=" + progress_ms + + shuffle_state + ", smart_shuffle=" + smart_shuffle + ", context=" + context + ", timestamp=" + timestamp + ", progress_ms=" + progress_ms + ", is_playing=" + is_playing + ", item=" + item + ", currentlyPlayingType=" + currentlyPlayingType + ", actions=" + actions + ")"; } @@ -164,6 +176,7 @@ public static final class Builder extends AbstractModelObject.Builder { private Device device; private String repeat_state; private Boolean shuffle_state; + private Boolean smart_shuffle; private Context context; private Long timestamp; private Integer progress_ms; @@ -212,6 +225,17 @@ public Builder setShuffle_state(Boolean shuffle_state) { return this; } + /** + * The smart shuffle state setter. + * + * @param smart_shuffle If smart shuffle is on or off. + * @return A {@link CurrentlyPlayingContext.Builder}. + */ + public Builder setSmart_shuffle(Boolean smart_shuffle) { + this.smart_shuffle = smart_shuffle; + return this; + } + /** * The playing context setter. * @@ -326,8 +350,10 @@ public CurrentlyPlayingContext createModelObject(JsonObject jsonObject) { hasAndNotNull(jsonObject, "shuffle_state") ? jsonObject.get("shuffle_state").getAsBoolean() : null) - .setContext( - hasAndNotNull(jsonObject, "context") + .setSmart_shuffle( hasAndNotNull(jsonObject, "smart_shuffle") + hasAndNotNull(jsonObject, "smart_shuffle") : + ? jsonObject.get("smart_shuffle").getAsBoolean() + : null) ? new Context.JsonUtil().createModelObject( jsonObject.getAsJsonObject("context")) : null)