|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object sk.baka.ambient.activity.main.AbstractController sk.baka.ambient.activity.main.AbstractListController sk.baka.ambient.activity.main.AbstractPlaylistController sk.baka.ambient.activity.main.PlaylistController
public final class PlaylistController
Manages the playlist.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class sk.baka.ambient.activity.main.AbstractController |
---|
AbstractController.Listener |
Field Summary | |
---|---|
static int |
PLAYLIST_VIEW_ID
The playlist view id. |
Fields inherited from class sk.baka.ambient.activity.main.AbstractListController |
---|
highlightColor, listView |
Fields inherited from class sk.baka.ambient.activity.main.AbstractController |
---|
app, cycle, listener, mainActivity, mainView |
Constructor Summary | |
---|---|
PlaylistController(MainActivity mainActivity)
Creates the controller |
Method Summary | |
---|---|
void |
dropItems(List<TrackMetadataBean> tracks,
int x,
int y,
int index)
The drag'n'drop operation is finished. |
String |
getHint(Interval highlight)
Returns a very short and simple string representation of the selected contents. |
protected int |
getPlaylistSize()
Returns the underlying playlist size. |
protected int |
getQueueNumber(int index)
Returns queue status of given track. |
protected TrackMetadataBean |
getTrack(int index)
Retrieves a track from given position. |
protected boolean |
isCurrentlyPlayedTrack(int index)
Checks if the track at given index is currently being played. |
void |
itemActivated(int index,
Object model)
The item was activated, either by clicking on it or using a keyboard. |
Interval |
moveItems(Interval highlight,
int index)
Move selected items up or down. |
Interval |
moveItemsByOne(Interval highlight,
boolean down)
Move selected items up or down. |
void |
playbackStateChanged(PlayerStateEnum state)
The playback state was changed. |
void |
playlistChanged(Interval target)
Fired when the playlist changes - by removing a track, reshuffling etc. |
void |
randomChanged(Random random)
The play mode was changed. |
void |
removeItems(Interval remove)
The contract: when overriding this method, be sure to call this super method after you are done deleting items. |
void |
repeatChanged(Repeat repeat)
The play mode was changed. |
void |
stateChanged(AppState state)
The application state was changed. |
void |
trackChanged(PlaylistItem track,
boolean play,
int positionMillis)
A new track was selected in the playlist. |
void |
trackPositionChanged(int position,
boolean playing)
A position in the track was changed. |
Methods inherited from class sk.baka.ambient.activity.main.AbstractPlaylistController |
---|
canComputeItems, clipboardChanged, computeTracks, configChanged, initialize, isComputeTracksLong, isComputeTracksOnlineOp, isReadOnly, offline, recomputeListItems, update |
Methods inherited from class sk.baka.ambient.activity.main.AbstractListController |
---|
canHighlight, destroy, getClipboard, highlightChanged, performZoom, setClipboard, update |
Methods inherited from class sk.baka.ambient.activity.main.AbstractController |
---|
equals, flipVisibility, hashCode, hide, initButtonBar, initButtonBar, initButtonBar, isDestroyed, isVisible, isZoomed, onAction, setVisibility, show, visibilityChanged, zoom |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int PLAYLIST_VIEW_ID
Constructor Detail |
---|
public PlaylistController(MainActivity mainActivity)
mainActivity
- the activityMethod Detail |
---|
protected boolean isCurrentlyPlayedTrack(int index)
AbstractPlaylistController
isCurrentlyPlayedTrack
in class AbstractPlaylistController
index
- the track index
true
if it is being played, false
otherwise.protected TrackMetadataBean getTrack(int index)
AbstractPlaylistController
getTrack
in class AbstractPlaylistController
index
- the index
null
.public void itemActivated(int index, Object model)
IGestureListViewListener
itemActivated
in interface IGestureListViewListener
index
- the index of the item.model
- the model for the item.public void removeItems(Interval remove)
AbstractPlaylistController
removeItems
in interface IGestureListViewListener
removeItems
in class AbstractPlaylistController
remove
- the interval to removeprotected int getPlaylistSize()
AbstractPlaylistController
getPlaylistSize
in class AbstractPlaylistController
public void dropItems(List<TrackMetadataBean> tracks, int x, int y, int index)
IGestureListViewListener
dropItems
in interface IGestureListViewListener
dropItems
in class AbstractListController
tracks
- the tracksx
- the drop point x axis relative to the item upper-left corner.y
- the drop point y axis relative to the item upper-left corner.index
- the index of the item where the files were dropped.public Interval moveItems(Interval highlight, int index)
IGestureListViewListener
Move selected items up or down. The listener must update the items and return the new highlight. This operation is always considered as a short-running and thus always executed directly in handler's event thread.
The list view will be redrawn automatically when the method returns.
This operation is invoked only when IGestureListViewListener.isReadOnly()
returns
false
.
moveItems
in interface IGestureListViewListener
moveItems
in class AbstractListController
highlight
- move these itemsindex
- drop the items before item with this index.
public Interval moveItemsByOne(Interval highlight, boolean down)
IGestureListViewListener
Move selected items up or down. The listener must update the items and return the new highlight. This operation is always considered as a short-running and thus always executed directly in handler's event thread.
The list view will be redrawn automatically when the method returns.
This operation is invoked only when IGestureListViewListener.isReadOnly()
returns
false
.
moveItemsByOne
in interface IGestureListViewListener
moveItemsByOne
in class AbstractListController
highlight
- move these itemsdown
- down if true
then move the highlighted interval
down, otherwise move it up.
public void trackChanged(PlaylistItem track, boolean play, int positionMillis)
IPlaylistPlayerListener
trackChanged
in interface IPlaylistPlayerListener
track
- the new track, may be null
- in this case the
playback is stopped.play
- if true
then the track is already being played
(or is about to be played).positionMillis
- the starting playback position in milliseconds.public void playbackStateChanged(PlayerStateEnum state)
IPlaylistPlayerListener
playbackStateChanged
in interface IPlaylistPlayerListener
state
- new playback state.public void randomChanged(Random random)
IPlaylistPlayerListener
randomChanged
in interface IPlaylistPlayerListener
random
- new random value, never null
.public void repeatChanged(Repeat repeat)
IPlaylistPlayerListener
repeatChanged
in interface IPlaylistPlayerListener
repeat
- new repeat value, never null
.public void trackPositionChanged(int position, boolean playing)
IPlaylistPlayerListener
A position in the track was changed. This is only due to
PlaylistPlayer.seek(int)
- it is never invoked periodically as
the playback progresses. This event is not invoked when a playback is
started with non-zero start seek time.
Note that the playback may be paused.
trackPositionChanged
in interface IPlaylistPlayerListener
position
- the new position in milliseconds.playing
- if true
then playback is activated, if
false
then the playback is paused. This event is
not invoked when the playback is stopped.public void playlistChanged(Interval target)
IPlaylistPlayerListener
playlistChanged
in interface IPlaylistPlayerListener
target
- the "target" (or the product) of the operation - for example
for copy/move operations this interval contains added items,
for delete operation the interval is empty. May be
null
if the target is not known. Semantically,
the target should contain tracks that were 'produced' by the
operation and they should be the target of the next operation.
This implies that the playlist view should make these tracks
appear selected.public String getHint(Interval highlight)
IGestureListViewListener
Returns a very short and simple string representation of the selected contents.
This method is only invoked when IGestureListViewListener.canComputeItems()
returns
true
.
getHint
in interface IGestureListViewListener
getHint
in class AbstractPlaylistController
highlight
- the highlighted items.
null
if no hint should be shown.protected int getQueueNumber(int index)
AbstractPlaylistController
getQueueNumber
in class AbstractPlaylistController
index
- the track index
public void stateChanged(AppState state)
IApplicationListener
stateChanged
in interface IApplicationListener
state
- the state instance, must NOT be modified.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |