@RequiresApi(api = Build.VERSION_CODES.M) @Test public void testProgramConversion() { RecordedProgram sampleRecordedProgram = new RecordedProgram.Builder() .setAudioLanguages("en-us") .setBroadcastGenres(new String[]{"Sports"}) .setCanonicalGenres(new String[]{TvContract.Programs.Genres.ANIMAL_WILDLIFE}) .setContentRatings(new TvContentRating[]{TvContentRating.UNRATED}) .setEpisodeTitle("Sample Episode") .setInputId(TEST_INPUT_ID) .setTitle("Sample Title") .setSearchable(false) .setStartTimeUtcMillis(0) .setEndTimeUtcMillis(1000) .setSeasonTitle("First Season") .setSeasonDisplayNumber("1", 1) .setVideoHeight(1080) .setVideoWidth(1920) .build(); Program sampleProgram = sampleRecordedProgram.toProgram(); RecordedProgram clonedSampleRecordedProgram = new RecordedProgram.Builder(sampleProgram) .setInputId(TEST_INPUT_ID) .build(); compareRecordedProgram(sampleRecordedProgram, clonedSampleRecordedProgram); }
public Program toProgram() { Program.Builder builder = new Program.Builder() .setAudioLanguages(getAudioLanguages()) .setBroadcastGenres(getBroadcastGenres()) .setCanonicalGenres(getCanonicalGenres()) .setChannelId(getChannelId()) .setContentRatings(getContentRatings()) .setDescription(getShortDescription()) .setEpisodeTitle(getEpisodeTitle()) .setLongDescription(getLongDescription()) .setPosterArtUri(getPosterArtUri()) .setVideoHeight(getVideoHeight()) .setVideoWidth(getVideoWidth()) .setSearchable(isSearchable()) .setSeasonTitle(getSeasonTitle()) .setStartTimeUtcMillis(getStartTimeUtcMillis()) .setEndTimeUtcMillis(getStartTimeUtcMillis() + getRecordingDurationMillis()) .setThumbnailUri(getThumbnailUri()) .setTitle(getTitle()) .setInternalProviderData(getInternalProviderData()); if (getEpisodeDisplayNumber() != null) { builder.setEpisodeNumber( getEpisodeDisplayNumber(), Integer.parseInt(getEpisodeDisplayNumber())); } if (getSeasonDisplayNumber() != null) { builder.setSeasonNumber( getSeasonDisplayNumber(), Integer.parseInt(getSeasonDisplayNumber())); } return builder.build(); }
RecordedProgram { public Program toProgram() { Program.Builder builder = new Program.Builder() .setAudioLanguages(getAudioLanguages()) .setBroadcastGenres(getBroadcastGenres()) .setCanonicalGenres(getCanonicalGenres()) .setChannelId(getChannelId()) .setContentRatings(getContentRatings()) .setDescription(getShortDescription()) .setEpisodeTitle(getEpisodeTitle()) .setLongDescription(getLongDescription()) .setPosterArtUri(getPosterArtUri()) .setVideoHeight(getVideoHeight()) .setVideoWidth(getVideoWidth()) .setSearchable(isSearchable()) .setSeasonTitle(getSeasonTitle()) .setStartTimeUtcMillis(getStartTimeUtcMillis()) .setEndTimeUtcMillis(getStartTimeUtcMillis() + getRecordingDurationMillis()) .setThumbnailUri(getThumbnailUri()) .setTitle(getTitle()) .setInternalProviderData(getInternalProviderData()); if (getEpisodeDisplayNumber() != null) { builder.setEpisodeNumber( getEpisodeDisplayNumber(), Integer.parseInt(getEpisodeDisplayNumber())); } if (getSeasonDisplayNumber() != null) { builder.setSeasonNumber( getSeasonDisplayNumber(), Integer.parseInt(getSeasonDisplayNumber())); } return builder.build(); } }
RecordedProgram { public Program toProgram() { Program.Builder builder = new Program.Builder() .setAudioLanguages(getAudioLanguages()) .setBroadcastGenres(getBroadcastGenres()) .setCanonicalGenres(getCanonicalGenres()) .setChannelId(getChannelId()) .setContentRatings(getContentRatings()) .setDescription(getShortDescription()) .setEpisodeTitle(getEpisodeTitle()) .setLongDescription(getLongDescription()) .setPosterArtUri(getPosterArtUri()) .setVideoHeight(getVideoHeight()) .setVideoWidth(getVideoWidth()) .setSearchable(isSearchable()) .setSeasonTitle(getSeasonTitle()) .setStartTimeUtcMillis(getStartTimeUtcMillis()) .setEndTimeUtcMillis(getStartTimeUtcMillis() + getRecordingDurationMillis()) .setThumbnailUri(getThumbnailUri()) .setTitle(getTitle()) .setInternalProviderData(getInternalProviderData()); if (getEpisodeDisplayNumber() != null) { builder.setEpisodeNumber( getEpisodeDisplayNumber(), Integer.parseInt(getEpisodeDisplayNumber())); } if (getSeasonDisplayNumber() != null) { builder.setSeasonNumber( getSeasonDisplayNumber(), Integer.parseInt(getSeasonDisplayNumber())); } return builder.build(); } private  RecordedProgram(); }
RecordedProgram { public Program toProgram() { Program.Builder builder = new Program.Builder() .setAudioLanguages(getAudioLanguages()) .setBroadcastGenres(getBroadcastGenres()) .setCanonicalGenres(getCanonicalGenres()) .setChannelId(getChannelId()) .setContentRatings(getContentRatings()) .setDescription(getShortDescription()) .setEpisodeTitle(getEpisodeTitle()) .setLongDescription(getLongDescription()) .setPosterArtUri(getPosterArtUri()) .setVideoHeight(getVideoHeight()) .setVideoWidth(getVideoWidth()) .setSearchable(isSearchable()) .setSeasonTitle(getSeasonTitle()) .setStartTimeUtcMillis(getStartTimeUtcMillis()) .setEndTimeUtcMillis(getStartTimeUtcMillis() + getRecordingDurationMillis()) .setThumbnailUri(getThumbnailUri()) .setTitle(getTitle()) .setInternalProviderData(getInternalProviderData()); if (getEpisodeDisplayNumber() != null) { builder.setEpisodeNumber( getEpisodeDisplayNumber(), Integer.parseInt(getEpisodeDisplayNumber())); } if (getSeasonDisplayNumber() != null) { builder.setSeasonNumber( getSeasonDisplayNumber(), Integer.parseInt(getSeasonDisplayNumber())); } return builder.build(); } private  RecordedProgram(); String getAudioLanguages(); String[] getBroadcastGenres(); String[] getCanonicalGenres(); long getChannelId(); TvContentRating[] getContentRatings(); String getEpisodeDisplayNumber(); String getEpisodeTitle(); int getId(); String getInputId(); InternalProviderData getInternalProviderData(); String getLongDescription(); String getPosterArtUri(); boolean isSearchable(); long getRecordingDataBytes(); String getRecordingDataUri(); long getRecordingDurationMillis(); long getRecordingExpireTimeUtcMillis(); String getSeasonDisplayNumber(); String getSeasonTitle(); String getShortDescription(); long getStartTimeUtcMillis(); long getEndTimeUtcMillis(); String getThumbnailUri(); String getTitle(); int getVersionNumber(); int getVideoHeight(); int getVideoWidth(); @Override boolean equals(Object obj); @Override int hashCode(); Program toProgram(); ContentValues toContentValues(); static RecordedProgram fromCursor(Cursor cursor); }
RecordedProgram { public Program toProgram() { Program.Builder builder = new Program.Builder() .setAudioLanguages(getAudioLanguages()) .setBroadcastGenres(getBroadcastGenres()) .setCanonicalGenres(getCanonicalGenres()) .setChannelId(getChannelId()) .setContentRatings(getContentRatings()) .setDescription(getShortDescription()) .setEpisodeTitle(getEpisodeTitle()) .setLongDescription(getLongDescription()) .setPosterArtUri(getPosterArtUri()) .setVideoHeight(getVideoHeight()) .setVideoWidth(getVideoWidth()) .setSearchable(isSearchable()) .setSeasonTitle(getSeasonTitle()) .setStartTimeUtcMillis(getStartTimeUtcMillis()) .setEndTimeUtcMillis(getStartTimeUtcMillis() + getRecordingDurationMillis()) .setThumbnailUri(getThumbnailUri()) .setTitle(getTitle()) .setInternalProviderData(getInternalProviderData()); if (getEpisodeDisplayNumber() != null) { builder.setEpisodeNumber( getEpisodeDisplayNumber(), Integer.parseInt(getEpisodeDisplayNumber())); } if (getSeasonDisplayNumber() != null) { builder.setSeasonNumber( getSeasonDisplayNumber(), Integer.parseInt(getSeasonDisplayNumber())); } return builder.build(); } private  RecordedProgram(); String getAudioLanguages(); String[] getBroadcastGenres(); String[] getCanonicalGenres(); long getChannelId(); TvContentRating[] getContentRatings(); String getEpisodeDisplayNumber(); String getEpisodeTitle(); int getId(); String getInputId(); InternalProviderData getInternalProviderData(); String getLongDescription(); String getPosterArtUri(); boolean isSearchable(); long getRecordingDataBytes(); String getRecordingDataUri(); long getRecordingDurationMillis(); long getRecordingExpireTimeUtcMillis(); String getSeasonDisplayNumber(); String getSeasonTitle(); String getShortDescription(); long getStartTimeUtcMillis(); long getEndTimeUtcMillis(); String getThumbnailUri(); String getTitle(); int getVersionNumber(); int getVideoHeight(); int getVideoWidth(); @Override boolean equals(Object obj); @Override int hashCode(); Program toProgram(); ContentValues toContentValues(); static RecordedProgram fromCursor(Cursor cursor); static final String[] PROJECTION; }