|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectandroid.content.BroadcastReceiver
sk.baka.ambient.NetworkHandler
@ThreadUnsafe final class NetworkHandler
Ensures that the WiFi is not turned off while playing an online content. Moreover, monitors the network status info and fires online/offline events. Initially, the handler expects the phone to be offline - if not, an event is fired.
Thread-unsafe, should be invoked from the main Handler instance only.
| Constructor Summary | |
|---|---|
NetworkHandler(AmbientApplication app)
Creates new power handler. |
|
| Method Summary | |
|---|---|
(package private) void |
destroy()
Destroys this handler and drops any power locks being held. |
boolean |
isOffline()
Checks if the player is currently off-line. |
void |
onReceive(android.content.Context context,
android.content.Intent intent)
|
void |
playbackStateChanged(PlayerStateEnum state)
The playback state was changed. |
void |
playlistChanged(Interval target)
Fired when the playlist changes - by removing a track, re-shuffling etc. |
void |
randomChanged(Random random)
The play mode was changed. |
void |
repeatChanged(Repeat repeat)
The play mode was changed. |
void |
setForcedOffline(boolean offline)
Sets the offline status. |
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 android.content.BroadcastReceiver |
|---|
abortBroadcast, clearAbortBroadcast, getAbortBroadcast, getDebugUnregister, getResultCode, getResultData, getResultExtras, peekService, setDebugUnregister, setOrderedHint, setResult, setResultCode, setResultData, setResultExtras |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public NetworkHandler(AmbientApplication app)
app - owner application.| Method Detail |
|---|
public void playbackStateChanged(PlayerStateEnum state)
IPlaylistPlayerListener
playbackStateChanged in interface IPlaylistPlayerListenerstate - new playback state.public void playlistChanged(Interval target)
IPlaylistPlayerListener
playlistChanged in interface IPlaylistPlayerListenertarget - 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 randomChanged(Random random)
IPlaylistPlayerListener
randomChanged in interface IPlaylistPlayerListenerrandom - new random value, never null.public void repeatChanged(Repeat repeat)
IPlaylistPlayerListener
repeatChanged in interface IPlaylistPlayerListenerrepeat - new repeat value, never null.
public void trackChanged(PlaylistItem track,
boolean play,
int positionMillis)
IPlaylistPlayerListener
trackChanged in interface IPlaylistPlayerListenertrack - 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 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 IPlaylistPlayerListenerposition - 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.void destroy()
public void onReceive(android.content.Context context,
android.content.Intent intent)
onReceive in class android.content.BroadcastReceiverpublic void setForcedOffline(boolean offline)
offline - true forces the offline status,
false resumes the network status auto-detection.public boolean isOffline()
true if the player is off-line, false
if it is on-line.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||