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 ofMediaController
.
-
-
Constructor Summary
Constructors Constructor Description ShadowMediaController()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
executeOnMetadataChanged(MediaMetadata metadata)
Executes all registered onMetadataChanged callbacks.void
executeOnPlaybackStateChanged(PlaybackState playbackState)
Executes all registered onPlaybackStateChanged callbacks.List<MediaController.Callback>
getCallbacks()
Gets the callbacks registered to MediaController.protected MediaMetadata
getMetadata()
Gets the mediaMetadata set viasetMetadata(android.media.MediaMetadata)
.protected MediaController.PlaybackInfo
getPlaybackInfo()
Gets the playbackInfo set viasetPlaybackInfo(android.media.session.MediaController.PlaybackInfo)
.protected PlaybackState
getPlaybackState()
Gets the playbackState set viasetPlaybackState(android.media.session.PlaybackState)
.protected int
getRatingType()
Gets the rating type set viasetRatingType(int)
.protected void
registerCallback(MediaController.Callback callback)
Register callback and store it in the shadow to make it easier to check the state of the registered callbacks.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()
.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.
-
-
-
Method Detail
-
setPackageName
public void setPackageName(String packageName)
Saves the package name for use inside the shadow.
-
setPlaybackState
public void setPlaybackState(PlaybackState playbackState)
Saves the playbackState to control the return value ofMediaController.getPlaybackState()
.
-
getPlaybackState
@Implementation protected PlaybackState getPlaybackState()
Gets the playbackState set viasetPlaybackState(android.media.session.PlaybackState)
.
-
setPlaybackInfo
public void setPlaybackInfo(MediaController.PlaybackInfo playbackInfo)
Saves the playbackInfo to control the return value ofMediaController.getPlaybackInfo()
.PlaybackInfoBuilder
can be used to create PlaybackInfo instances.
-
getPlaybackInfo
@Implementation protected MediaController.PlaybackInfo getPlaybackInfo()
Gets the playbackInfo set viasetPlaybackInfo(android.media.session.MediaController.PlaybackInfo)
.
-
setMetadata
public void setMetadata(MediaMetadata mediaMetadata)
Saves the mediaMetadata to control the return value ofMediaController.getMetadata()
.
-
getMetadata
@Implementation protected MediaMetadata 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
@Implementation protected int getRatingType()
Gets the rating type set viasetRatingType(int)
.
-
registerCallback
@Implementation protected void registerCallback(MediaController.Callback callback)
Register callback and store it in the shadow to make it easier to check the state of the registered callbacks.
-
unregisterCallback
@Implementation 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.
-
getCallbacks
public List<MediaController.Callback> getCallbacks()
Gets the callbacks registered to MediaController.
-
executeOnPlaybackStateChanged
public void executeOnPlaybackStateChanged(PlaybackState playbackState)
Executes all registered onPlaybackStateChanged callbacks.
-
executeOnMetadataChanged
public void executeOnMetadataChanged(MediaMetadata metadata)
Executes all registered onMetadataChanged callbacks.
-
-