Use "mini" stream count alternatives for info items

Note: more_than_100_videos_mini and infinite_videos_mini are untranslatable
This commit is contained in:
Stypox 2020-03-20 21:43:17 +01:00 committed by wb9688
parent 2b47a1b06a
commit 914d3c4a66
5 changed files with 23 additions and 9 deletions

View File

@ -43,7 +43,7 @@ public class PlaylistMiniInfoItemHolder extends InfoItemHolder {
itemTitleView.setText(item.getName());
itemStreamCountView.setText(Localization
.localizeStreamCount(itemStreamCountView.getContext(), item.getStreamCount()));
.localizeStreamCountMini(itemStreamCountView.getContext(), item.getStreamCount()));
itemUploaderView.setText(item.getUploaderName());
itemBuilder.getImageLoader()

View File

@ -32,8 +32,8 @@ public class LocalPlaylistItemHolder extends PlaylistItemHolder {
final PlaylistMetadataEntry item = (PlaylistMetadataEntry) localItem;
itemTitleView.setText(item.name);
itemStreamCountView.setText(Localization.localizeStreamCount(itemStreamCountView.getContext(),
item.streamCount));
itemStreamCountView.setText(Localization.localizeStreamCountMini(
itemStreamCountView.getContext(), item.streamCount));
itemUploaderView.setVisibility(View.INVISIBLE);
itemBuilder.displayImage(item.thumbnailUrl, itemThumbnailView,

View File

@ -34,8 +34,8 @@ public class RemotePlaylistItemHolder extends PlaylistItemHolder {
final PlaylistRemoteEntity item = (PlaylistRemoteEntity) localItem;
itemTitleView.setText(item.getName());
itemStreamCountView.setText(Localization.localizeStreamCount(itemStreamCountView.getContext(),
item.getStreamCount()));
itemStreamCountView.setText(Localization.localizeStreamCountMini(
itemStreamCountView.getContext(), item.getStreamCount()));
// Here is where the uploader name is set in the bookmarked playlists library
if (!TextUtils.isEmpty(item.getUploader())) {
itemUploaderView.setText(Localization.concatenateStrings(item.getUploader(),

View File

@ -8,6 +8,7 @@ import android.content.res.Resources;
import android.preference.PreferenceManager;
import org.schabi.newpipe.extractor.ListExtractor;
import android.text.TextUtils;
import android.util.DisplayMetrics;
@ -155,15 +156,26 @@ public final class Localization {
public static String localizeStreamCount(final Context context, final long streamCount) {
switch ((int) streamCount) {
case (int) ListExtractor.ITEM_COUNT_MORE_THAN_100:
return context.getResources().getString(R.string.playlist_more_than_100_items);
return context.getResources().getString(R.string.more_than_100_videos);
case (int) ListExtractor.ITEM_COUNT_INFINITE:
return context.getResources().getString(R.string.playlist_infinite_items);
return context.getResources().getString(R.string.infinite_videos);
default:
return getQuantity(context, R.plurals.videos, R.string.no_videos, streamCount,
localizeNumber(context, streamCount));
}
}
public static String localizeStreamCountMini(final Context context, final long streamCount) {
switch ((int) streamCount) {
case (int) ListExtractor.ITEM_COUNT_MORE_THAN_100:
return context.getResources().getString(R.string.more_than_100_videos_mini);
case (int) ListExtractor.ITEM_COUNT_INFINITE:
return context.getResources().getString(R.string.infinite_videos_mini);
default:
return String.valueOf(streamCount);
}
}
public static String localizeWatchingCount(final Context context, final long watchingCount) {
return getQuantity(context, R.plurals.watching, R.string.no_one_watching, watchingCount,
localizeNumber(context, watchingCount));

View File

@ -284,6 +284,10 @@
<item quantity="other">%s listeners</item>
</plurals>
<string name="no_videos">No videos</string>
<string name="more_than_100_videos">100+ videos</string>
<string name="infinite_videos">∞ videos</string>
<string name="more_than_100_videos_mini" translatable="false">100+</string>
<string name="infinite_videos_mini" translatable="false"></string>
<plurals name="videos">
<item quantity="one">%s video</item>
<item quantity="other">%s videos</item>
@ -458,8 +462,6 @@
<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>
<string name="playlist_infinite_items">∞ videos</string>
<!-- Players -->
<string name="caption_none">No Captions</string>
<string name="resize_fit">Fit</string>