|
||||||||||
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.cb.AbstractCollectionController
public abstract class AbstractCollectionController
Controller which displays a collection browser on given list view and allows user to navigate it using gestures.
The controller listens on two actions:
ActionsEnum.Back
- go back in the menu hierarchy
ActionsEnum.CollectionYear
to switch year being displayed
Nested Class Summary |
---|
Nested classes/interfaces inherited from class sk.baka.ambient.activity.main.AbstractController |
---|
AbstractController.Listener |
Field Summary | |
---|---|
protected ICollection |
collection
The collection to display the data from. |
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 | |
---|---|
AbstractCollectionController(int mainViewId,
int listViewId,
Activity mainActivity,
GesturesListView playlistView,
ICollection collection,
int categoryPathId)
Creates new controller instance. |
Method Summary | |
---|---|
boolean |
canComputeItems()
Checks if the model currently supports computing tracks. |
boolean |
canHighlight()
Checks if we can start highlight mode now. |
List<TrackMetadataBean> |
computeTracks(Interval highlight)
Retrieve a list of tracks from the selection. |
void |
coverLoaded(TrackMetadataBean track)
A cover for given track has been successfully downloaded. |
void |
destroy()
The controller is about to be destroyed. |
String |
getHint(Interval highlight)
Returns a very short and simple string representation of the selected contents. |
boolean |
isComputeTracksLong(Interval interval)
Checks if the IGestureListViewListener.computeTracks(Interval) method will be a long
operation. |
boolean |
isComputeTracksOnlineOp(Interval interval)
Checks if the IGestureListViewListener.computeTracks(Interval) method will involve
polling of some data from the Internet. |
boolean |
isReadOnly()
Checks if the list view is currently read-only. |
void |
itemActivated(int index,
Object model)
The item was activated, either by clicking on it or using a keyboard. |
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. |
protected void |
onAction(ActionsEnum action)
Called when an action button is pressed. |
protected void |
recomputeListItems()
Recomputes the model . |
protected void |
refetchData()
Updates the data which is currently being shown. |
void |
removeItems(Interval remove)
Remove these items from the list. |
protected void |
reset()
Resets the controller and shows the first manager, the GroupingManager . |
void |
update(GesturesListView listView,
View itemView,
int index,
Object model)
An item view is being drawn (or re-drawn) on screen. |
protected void |
updateData()
Updates data shown in the controller. |
Methods inherited from class sk.baka.ambient.activity.main.AbstractListController |
---|
dropItems, getClipboard, highlightChanged, moveItems, moveItemsByOne, performZoom, setClipboard, update |
Methods inherited from class sk.baka.ambient.activity.main.AbstractController |
---|
equals, flipVisibility, hashCode, hide, initButtonBar, initButtonBar, initButtonBar, isDestroyed, isVisible, isZoomed, setVisibility, show, visibilityChanged, zoom |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final ICollection collection
Constructor Detail |
---|
public AbstractCollectionController(int mainViewId, int listViewId, Activity mainActivity, GesturesListView playlistView, ICollection collection, int categoryPathId)
updateData()
in the constructor to update the display.
mainViewId
- the view whose visibility is controlled.listViewId
- the id of the GesturesListView
mainActivity
- the main activity instance.playlistView
- the playlist view - target of drag'n'drop operations.collection
- the collection to display the data from.categoryPathId
- the ID of TextView
which will display current category
path.Method Detail |
---|
public void destroy()
AbstractController
super()
if you override
this method!
destroy
in class AbstractListController
protected final void reset()
GroupingManager
.
public final boolean canHighlight()
IGestureListViewListener
canHighlight
in interface IGestureListViewListener
canHighlight
in class AbstractListController
true
if highlight mode can be started,
false
otherwise.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)
IGestureListViewListener
Remove these items from the list. The list view sets the highlight automatically to zero interval.
This operation is invoked even when IGestureListViewListener.isReadOnly()
returns
false
as some use cases activates a "Go Back" activity
instead of deleting items.
removeItems
in interface IGestureListViewListener
removeItems
in class AbstractListController
remove
- remove these items. The interval is not null
however it may be empty.protected final void refetchData()
protected void onAction(ActionsEnum action)
AbstractController
onAction
in class AbstractController
action
- the action to takeprotected final void recomputeListItems()
AbstractListController
model
. You don't have
to call the ModelHolder.notifyModified()
- it is called
automatically after the method finishes.
recomputeListItems
in class AbstractListController
public void update(GesturesListView listView, View itemView, int index, Object model)
IGestureListViewListener
GesturesListView.getModel()
list.
The only exception is the EOP special item. For more information please
read here
.
update
in interface IGestureListViewListener
listView
- the listview containing the viewitemView
- the view representing a single itemindex
- the index in the GesturesListView.getModel()
list. May
point outside of the model list only when drawing an EOP item.model
- The model object, taken from the
GesturesListView.getModel()
list. This value may
optionally be the MutableListAdapter.EOP_MODEL_MARKER
object - in this case the special EndOfPlaylist item must be
drawn.protected final void updateData()
public final List<TrackMetadataBean> computeTracks(Interval highlight)
IGestureListViewListener
Retrieve a list of tracks from the selection. This operation may not be
invoked from the handler's thread (depending on the result of the
IGestureListViewListener.isComputeTracksLong(Interval)
method). The method implementation
should thus periodically check for the interrupted
flag. When interrupted, it should return an empty list or
null
ASAP. It may do so by throwing an exception
If the method is invoked in a non-handler thread the callee wraps the result in a thread-safe list.
The method may throw RuntimeException
- it will be caught and
displayed unless the thread is interrupted.
This method is only invoked when IGestureListViewListener.canComputeItems()
returns
true
.
computeTracks
in interface IGestureListViewListener
computeTracks
in class AbstractListController
highlight
- the selection
null
.public final boolean isComputeTracksLong(Interval interval)
IGestureListViewListener
Checks if the IGestureListViewListener.computeTracks(Interval)
method will be a long
operation. If yes, then the operation will be run in new thread. If not,
the operation will be run in handler event thread.
This method is only invoked when IGestureListViewListener.canComputeItems()
returns
true
.
isComputeTracksLong
in interface IGestureListViewListener
isComputeTracksLong
in class AbstractListController
interval
- the selection
true
if long operation, false
otherwise.public boolean isComputeTracksOnlineOp(Interval interval)
IGestureListViewListener
Checks if the IGestureListViewListener.computeTracks(Interval)
method will involve
polling of some data from the Internet.
This method is only invoked when IGestureListViewListener.canComputeItems()
returns
true
.
isComputeTracksOnlineOp
in interface IGestureListViewListener
isComputeTracksOnlineOp
in class AbstractListController
interval
- the selection
true
if some Internet resources will be polled,
false
otherwise.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 AbstractListController
highlight
- the highlighted items.
null
if no hint should be shown.public final boolean isReadOnly()
IGestureListViewListener
isReadOnly
in interface IGestureListViewListener
isReadOnly
in class AbstractListController
true
if the view cannot be modified,
false
otherwise.public final boolean canComputeItems()
IGestureListViewListener
canComputeItems
in interface IGestureListViewListener
canComputeItems
in class AbstractListController
true
if the model can compute tracks,
false
otherwise.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 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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |