|
88 | 88 | import org.schabi.newpipe.views.AnimatedProgressBar; |
89 | 89 |
|
90 | 90 | import java.io.Serializable; |
91 | | -import java.util.ArrayList; |
92 | 91 | import java.util.Collection; |
93 | 92 | import java.util.LinkedList; |
94 | 93 | import java.util.List; |
@@ -645,24 +644,13 @@ public boolean onOptionsItemSelected(final MenuItem item) { |
645 | 644 | } |
646 | 645 | return true; |
647 | 646 | case R.id.menu_item_share_stream: |
648 | | - if (currentInfo == null) { |
649 | | - return true; |
650 | | - } |
651 | | - final Context context = requireContext(); |
652 | | - ArrayList<VideoStream> videoStreamsList = new ArrayList<>( |
653 | | - ListHelper.getSortedStreamVideosList(context, currentInfo.getVideoStreams(), |
654 | | - null, false)); |
655 | | - int index = ListHelper.getDefaultResolutionIndex(context, videoStreamsList); |
656 | | - |
657 | | - if (index == -1) { |
658 | | - Toast.makeText(context, R.string.video_streams_empty, Toast.LENGTH_SHORT) |
659 | | - .show(); |
660 | | - return true; |
| 647 | + if (currentInfo != null) { |
| 648 | + VideoStream selectedVideoStream = getSelectedVideoStream(); |
| 649 | + if (selectedVideoStream != null) { |
| 650 | + ShareUtils.shareUrl(requireContext(), currentInfo.getName(), |
| 651 | + selectedVideoStream.getUrl()); |
| 652 | + } |
661 | 653 | } |
662 | | - |
663 | | - VideoStream videoStream = videoStreamsList.get(index); |
664 | | - |
665 | | - ShareUtils.shareUrl(context, currentInfo.getName(), videoStream.getUrl()); |
666 | 654 | return true; |
667 | 655 | case R.id.menu_item_openInBrowser: |
668 | 656 | if (currentInfo != null) { |
|
0 commit comments