shadows/supportv4/src/main/java/org/robolectric/shadows/support/v4/ShadowMediaBrowserCompat.java
@Implementation
  protected void search(
      @NonNull final String query, final Bundle extras, @NonNull SearchCallback callback) {
    if (isConnected) {
      final List<MediaItem> searchResults = new ArrayList<>();
      for (MediaItem item : mediaItems.values()) {
        final String mediaTitle = item.getDescription().getTitle().toString().toLowerCase();
        if (mediaTitle.contains(query.toLowerCase())) {
          searchResults.add(item);
        }
      }
      handler.post(() -> callback.onSearchResult(query, extras, searchResults));
    } else {
      handler.post(() -> callback.onError(query, extras));
    }
  }
@Implementation
  protected void search(
      @NonNull final String query, final Bundle extras, @NonNull SearchCallback callback) {
    if (isConnected) {
      final List<MediaItem> searchResults = new ArrayList<>();
      for (MediaItem item : mediaItems.values()) {
        final String mediaTitle = item.getDescription().getTitle().toString().toLowerCase();
        if (mediaTitle.contains(query.toLowerCase())) {
          searchResults.add(item);
        }
      }
      handler.post(() -> callback.onSearchResult(query, extras, searchResults));
    } else {
      handler.post(() -> callback.onError(query, extras));
    }
  }
@ Implementation protected void search ( @ NonNull final String query , final Bundle extras , @ NonNull SearchCallback callback ) { if ( isConnected ) { final List < MediaItem > searchResults = new ArrayList <> ( ) ; for ( MediaItem item : mediaItems . values ( ) ) { final String mediaTitle = item . getDescription ( ) . getTitle ( ) . toString ( ) . toLowerCase ( ) ; if ( mediaTitle . contains ( query . toLowerCase ( ) ) ) { searchResults . add ( item ) ; } } handler . post ( ( ) -> callback . onSearchResult ( query , extras , searchResults ) ) ; } else { handler . post ( ( ) -> callback . onError ( query , extras ) ) ; } }
This differs from real Android search logic. Search results will contain all {@link
MediaItem}'s with a title that {@param query} is a substring of.
This differs from real Android search logic . Search results will contain all {