Class ShadowMediaBrowserCompat
java.lang.Object
org.robolectric.shadows.support.v4.ShadowMediaBrowserCompat
@Implements(android.support.v4.media.MediaBrowserCompat.class) public class ShadowMediaBrowserCompat extends Object
This will mimic the connection to a
MediaBrowserServiceCompat by creating and maintaining
its own account of MediaBrowserCompat.MediaItems.-
Constructor Summary
Constructors Constructor Description ShadowMediaBrowserCompat() -
Method Summary
Modifier and Type Method Description protected void__constructor__(Context context, ComponentName serviceComponent, android.support.v4.media.MediaBrowserCompat.ConnectionCallback callback, Bundle rootHints)protected voidconnect()android.support.v4.media.MediaBrowserCompat.MediaItemcreateMediaItem(String parentId, String mediaId, String title, int flag)Creates a MediaItem and returns it.protected voiddisconnect()Map<android.support.v4.media.MediaBrowserCompat.MediaItem,List<android.support.v4.media.MediaBrowserCompat.MediaItem>>getCopyOfMediaItemChildren()protected voidgetItem(String mediaId, android.support.v4.media.MediaBrowserCompat.ItemCallback cb)protected StringgetRoot()android.support.v4.media.session.MediaSessionCompat.TokengetSessionToken()protected booleanisConnected()protected voidsearch(String query, Bundle extras, android.support.v4.media.MediaBrowserCompat.SearchCallback callback)This differs from real Android search logic.voidsetRootId(String mediaId)Sets the root id.protected voidsubscribe(String parentId, Bundle options, android.support.v4.media.MediaBrowserCompat.SubscriptionCallback callback)protected voidsubscribe(String parentId, android.support.v4.media.MediaBrowserCompat.SubscriptionCallback callback)
-
Constructor Details
-
ShadowMediaBrowserCompat
public ShadowMediaBrowserCompat()
-
-
Method Details
-
__constructor__
@Implementation protected void __constructor__(Context context, ComponentName serviceComponent, android.support.v4.media.MediaBrowserCompat.ConnectionCallback callback, Bundle rootHints) -
connect
-
disconnect
-
isConnected
-
getRoot
-
getItem
@Implementation protected void getItem(@NonNull String mediaId, @NonNull android.support.v4.media.MediaBrowserCompat.ItemCallback cb) -
subscribe
@Implementation protected void subscribe(@NonNull String parentId, @NonNull android.support.v4.media.MediaBrowserCompat.SubscriptionCallback callback) -
subscribe
@Implementation protected void subscribe(@NonNull String parentId, @Nullable Bundle options, @NonNull android.support.v4.media.MediaBrowserCompat.SubscriptionCallback callback) -
search
@Implementation protected void search(@NonNull String query, Bundle extras, @NonNull android.support.v4.media.MediaBrowserCompat.SearchCallback callback)This differs from real Android search logic. Search results will contain allMediaBrowserCompat.MediaItem's with a title that {@param query} is a substring of. -
getSessionToken
-
setRootId
Sets the root id. Can be called more than once.- Parameters:
mediaId- the id of the root MediaItem. This MediaItem should already have been created.
-
createMediaItem
public android.support.v4.media.MediaBrowserCompat.MediaItem createMediaItem(String parentId, String mediaId, String title, int flag)Creates a MediaItem and returns it.- Parameters:
parentId- the id of the parent MediaItem. If the MediaItem to be created will be the root, parentId should be null.mediaId- the id of the MediaItem to be created.title- the title of the MediaItem to be created.flag- says if the MediaItem to be created is browsable and/or playable.- Returns:
- the newly created MediaItem.
-
getCopyOfMediaItemChildren
public Map<android.support.v4.media.MediaBrowserCompat.MediaItem,List<android.support.v4.media.MediaBrowserCompat.MediaItem>> getCopyOfMediaItemChildren()- Returns:
- a copy of the internal
Mapthat mapsMediaBrowserCompat.MediaItems to their children.
-