Detect ITEM_COUNT_* in localizeStreamCount()

ITEM_COUNT_INFINITE and ITEM_COUNT_MORE_THAN_100.
Use localizeStreamCount in PlaylistFragment and PlaylistItemHolder
This commit is contained in:
Stypox 2020-03-20 20:57:56 +01:00 committed by wb9688
parent f8f035275a
commit 95d3550aed
4 changed files with 18 additions and 14 deletions

View file

@ -27,7 +27,6 @@ import org.schabi.newpipe.extractor.InfoItem;
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;
@ -40,6 +39,7 @@ import org.schabi.newpipe.report.ErrorActivity;
import org.schabi.newpipe.report.UserAction;
import org.schabi.newpipe.util.ExtractorHelper;
import org.schabi.newpipe.util.ImageDisplayConstants;
import org.schabi.newpipe.util.Localization;
import org.schabi.newpipe.util.NavigationHelper;
import org.schabi.newpipe.util.ShareUtils;
import org.schabi.newpipe.util.StreamDialogEntry;
@ -303,15 +303,8 @@ public class PlaylistFragment extends BaseListInfoFragment<PlaylistInfo> {
IMAGE_LOADER.displayImage(result.getUploaderAvatarUrl(), headerUploaderAvatar,
ImageDisplayConstants.DISPLAY_AVATAR_OPTIONS);
int streamCount = (int) result.getStreamCount();
if (streamCount == PlaylistExtractor.MORE_THAN_100_ITEMS) {
headerStreamCount.setText(getResources().getString(R.string.playlist_more_than_100_items));
} else if (streamCount == PlaylistExtractor.INFINITE_ITEMS) {
headerStreamCount.setText(getResources().getString(R.string.playlist_infinite_items));
} else {
headerStreamCount.setText(getResources().getQuantityString(R.plurals.videos, streamCount, streamCount));
}
headerStreamCount.setText(Localization
.localizeStreamCount(getContext(), result.getStreamCount()));
if (!result.getErrors().isEmpty()) {
showSnackBarError(result.getErrors(), UserAction.REQUESTED_PLAYLIST,