Package org.robolectric.shadows
Class ShadowMediaController
java.lang.Object
org.robolectric.shadows.ShadowMediaController
@Implements(value=android.media.session.MediaController.class, minSdk=21) public class ShadowMediaController extends Object
Implementation of
MediaController.-
Constructor Summary
Constructors Constructor Description ShadowMediaController() -
Method Summary
Modifier and Type Method Description voidexecuteOnMetadataChanged(MediaMetadata metadata)Executes all registered onMetadataChanged callbacks.voidexecuteOnPlaybackStateChanged(PlaybackState playbackState)Executes all registered onPlaybackStateChanged callbacks.List<MediaController.Callback>getCallbacks()Gets the callbacks registered to MediaController.protected MediaMetadatagetMetadata()Gets the mediaMetadata set viasetMetadata(android.media.MediaMetadata).protected MediaController.PlaybackInfogetPlaybackInfo()Gets the playbackInfo set viasetPlaybackInfo(android.media.session.MediaController.PlaybackInfo).protected PlaybackStategetPlaybackState()Gets the playbackState set viasetPlaybackState(android.media.session.PlaybackState).protected intgetRatingType()Gets the rating type set viasetRatingType(int).protected voidregisterCallback(MediaController.Callback callback)Register callback and store it in the shadow to make it easier to check the state of the registered callbacks.voidsetMetadata(MediaMetadata mediaMetadata)Saves the mediaMetadata to control the return value ofMediaController.getMetadata().voidsetPackageName(String packageName)Saves the package name for use inside the shadow.voidsetPlaybackInfo(MediaController.PlaybackInfo playbackInfo)Saves the playbackInfo to control the return value ofMediaController.getPlaybackInfo().voidsetPlaybackState(PlaybackState playbackState)Saves the playbackState to control the return value ofMediaController.getPlaybackState().voidsetRatingType(int ratingType)Saves the rating type to control the return value ofMediaController.getRatingType().protected voidunregisterCallback(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().PlaybackInfoBuildercan 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). -
registerCallback
Register callback and store it in the shadow to make it easier to check the state of the registered callbacks. -
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. -
executeOnMetadataChanged
Executes all registered onMetadataChanged callbacks.
-