mirror of
https://github.com/TeamNewPipe/NewPipe.git
synced 2024-11-25 04:22:30 +01:00
Show proper text for live streams watching/listening count
This commit is contained in:
parent
71f1bbdcc1
commit
6e546703a9
@ -1067,7 +1067,13 @@ public class VideoDetailFragment
|
||||
uploaderThumb.setImageDrawable(ContextCompat.getDrawable(activity, R.drawable.buddy));
|
||||
|
||||
if (info.getViewCount() >= 0) {
|
||||
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,8 +54,14 @@ public class StreamInfoItemHolder extends StreamMiniInfoItemHolder {
|
||||
private String getStreamInfoDetailLine(final StreamInfoItem infoItem) {
|
||||
String viewsAndDate = "";
|
||||
if (infoItem.getViewCount() >= 0) {
|
||||
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()) {
|
||||
viewsAndDate = infoItem.getTextualUploadDate();
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user