File tree Expand file tree Collapse file tree
java/org/schabi/newpipe/fragments/detail Expand file tree Collapse file tree Original file line number Diff line number Diff line change 8888import org .schabi .newpipe .views .AnimatedProgressBar ;
8989
9090import java .io .Serializable ;
91+ import java .util .ArrayList ;
9192import java .util .Collection ;
9293import java .util .LinkedList ;
9394import java .util .List ;
@@ -643,6 +644,26 @@ public boolean onOptionsItemSelected(final MenuItem item) {
643644 currentInfo .getOriginalUrl ());
644645 }
645646 return true ;
647+ 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 ;
661+ }
662+
663+ VideoStream videoStream = videoStreamsList .get (index );
664+
665+ ShareUtils .shareUrl (context , currentInfo .getName (), videoStream .getUrl ());
666+ return true ;
646667 case R .id .menu_item_openInBrowser :
647668 if (currentInfo != null ) {
648669 ShareUtils .openUrlInBrowser (requireContext (), currentInfo .getOriginalUrl ());
Original file line number Diff line number Diff line change 1414 android : title =" @string/share"
1515 app : showAsAction =" ifRoom" />
1616
17+ <item
18+ android : id =" @+id/menu_item_share_stream"
19+ android : icon =" ?attr/share"
20+ android : title =" @string/share_stream"
21+ app : showAsAction =" ifRoom" />
22+
1723 <item
1824 android : id =" @+id/action_settings"
1925 android : orderInCategory =" 1"
Original file line number Diff line number Diff line change 1111 <string name =" open_in_browser" >Open in browser</string >
1212 <string name =" open_in_popup_mode" >Open in popup mode</string >
1313 <string name =" share" >Share</string >
14+ <string name =" share_stream" >Share Stream</string >
1415 <string name =" download" >Download</string >
1516 <string name =" controls_download_desc" >Download stream file</string >
1617 <string name =" search" >Search</string >
You can’t perform that action at this time.
0 commit comments