Skip to content

Commit

Permalink
Added base queue functions. Towards issue jellyfin-archive#36
Browse files Browse the repository at this point in the history
Move some object generation methods to Utilities
Disable method length rule.  We are grown ups and can decide if we want to use ridiculously long methods or not. :)
  • Loading branch information
Lindsay-Needs-Sleep committed Oct 17, 2019
1 parent de16c09 commit 574b327
Show file tree
Hide file tree
Showing 7 changed files with 1,069 additions and 198 deletions.
2 changes: 1 addition & 1 deletion check_style.xml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@

<!-- Checks for Size Violations. -->
<!-- See https://checkstyle.org/config_sizes.html -->
<module name="MethodLength"/>
<!-- <module name="MethodLength"/> -->
<!-- <module name="ParameterNumber"/> -->

<!-- Checks for whitespace -->
Expand Down
37 changes: 37 additions & 0 deletions src/android/Chromecast.java
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,43 @@ public boolean mediaEditTracksInfo(JSONArray activeTrackIds, JSONObject textTrac
return true;
}

/**
* Loads a queue of media to the Chromecast.
* @param queueLoadRequest chrome.cast.media.QueueLoadRequest
* @param callbackContext called with .success or .error depending on the result
* @return true for cordova
*/
public boolean queueLoad(JSONObject queueLoadRequest, final CallbackContext callbackContext) {
this.media.queueLoad(queueLoadRequest, callbackContext);
return true;
}

/**
* Plays the item with itemId in the queue.
* @param itemId The ID of the item to jump to.
* @param callbackContext called with .success or .error depending on the result
* @return true for cordova
*/
public boolean queueJumpToItem(Integer itemId, final CallbackContext callbackContext) {
this.media.queueJumpToItem(itemId, callbackContext);
return true;
}

/**
* Plays the item with itemId in the queue.
* @param itemId The ID of the item to jump to.
* @param callbackContext called with .success or .error depending on the result
* @return true for cordova
*/
public boolean queueJumpToItem(Double itemId, final CallbackContext callbackContext) {
if (itemId - Double.valueOf(itemId).intValue() == 0) {
// Only perform the jump if the double is a whole number
return queueJumpToItem(Double.valueOf(itemId).intValue(), callbackContext);
} else {
return true;
}
}

/**
* Stops the session.
* @param callbackContext called with .success or .error depending on the result
Expand Down
Loading

0 comments on commit 574b327

Please sign in to comment.