mirror of
				https://github.com/TeamNewPipe/NewPipe
				synced 2025-10-31 07:13:00 +00:00 
			
		
		
		
	Show proper text for live streams watching/listening count
This commit is contained in:
		| @@ -1067,7 +1067,13 @@ public class VideoDetailFragment | ||||
|         uploaderThumb.setImageDrawable(ContextCompat.getDrawable(activity, R.drawable.buddy)); | ||||
|  | ||||
|         if (info.getViewCount() >= 0) { | ||||
|             videoCountView.setText(Localization.localizeViewCount(activity, info.getViewCount())); | ||||
|             if (info.getStreamType().equals(StreamType.AUDIO_LIVE_STREAM)) { | ||||
|                 videoCountView.setText(Localization.listeningCount(activity, info.getViewCount())); | ||||
|             } else if (info.getStreamType().equals(StreamType.LIVE_STREAM)) { | ||||
|                 videoCountView.setText(Localization.watchingCount(activity, info.getViewCount())); | ||||
|             } else { | ||||
|                 videoCountView.setText(Localization.localizeViewCount(activity, info.getViewCount())); | ||||
|             } | ||||
|             videoCountView.setVisibility(View.VISIBLE); | ||||
|         } else { | ||||
|             videoCountView.setVisibility(View.GONE); | ||||
|   | ||||
| @@ -7,6 +7,7 @@ import android.widget.TextView; | ||||
| import org.schabi.newpipe.R; | ||||
| import org.schabi.newpipe.extractor.InfoItem; | ||||
| import org.schabi.newpipe.extractor.stream.StreamInfoItem; | ||||
| import org.schabi.newpipe.extractor.stream.StreamType; | ||||
| import org.schabi.newpipe.info_list.InfoItemBuilder; | ||||
| import org.schabi.newpipe.local.history.HistoryRecordManager; | ||||
| import org.schabi.newpipe.util.Localization; | ||||
| @@ -53,7 +54,13 @@ public class StreamInfoItemHolder extends StreamMiniInfoItemHolder { | ||||
|     private String getStreamInfoDetailLine(final StreamInfoItem infoItem) { | ||||
|         String viewsAndDate = ""; | ||||
|         if (infoItem.getViewCount() >= 0) { | ||||
|             viewsAndDate = Localization.shortViewCount(itemBuilder.getContext(), infoItem.getViewCount()); | ||||
|             if (infoItem.getStreamType().equals(StreamType.AUDIO_LIVE_STREAM)) { | ||||
|                 viewsAndDate = Localization.listeningCount(itemBuilder.getContext(), infoItem.getViewCount()); | ||||
|             } else if (infoItem.getStreamType().equals(StreamType.LIVE_STREAM)) { | ||||
|                 viewsAndDate = Localization.watchingCount(itemBuilder.getContext(), infoItem.getViewCount()); | ||||
|             } else { | ||||
|                 viewsAndDate = Localization.shortViewCount(itemBuilder.getContext(), infoItem.getViewCount()); | ||||
|             } | ||||
|         } | ||||
|         if (!TextUtils.isEmpty(infoItem.getTextualUploadDate())) { | ||||
|             if (viewsAndDate.isEmpty()) { | ||||
|   | ||||
| @@ -141,6 +141,14 @@ public class Localization { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public static String listeningCount(Context context, long listeningCount) { | ||||
|         return getQuantity(context, R.plurals.listening, R.string.no_one_listening, listeningCount, shortCount(context, listeningCount)); | ||||
|     } | ||||
|  | ||||
|     public static String watchingCount(Context context, long watchingCount) { | ||||
|         return getQuantity(context, R.plurals.watching, R.string.no_one_watching, watchingCount, shortCount(context, watchingCount)); | ||||
|     } | ||||
|  | ||||
|     public static String shortViewCount(Context context, long viewCount) { | ||||
|         return getQuantity(context, R.plurals.views, R.string.no_views, viewCount, shortCount(context, viewCount)); | ||||
|     } | ||||
|   | ||||
| @@ -263,6 +263,19 @@ | ||||
|         <item quantity="one">%s view</item> | ||||
|         <item quantity="other">%s views</item> | ||||
|     </plurals> | ||||
|  | ||||
|     <string name="no_one_watching">No one is watching</string> | ||||
|     <plurals name="watching"> | ||||
|         <item quantity="one">%s watching</item> | ||||
|         <item quantity="other">%s watching</item> | ||||
|     </plurals> | ||||
|  | ||||
|     <string name="no_one_listening">No one is listening</string> | ||||
|     <plurals name="listening"> | ||||
|         <item quantity="one">%s listener</item> | ||||
|         <item quantity="other">%s listeners</item> | ||||
|     </plurals> | ||||
|  | ||||
|     <string name="no_videos">No videos</string> | ||||
|     <plurals name="videos"> | ||||
|         <item quantity="one">%s video</item> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Mauricio Colli
					Mauricio Colli