@Test(expected = IllegalArgumentException.class) public void testInvalidSymbolsInMediaIDStructure() throws Exception { fail(MediaIDHelper.createMediaID(null, "BY|GENRE/2", "Classic 70's")); }
public static String createMediaID(String musicID, String... categories) { StringBuilder sb = new StringBuilder(); if (categories != null) { for (int i=0; i < categories.length; i++) { if (!isValidCategory(categories[i])) { throw new IllegalArgumentException("Invalid category: " + categories[0]); } sb.append(categories[i]); if (i < categories.length - 1) { sb.append(CATEGORY_SEPARATOR); } } } if (musicID != null) { sb.append(LEAF_SEPARATOR).append(musicID); } return sb.toString(); }
MediaIDHelper { public static String createMediaID(String musicID, String... categories) { StringBuilder sb = new StringBuilder(); if (categories != null) { for (int i=0; i < categories.length; i++) { if (!isValidCategory(categories[i])) { throw new IllegalArgumentException("Invalid category: " + categories[0]); } sb.append(categories[i]); if (i < categories.length - 1) { sb.append(CATEGORY_SEPARATOR); } } } if (musicID != null) { sb.append(LEAF_SEPARATOR).append(musicID); } return sb.toString(); } }
MediaIDHelper { public static String createMediaID(String musicID, String... categories) { StringBuilder sb = new StringBuilder(); if (categories != null) { for (int i=0; i < categories.length; i++) { if (!isValidCategory(categories[i])) { throw new IllegalArgumentException("Invalid category: " + categories[0]); } sb.append(categories[i]); if (i < categories.length - 1) { sb.append(CATEGORY_SEPARATOR); } } } if (musicID != null) { sb.append(LEAF_SEPARATOR).append(musicID); } return sb.toString(); }  }
MediaIDHelper { public static String createMediaID(String musicID, String... categories) { StringBuilder sb = new StringBuilder(); if (categories != null) { for (int i=0; i < categories.length; i++) { if (!isValidCategory(categories[i])) { throw new IllegalArgumentException("Invalid category: " + categories[0]); } sb.append(categories[i]); if (i < categories.length - 1) { sb.append(CATEGORY_SEPARATOR); } } } if (musicID != null) { sb.append(LEAF_SEPARATOR).append(musicID); } return sb.toString(); }  static String createMediaID(String musicID, String... categories); static String extractMusicIDFromMediaID(@NonNull String mediaID); static @NonNull String[] getHierarchy(@NonNull String mediaID); static String extractBrowseCategoryValueFromMediaID(@NonNull String mediaID); static boolean isBrowseable(@NonNull String mediaID); static boolean isPlaylist(@NonNull String mediaId); static String getParentMediaID(@NonNull String mediaID); static boolean isMediaItemPlaying(Context context,
                                             MediaBrowserCompat.MediaItem mediaItem); static MediaDescriptionCompat getDescriptionWithRating(MediaMetadataCompat metadata); }
MediaIDHelper { public static String createMediaID(String musicID, String... categories) { StringBuilder sb = new StringBuilder(); if (categories != null) { for (int i=0; i < categories.length; i++) { if (!isValidCategory(categories[i])) { throw new IllegalArgumentException("Invalid category: " + categories[0]); } sb.append(categories[i]); if (i < categories.length - 1) { sb.append(CATEGORY_SEPARATOR); } } } if (musicID != null) { sb.append(LEAF_SEPARATOR).append(musicID); } return sb.toString(); }  static String createMediaID(String musicID, String... categories); static String extractMusicIDFromMediaID(@NonNull String mediaID); static @NonNull String[] getHierarchy(@NonNull String mediaID); static String extractBrowseCategoryValueFromMediaID(@NonNull String mediaID); static boolean isBrowseable(@NonNull String mediaID); static boolean isPlaylist(@NonNull String mediaId); static String getParentMediaID(@NonNull String mediaID); static boolean isMediaItemPlaying(Context context,
                                             MediaBrowserCompat.MediaItem mediaItem); static MediaDescriptionCompat getDescriptionWithRating(MediaMetadataCompat metadata); static final String MEDIA_ID_EMPTY_ROOT; static final String MEDIA_ID_ROOT; static final String MEDIA_ID_MUSICS_BY_GENRE; static final String MEDIA_ID_MUSICS_BY_SEARCH; static final String MEDIA_ID_PLAYLISTS; static final String MEDIA_ID_ARTIST_SONGS; static final String MEDIA_ID_ARTISTS; static final String MEDIA_ID_ALBUMS; }