sk.baka.ambient.activity.main
Class ContextController

java.lang.Object
  extended by sk.baka.ambient.activity.main.AbstractController
      extended by sk.baka.ambient.activity.main.ContextController
All Implemented Interfaces:
IApplicationListener, IPlaylistPlayerListener, ILibraryListener

public final class ContextController
extends AbstractController
implements IPlaylistPlayerListener, ILibraryListener, IApplicationListener

Controls the "Context" page.

Author:
Martin Vysny

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
ContextController(MainActivity mainActivity)
           
 
Method Summary
 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.
protected  void onAction(ActionsEnum action)
          Called when an action button is pressed.
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 randomChanged(Random random)
          The play mode was changed.
 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.AbstractController
equals, flipVisibility, hashCode, hide, initButtonBar, initButtonBar, initButtonBar, isDestroyed, isVisible, isZoomed, setVisibility, show, update, visibilityChanged, zoom
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContextController

public ContextController(MainActivity mainActivity)
Parameters:
mainActivity -
Method Detail

destroy

public void destroy()
Description copied from class: AbstractController
The controller is about to be destroyed. No invocations are performed after this call. The controller should release its resources, stop its activities etc. Make sure that you call super() if you override this method!

Overrides:
destroy in class AbstractController

onAction

protected void onAction(ActionsEnum action)
Description copied from class: AbstractController
Called when an action button is pressed. By default invokes main activity. Subclasses can override.

Overrides:
onAction in class AbstractController
Parameters:
action - the action to take

playbackStateChanged

public void playbackStateChanged(PlayerStateEnum state)
Description copied from interface: IPlaylistPlayerListener
The playback state was changed.

Specified by:
playbackStateChanged in interface IPlaylistPlayerListener
Parameters:
state - new playback state.

playlistChanged

public void playlistChanged(Interval target)
Description copied from interface: IPlaylistPlayerListener
Fired when the playlist changes - by removing a track, reshuffling etc.

Specified by:
playlistChanged in interface IPlaylistPlayerListener
Parameters:
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.

randomChanged

public void randomChanged(Random random)
Description copied from interface: IPlaylistPlayerListener
The play mode was changed.

Specified by:
randomChanged in interface IPlaylistPlayerListener
Parameters:
random - new random value, never null.

repeatChanged

public void repeatChanged(Repeat repeat)
Description copied from interface: IPlaylistPlayerListener
The play mode was changed.

Specified by:
repeatChanged in interface IPlaylistPlayerListener
Parameters:
repeat - new repeat value, never null.

trackChanged

public void trackChanged(PlaylistItem track,
                         boolean play,
                         int positionMillis)
Description copied from interface: IPlaylistPlayerListener
A new track was selected in the playlist.

Specified by:
trackChanged in interface IPlaylistPlayerListener
Parameters:
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.

trackPositionChanged

public void trackPositionChanged(int position,
                                 boolean playing)
Description copied from interface: 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.

Specified by:
trackPositionChanged in interface IPlaylistPlayerListener
Parameters:
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.

coverLoaded

public void coverLoaded(TrackMetadataBean track)
Description copied from interface: ILibraryListener
A cover for given track has been successfully downloaded. Note that if the cache size is set to a very small value the image may already be purged from the cache. To avoid this either set a sensible cache size value, e.g. 128kb, or turn off the image downloading by setting offline mode to true.

Specified by:
coverLoaded in interface ILibraryListener
Parameters:
track - the track.

libraryUpdate

public void libraryUpdate(boolean updateStarted,
                          boolean interrupted,
                          boolean userNotified)
Description copied from interface: ILibraryListener
Informs that the file rescan is complete and the database is updated. Invoked in Scanner thread.

Specified by:
libraryUpdate in interface ILibraryListener
Parameters:
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.

lyricsLoaded

public void lyricsLoaded(TrackMetadataBean track,
                         List<LyrdbTrack> lyrics)
Description copied from interface: ILibraryListener
A lyrics event. Either lyrics for given track has been successfully downloaded or user needs to select one from given lyrics list.

Specified by:
lyricsLoaded in interface ILibraryListener
Parameters:
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.

clipboardChanged

public void clipboardChanged()
Description copied from interface: IApplicationListener
The clipboard has been changed.

Specified by:
clipboardChanged in interface IApplicationListener

configChanged

public void configChanged(ConfigurationBean config)
Description copied from interface: IApplicationListener
The configuration was changed.

Specified by:
configChanged in interface IApplicationListener
Parameters:
config - the configuration instance, must NOT be modified.

offline

public void offline(boolean offline)
Description copied from interface: IApplicationListener
Informs that the application has entered an offline/online mode.

Specified by:
offline in interface IApplicationListener
Parameters:
offline - if true then we are currently offline. If false then we are online.

stateChanged

public void stateChanged(AppState state)
Description copied from interface: IApplicationListener
The application state was changed.

Specified by:
stateChanged in interface IApplicationListener
Parameters:
state - the state instance, must NOT be modified.

performZoom

protected void performZoom(boolean zoom)
Description copied from class: AbstractController
Zooms, or un-zooms the controller.

Specified by:
performZoom in class AbstractController
Parameters:
zoom - true zoom the controller in, false zoom the controller out.


Copyright © 2007-2008. All Rights Reserved.