Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand All @@ -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;
Expand Down Expand Up @@ -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.
*
Expand Down Expand Up @@ -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 + ")";
}
Expand All @@ -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;
Expand Down Expand Up @@ -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.
*
Expand Down Expand Up @@ -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)
Expand Down