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 9292import org .schabi .newpipe .views .LargeTextMovementMethod ;
9393
9494import java .io .Serializable ;
95+ import java .util .ArrayList ;
9596import java .util .Collection ;
9697import java .util .LinkedList ;
9798import java .util .List ;
@@ -694,6 +695,26 @@ public boolean onOptionsItemSelected(final MenuItem item) {
694695 currentInfo .getOriginalUrl ());
695696 }
696697 return true ;
698+ case R .id .menu_item_share_stream :
699+ if (currentInfo == null ) {
700+ return true ;
701+ }
702+ final Context context = requireContext ();
703+ ArrayList <VideoStream > videoStreamsList = new ArrayList <>(
704+ ListHelper .getSortedStreamVideosList (context , currentInfo .getVideoStreams (),
705+ null , false ));
706+ int index = ListHelper .getDefaultResolutionIndex (context , videoStreamsList );
707+
708+ if (index == -1 ) {
709+ Toast .makeText (context , R .string .video_streams_empty , Toast .LENGTH_SHORT )
710+ .show ();
711+ return true ;
712+ }
713+
714+ VideoStream videoStream = videoStreamsList .get (index );
715+
716+ ShareUtils .shareUrl (context , currentInfo .getName (), videoStream .getUrl ());
717+ return true ;
697718 case R .id .menu_item_openInBrowser :
698719 if (currentInfo != null ) {
699720 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