YAACC - UPNP Client and Server
Loading...
Searching...
No Matches
de.yaacc.player.PlayMode Class Reference

How one player continues after an item: repeat (off, all, one) and shuffle (off, on). More...

Collaboration diagram for de.yaacc.player.PlayMode:
Collaboration graph

Classes

enum  RepeatMode
 What happens when an item has ended. More...
 

Public Member Functions

RepeatMode getRepeat ()
 
boolean isShuffle ()
 
PlayMode withRepeat (RepeatMode newRepeat)
 
PlayMode withShuffle (boolean newShuffle)
 
PlayMode nextRepeat ()
 
PlayMode toggleShuffle ()
 
String toUpnpPlayMode ()
 
boolean equals (Object o)
 
int hashCode ()
 
String toString ()
 

Static Public Member Functions

static PlayMode of (RepeatMode repeat, boolean shuffle)
 
static PlayMode fromSettings (boolean replayPlaylist, boolean shuffle)
 
static PlayMode fromPreferences (SharedPreferences preferences, String replayKey, String shuffleKey)
 Reads the two settings (defaults as in the settings screen: replay off, shuffle off).
 
static PlayMode fromUpnpPlayMode (String upnpPlayMode)
 

Static Public Attributes

static final String UPNP_NORMAL = "NORMAL"
 
static final String UPNP_SHUFFLE = "SHUFFLE"
 
static final String UPNP_REPEAT_ONE = "REPEAT_ONE"
 
static final String UPNP_REPEAT_ALL = "REPEAT_ALL"
 
static final String UPNP_RANDOM = "RANDOM"
 
static final PlayMode NORMAL = new PlayMode(RepeatMode.OFF, false)
 Repeat off, shuffle off.
 

Detailed Description

How one player continues after an item: repeat (off, all, one) and shuffle (off, on).

Immutable, plain JVM. The two settings "replay playlist" and "shuffle music" only give the mode a new player starts with (fromSettings); after that the mode belongs to the player and is never written back.

The UPnP AVTransport state variable CurrentPlayMode knows five modes that cover the combinations (see toUpnpPlayMode()): the mapping is the one Home Assistant uses for its repeat and shuffle services.

Member Function Documentation

◆ fromPreferences()

static PlayMode de.yaacc.player.PlayMode.fromPreferences ( SharedPreferences preferences,
String replayKey,
String shuffleKey )
static

Reads the two settings (defaults as in the settings screen: replay off, shuffle off).

Parameters
replayKeythe key of the "replay playlist" setting
shuffleKeythe key of the "shuffle music" setting

Referenced by de.yaacc.player.PlayModeSettings.defaultPlayMode().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fromSettings()

static PlayMode de.yaacc.player.PlayMode.fromSettings ( boolean replayPlaylist,
boolean shuffle )
static
Returns
the mode a new player starts with: "replay playlist" on means repeat all, off repeat off

Referenced by de.yaacc.player.PlayMode.fromPreferences().

Here is the caller graph for this function:

◆ fromUpnpPlayMode()

static PlayMode de.yaacc.player.PlayMode.fromUpnpPlayMode ( String upnpPlayMode)
static
Parameters
upnpPlayModea CurrentPlayMode value
Returns
the mode; NORMAL, the modes yaacc does not have (DIRECT_1, INTRO), unknown values and null all give repeat off and shuffle off

◆ nextRepeat()

PlayMode de.yaacc.player.PlayMode.nextRepeat ( )
Returns
this mode with the repeat state a click on the repeat button leads to
Here is the call graph for this function:

◆ toggleShuffle()

PlayMode de.yaacc.player.PlayMode.toggleShuffle ( )
Returns
this mode with shuffle switched

◆ toUpnpPlayMode()

String de.yaacc.player.PlayMode.toUpnpPlayMode ( )
Returns
the CurrentPlayMode value of UPnP AVTransport: repeat one is REPEAT_ONE (with or without shuffle, the protocol has no combination), repeat all REPEAT_ALL or, with shuffle, RANDOM (endless shuffle); shuffle alone is SHUFFLE (every item once in random order) and nothing is NORMAL

The documentation for this class was generated from the following file: