|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsk.baka.ambient.activity.main.AbstractController
sk.baka.ambient.activity.main.PlayerController
public final class PlayerController
Controls the player view located on the MainActivity
activity. This
class is thread unsafe and all methods must be called from the
message loop
.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class sk.baka.ambient.activity.main.AbstractController |
---|
AbstractController.Listener |
Field Summary |
---|
Fields inherited from class sk.baka.ambient.activity.main.AbstractController |
---|
app, cycle, listener, mainActivity, mainView |
Constructor Summary | |
---|---|
PlayerController(MainActivity app)
Creates the player controller. |
Method Summary | |
---|---|
void |
buffered(byte percent)
How much data is currently buffered. |
void |
clipboardChanged()
The clipboard has been changed. |
void |
configChanged(ConfigurationBean config)
The configuration was changed. |
void |
coverLoaded(TrackMetadataBean track)
A cover for given track has been successfully downloaded. |
void |
destroy()
The controller is about to be destroyed. |
void |
libraryUpdate(boolean updateStarted,
boolean interrupted,
boolean userNotified)
Informs that the file rescan is complete and the database is updated. |
void |
lyricsLoaded(TrackMetadataBean track,
List<LyrdbTrack> lyrics)
A lyrics event. |
void |
offline(boolean offline)
Informs that the application has entered an offline/online mode. |
void |
onProgressChanged(SeekBar seekBar,
int progress,
boolean fromTouch)
|
void |
onStartTrackingTouch(SeekBar seekBar)
|
void |
onStopTrackingTouch(SeekBar seekBar)
|
protected void |
performZoom(boolean zoom)
Zooms, or un-zooms the controller. |
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 |
radioNewTrack(String name)
Track was switched while a radio is playing. |
void |
randomChanged(Random random)
The play mode was changed. |
void |
repeatChanged(Repeat repeat)
The play mode was changed. |
void |
started(String file,
int duration,
int currentPosition)
Player started to play the song. |
void |
stateChanged(AppState state)
The application state was changed. |
void |
stopped(String error,
boolean errorMissing,
TrackOriginEnum origin)
The playback was stopped (not paused). |
void |
trackChanged(PlaylistItem item,
boolean playing,
int positionMillis)
A new track was selected in the playlist. |
void |
trackPositionChanged(int position,
boolean playing)
A position in the track was changed. |
void |
update(Interval select)
Reinitializes the underlying view. |
protected void |
visibilityChanged(boolean visible)
Invoked when the component visibility changes. |
Methods inherited from class sk.baka.ambient.activity.main.AbstractController |
---|
equals, flipVisibility, hashCode, hide, initButtonBar, initButtonBar, initButtonBar, isDestroyed, isVisible, isZoomed, onAction, setVisibility, show, zoom |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PlayerController(MainActivity app)
app
- the application instanceMethod Detail |
---|
public void playbackStateChanged(PlayerStateEnum state)
IPlaylistPlayerListener
playbackStateChanged
in interface IPlaylistPlayerListener
state
- new playback state.public void trackChanged(PlaylistItem item, boolean playing, int positionMillis)
IPlaylistPlayerListener
trackChanged
in interface IPlaylistPlayerListener
item
- the new track, may be null
- in this case the
playback is stopped.playing
- if true
then the track is already being played
(or is about to be played).positionMillis
- the starting playback position in milliseconds.protected void visibilityChanged(boolean visible)
AbstractController
visibilityChanged
in class AbstractController
visible
- new visibility flag.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 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 update(Interval select)
AbstractController
update
in class AbstractController
select
- reset selection to this interval.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 void configChanged(ConfigurationBean config)
IApplicationListener
configChanged
in interface IApplicationListener
config
- the configuration instance, must NOT be modified.public void coverLoaded(TrackMetadataBean track)
ILibraryListener
true
.
coverLoaded
in interface ILibraryListener
track
- the track.public void libraryUpdate(boolean updateStarted, boolean interrupted, boolean userNotified)
ILibraryListener
libraryUpdate
in interface ILibraryListener
updateStarted
- if true
then the library update just started. If
false
then the update finished.interrupted
- if true
then the scan was interrupted.userNotified
- if true
then the user is already notified about
the library being updated.public void clipboardChanged()
IApplicationListener
clipboardChanged
in interface IApplicationListener
public void radioNewTrack(String name)
IPlayerListener
radioNewTrack
in interface IPlayerListener
name
- the new track name.public void onProgressChanged(SeekBar seekBar, int progress, boolean fromTouch)
onProgressChanged
in interface SeekBar.OnSeekBarChangeListener
public void onStartTrackingTouch(SeekBar seekBar)
onStartTrackingTouch
in interface SeekBar.OnSeekBarChangeListener
public void onStopTrackingTouch(SeekBar seekBar)
onStopTrackingTouch
in interface SeekBar.OnSeekBarChangeListener
public void buffered(byte percent)
IPlayerListener
buffered
in interface IPlayerListener
percent
- how much the buffer is filled up. 0-100.public void started(String file, int duration, int currentPosition)
IPlayerListener
started
in interface IPlayerListener
file
- the fileduration
- the file duration in ms. May be 0 if the stream is endless or
the duration is not known.currentPosition
- current playback position, in ms.public void stopped(String error, boolean errorMissing, TrackOriginEnum origin)
IPlayerListener
The playback was stopped (not paused). This may be caused by:
but never by
IPlayer.stop()
invocation
stopped
in interface IPlayerListener
error
- if not null
then the player stopped because of an
unspecified error.errorMissing
- if true
then the error occurred because the file
is missing.origin
- the track originpublic void lyricsLoaded(TrackMetadataBean track, List<LyrdbTrack> lyrics)
ILibraryListener
lyricsLoaded
in interface ILibraryListener
track
- the track.lyrics
- if non-null
then user needs to select the correct
karaoke from this list. The list may be empty - in this case
no karaoke files are available. If null
then the
karaoke file is available locally. If non-null
and is empty then no karaoke files are available.public void destroy()
AbstractController
super()
if you override
this method!
destroy
in class AbstractController
public void offline(boolean offline)
IApplicationListener
offline
in interface IApplicationListener
offline
- if true
then we are currently offline. If
false
then we are online.public void stateChanged(AppState state)
IApplicationListener
stateChanged
in interface IApplicationListener
state
- the state instance, must NOT be modified.protected void performZoom(boolean zoom)
AbstractController
performZoom
in class AbstractController
zoom
- true
zoom the controller in, false
zoom the controller out.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |