Skip to content

Commit

Permalink
Add support for MORE_THAN_100_ITEMS in playlists
Browse files Browse the repository at this point in the history
  • Loading branch information
Stypox committed Mar 17, 2020
1 parent ce15697 commit 8734abf
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ dependencies {
exclude module: 'support-annotations'
})

implementation 'com.github.TeamNewPipe:NewPipeExtractor:65a7eda'
implementation 'com.github.XiangRongLin:NewPipeExtractor:90b9682f93d7dbb94a387b55095ace3e7b1f40ad'
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:2.23.0'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.schabi.newpipe.extractor.ListExtractor;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.extractor.playlist.PlaylistExtractor;
import org.schabi.newpipe.extractor.playlist.PlaylistInfo;
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
import org.schabi.newpipe.extractor.stream.StreamType;
Expand Down Expand Up @@ -284,8 +285,13 @@ public void handleResult(@NonNull final PlaylistInfo result) {

imageLoader.displayImage(result.getUploaderAvatarUrl(), headerUploaderAvatar,
ImageDisplayConstants.DISPLAY_AVATAR_OPTIONS);
headerStreamCount.setText(getResources().getQuantityString(R.plurals.videos,
(int) result.getStreamCount(), (int) result.getStreamCount()));

int streamCount = (int) result.getStreamCount();
if (streamCount == PlaylistExtractor.MORE_THAN_100_ITEMS) {
headerStreamCount.setText(getResources().getString(R.string.playlist_more_than_100_items));
} else {
headerStreamCount.setText(getResources().getQuantityString(R.plurals.videos, streamCount, streamCount));
}

if (!result.getErrors().isEmpty()) {
showSnackBarError(result.getErrors(), UserAction.REQUESTED_PLAYLIST, NewPipe.getNameOfService(result.getServiceId()), result.getUrl(), 0);
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,7 @@
<string name="playlist_thumbnail_change_success">Playlist thumbnail changed.</string>
<string name="playlist_delete_failure">Could not delete playlist.</string>
<string name="playlist_no_uploader">Auto-generated (no uploader found)</string>
<string name="playlist_more_than_100_items">100+ videos</string>
<!-- Players -->
<string name="caption_none">No Captions</string>
<string name="resize_fit">Fit</string>
Expand Down

0 comments on commit 8734abf

Please sign in to comment.