mirror of
https://github.com/TeamNewPipe/NewPipe.git
synced 2024-11-25 12:32:31 +01:00
Improve code in VideoDetailFragment
This commit is contained in:
parent
7ba79171c7
commit
4863084fa2
@ -1555,13 +1555,11 @@ public final class VideoDetailFragment
|
|||||||
binding.detailSubChannelThumbnailView.setImageDrawable(buddyDrawable);
|
binding.detailSubChannelThumbnailView.setImageDrawable(buddyDrawable);
|
||||||
binding.detailUploaderThumbnailView.setImageDrawable(buddyDrawable);
|
binding.detailUploaderThumbnailView.setImageDrawable(buddyDrawable);
|
||||||
|
|
||||||
final StreamType streamType = info.getStreamType();
|
|
||||||
|
|
||||||
if (info.getViewCount() >= 0) {
|
if (info.getViewCount() >= 0) {
|
||||||
if (streamType.equals(StreamType.AUDIO_LIVE_STREAM)) {
|
if (info.getStreamType().equals(StreamType.AUDIO_LIVE_STREAM)) {
|
||||||
binding.detailViewCountView.setText(Localization.listeningCount(activity,
|
binding.detailViewCountView.setText(Localization.listeningCount(activity,
|
||||||
info.getViewCount()));
|
info.getViewCount()));
|
||||||
} else if (streamType.equals(StreamType.LIVE_STREAM)) {
|
} else if (info.getStreamType().equals(StreamType.LIVE_STREAM)) {
|
||||||
binding.detailViewCountView.setText(Localization
|
binding.detailViewCountView.setText(Localization
|
||||||
.localizeWatchingCount(activity, info.getViewCount()));
|
.localizeWatchingCount(activity, info.getViewCount()));
|
||||||
} else {
|
} else {
|
||||||
@ -1648,7 +1646,7 @@ public final class VideoDetailFragment
|
|||||||
}
|
}
|
||||||
|
|
||||||
binding.detailControlsDownload.setVisibility(
|
binding.detailControlsDownload.setVisibility(
|
||||||
StreamTypeUtil.isLiveStream(streamType) ? View.GONE : View.VISIBLE);
|
StreamTypeUtil.isLiveStream(info.getStreamType()) ? View.GONE : View.VISIBLE);
|
||||||
binding.detailControlsBackground.setVisibility(info.getAudioStreams().isEmpty()
|
binding.detailControlsBackground.setVisibility(info.getAudioStreams().isEmpty()
|
||||||
? View.GONE : View.VISIBLE);
|
? View.GONE : View.VISIBLE);
|
||||||
|
|
||||||
@ -2151,21 +2149,24 @@ public final class VideoDetailFragment
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<VideoStream> videoStreams = getNonUrlAndNonTorrentStreams(
|
|
||||||
currentInfo.getVideoStreams());
|
|
||||||
final List<VideoStream> videoOnlyStreams = getNonUrlAndNonTorrentStreams(
|
|
||||||
currentInfo.getVideoOnlyStreams());
|
|
||||||
|
|
||||||
final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||||
builder.setTitle(R.string.select_quality_external_players);
|
builder.setTitle(R.string.select_quality_external_players);
|
||||||
builder.setNeutralButton(R.string.open_in_browser, (dialog, i) ->
|
builder.setNeutralButton(R.string.open_in_browser, (dialog, i) ->
|
||||||
ShareUtils.openUrlInBrowser(requireActivity(), url));
|
ShareUtils.openUrlInBrowser(requireActivity(), url));
|
||||||
|
|
||||||
final List<VideoStream> videoStreamsForExternalPlayers =
|
final List<VideoStream> videoStreamsForExternalPlayers =
|
||||||
ListHelper.getSortedStreamVideosList(activity, videoStreams, videoOnlyStreams,
|
ListHelper.getSortedStreamVideosList(
|
||||||
false, false);
|
activity,
|
||||||
|
getNonUrlAndNonTorrentStreams(currentInfo.getVideoStreams()),
|
||||||
|
getNonUrlAndNonTorrentStreams(currentInfo.getVideoOnlyStreams()),
|
||||||
|
false,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
if (videoStreamsForExternalPlayers.isEmpty()) {
|
if (videoStreamsForExternalPlayers.isEmpty()) {
|
||||||
builder.setMessage(R.string.no_video_streams_available_for_external_players);
|
builder.setMessage(R.string.no_video_streams_available_for_external_players);
|
||||||
builder.setPositiveButton(R.string.ok, null);
|
builder.setPositiveButton(R.string.ok, null);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
final int selectedVideoStreamIndexForExternalPlayers =
|
final int selectedVideoStreamIndexForExternalPlayers =
|
||||||
ListHelper.getDefaultResolutionIndex(activity, videoStreamsForExternalPlayers);
|
ListHelper.getDefaultResolutionIndex(activity, videoStreamsForExternalPlayers);
|
||||||
|
Loading…
Reference in New Issue
Block a user