Package org.robolectric.shadows
Class ShadowMediaController
java.lang.Object
org.robolectric.shadows.ShadowMediaController
@Implements(android.media.session.MediaController.class)
public class ShadowMediaController
extends Object
Implementation of
MediaController
.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
executeOnMetadataChanged
(MediaMetadata metadata) Executes all registered onMetadataChanged callbacks.void
executeOnPlaybackStateChanged
(PlaybackState playbackState) Executes all registered onPlaybackStateChanged callbacks.void
Executes all registered onSessionDestroyed callbacks.Gets the callbacks registered to MediaController.protected Bundle
Gets the extras set viaextras
.protected MediaMetadata
Gets the mediaMetadata set viasetMetadata(android.media.MediaMetadata)
.protected MediaController.PlaybackInfo
Gets the playbackInfo set viasetPlaybackInfo(android.media.session.MediaController.PlaybackInfo)
.protected PlaybackState
Gets the playbackState set viasetPlaybackState(android.media.session.PlaybackState)
.protected int
Gets the rating type set viasetRatingType(int)
.protected PendingIntent
Gets the playbackState set viasetSessionActivity(android.app.PendingIntent)
.protected void
registerCallback
(MediaController.Callback callback, Handler handler) Register callback and store it in the shadow to make it easier to check the state of the registered callbacks.void
Saves the extras to control the return value ofMediaController.getExtras()
.void
setMetadata
(MediaMetadata mediaMetadata) Saves the mediaMetadata to control the return value ofMediaController.getMetadata()
.void
setPackageName
(String packageName) Saves the package name for use inside the shadow.void
setPlaybackInfo
(MediaController.PlaybackInfo playbackInfo) Saves the playbackInfo to control the return value ofMediaController.getPlaybackInfo()
.void
setPlaybackState
(PlaybackState playbackState) Saves the playbackState to control the return value ofMediaController.getPlaybackState()
.void
setRatingType
(int ratingType) Saves the rating type to control the return value ofMediaController.getRatingType()
.void
setSessionActivity
(PendingIntent sessionActivity) Saves the sessionActivty to control the return value ofMediaController.getSessionActivity()
.protected void
unregisterCallback
(MediaController.Callback callback) Unregister callback and remove it from the shadow to make it easier to check the state of the registered callbacks.
-
Constructor Details
-
ShadowMediaController
public ShadowMediaController()
-
-
Method Details
-
setPackageName
Saves the package name for use inside the shadow. -
setPlaybackState
Saves the playbackState to control the return value ofMediaController.getPlaybackState()
. -
getPlaybackState
Gets the playbackState set viasetPlaybackState(android.media.session.PlaybackState)
. -
setPlaybackInfo
Saves the playbackInfo to control the return value ofMediaController.getPlaybackInfo()
.PlaybackInfoBuilder
can be used to create PlaybackInfo instances. -
getPlaybackInfo
Gets the playbackInfo set viasetPlaybackInfo(android.media.session.MediaController.PlaybackInfo)
. -
setMetadata
Saves the mediaMetadata to control the return value ofMediaController.getMetadata()
. -
getMetadata
Gets the mediaMetadata set viasetMetadata(android.media.MediaMetadata)
. -
setRatingType
public void setRatingType(int ratingType) Saves the rating type to control the return value ofMediaController.getRatingType()
. -
getRatingType
Gets the rating type set viasetRatingType(int)
. -
setSessionActivity
Saves the sessionActivty to control the return value ofMediaController.getSessionActivity()
. -
getSessionActivity
Gets the playbackState set viasetSessionActivity(android.app.PendingIntent)
. -
setExtras
Saves the extras to control the return value ofMediaController.getExtras()
. -
getExtras
Gets the extras set viaextras
. -
registerCallback
Register callback and store it in the shadow to make it easier to check the state of the registered callbacks. Handler is just passed on to the real class. -
unregisterCallback
Unregister callback and remove it from the shadow to make it easier to check the state of the registered callbacks. -
getCallbacks
Gets the callbacks registered to MediaController. -
executeOnPlaybackStateChanged
Executes all registered onPlaybackStateChanged callbacks. -
executeOnSessionDestroyed
public void executeOnSessionDestroyed()Executes all registered onSessionDestroyed callbacks. -
executeOnMetadataChanged
Executes all registered onMetadataChanged callbacks.
-