mirror of
				https://github.com/TeamNewPipe/NewPipe
				synced 2025-10-31 15:23:00 +00:00 
			
		
		
		
	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:
		| @@ -43,7 +43,7 @@ public class PlaylistMiniInfoItemHolder extends InfoItemHolder { | |||||||
|  |  | ||||||
|         itemTitleView.setText(item.getName()); |         itemTitleView.setText(item.getName()); | ||||||
|         itemStreamCountView.setText(Localization |         itemStreamCountView.setText(Localization | ||||||
|                 .localizeStreamCount(itemStreamCountView.getContext(), item.getStreamCount())); |                 .localizeStreamCountMini(itemStreamCountView.getContext(), item.getStreamCount())); | ||||||
|         itemUploaderView.setText(item.getUploaderName()); |         itemUploaderView.setText(item.getUploaderName()); | ||||||
|  |  | ||||||
|         itemBuilder.getImageLoader() |         itemBuilder.getImageLoader() | ||||||
|   | |||||||
| @@ -32,8 +32,8 @@ public class LocalPlaylistItemHolder extends PlaylistItemHolder { | |||||||
|         final PlaylistMetadataEntry item = (PlaylistMetadataEntry) localItem; |         final PlaylistMetadataEntry item = (PlaylistMetadataEntry) localItem; | ||||||
|  |  | ||||||
|         itemTitleView.setText(item.name); |         itemTitleView.setText(item.name); | ||||||
|         itemStreamCountView.setText(Localization.localizeStreamCount(itemStreamCountView.getContext(), |         itemStreamCountView.setText(Localization.localizeStreamCountMini( | ||||||
|                 item.streamCount)); |                 itemStreamCountView.getContext(), item.streamCount)); | ||||||
|         itemUploaderView.setVisibility(View.INVISIBLE); |         itemUploaderView.setVisibility(View.INVISIBLE); | ||||||
|  |  | ||||||
|         itemBuilder.displayImage(item.thumbnailUrl, itemThumbnailView, |         itemBuilder.displayImage(item.thumbnailUrl, itemThumbnailView, | ||||||
|   | |||||||
| @@ -34,8 +34,8 @@ public class RemotePlaylistItemHolder extends PlaylistItemHolder { | |||||||
|         final PlaylistRemoteEntity item = (PlaylistRemoteEntity) localItem; |         final PlaylistRemoteEntity item = (PlaylistRemoteEntity) localItem; | ||||||
|  |  | ||||||
|         itemTitleView.setText(item.getName()); |         itemTitleView.setText(item.getName()); | ||||||
|         itemStreamCountView.setText(Localization.localizeStreamCount(itemStreamCountView.getContext(), |         itemStreamCountView.setText(Localization.localizeStreamCountMini( | ||||||
|                 item.getStreamCount())); |                 itemStreamCountView.getContext(), item.getStreamCount())); | ||||||
|         // Here is where the uploader name is set in the bookmarked playlists library |         // Here is where the uploader name is set in the bookmarked playlists library | ||||||
|         if (!TextUtils.isEmpty(item.getUploader())) { |         if (!TextUtils.isEmpty(item.getUploader())) { | ||||||
|             itemUploaderView.setText(Localization.concatenateStrings(item.getUploader(), |             itemUploaderView.setText(Localization.concatenateStrings(item.getUploader(), | ||||||
|   | |||||||
| @@ -8,6 +8,7 @@ import android.content.res.Resources; | |||||||
| import android.preference.PreferenceManager; | import android.preference.PreferenceManager; | ||||||
|  |  | ||||||
| import org.schabi.newpipe.extractor.ListExtractor; | import org.schabi.newpipe.extractor.ListExtractor; | ||||||
|  |  | ||||||
| import android.text.TextUtils; | import android.text.TextUtils; | ||||||
| import android.util.DisplayMetrics; | import android.util.DisplayMetrics; | ||||||
|  |  | ||||||
| @@ -155,15 +156,26 @@ public final class Localization { | |||||||
|     public static String localizeStreamCount(final Context context, final long streamCount) { |     public static String localizeStreamCount(final Context context, final long streamCount) { | ||||||
|         switch ((int) streamCount) { |         switch ((int) streamCount) { | ||||||
|             case (int) ListExtractor.ITEM_COUNT_MORE_THAN_100: |             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: |             case (int) ListExtractor.ITEM_COUNT_INFINITE: | ||||||
|                 return context.getResources().getString(R.string.playlist_infinite_items); |                 return context.getResources().getString(R.string.infinite_videos); | ||||||
|             default: |             default: | ||||||
|                 return getQuantity(context, R.plurals.videos, R.string.no_videos, streamCount, |                 return getQuantity(context, R.plurals.videos, R.string.no_videos, streamCount, | ||||||
|                         localizeNumber(context, 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) { |     public static String localizeWatchingCount(final Context context, final long watchingCount) { | ||||||
|         return getQuantity(context, R.plurals.watching, R.string.no_one_watching, watchingCount, |         return getQuantity(context, R.plurals.watching, R.string.no_one_watching, watchingCount, | ||||||
|                 localizeNumber(context, watchingCount)); |                 localizeNumber(context, watchingCount)); | ||||||
|   | |||||||
| @@ -284,6 +284,10 @@ | |||||||
|         <item quantity="other">%s listeners</item> |         <item quantity="other">%s listeners</item> | ||||||
|     </plurals> |     </plurals> | ||||||
|     <string name="no_videos">No videos</string> |     <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"> |     <plurals name="videos"> | ||||||
|         <item quantity="one">%s video</item> |         <item quantity="one">%s video</item> | ||||||
|         <item quantity="other">%s videos</item> |         <item quantity="other">%s videos</item> | ||||||
| @@ -458,8 +462,6 @@ | |||||||
|     <string name="playlist_thumbnail_change_success">Playlist thumbnail changed.</string> |     <string name="playlist_thumbnail_change_success">Playlist thumbnail changed.</string> | ||||||
|     <string name="playlist_delete_failure">Could not delete playlist.</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_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 --> |     <!-- Players --> | ||||||
|     <string name="caption_none">No Captions</string> |     <string name="caption_none">No Captions</string> | ||||||
|     <string name="resize_fit">Fit</string> |     <string name="resize_fit">Fit</string> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Stypox
					Stypox