mirror of
				https://github.com/TeamNewPipe/NewPipe
				synced 2025-10-31 07:13:00 +00:00 
			
		
		
		
	Add ShareUtils class to share videos or open urls in browser.
This commit is contained in:
		
							
								
								
									
										22
									
								
								app/src/main/java/org/schabi/newpipe/util/ShareUtils.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								app/src/main/java/org/schabi/newpipe/util/ShareUtils.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,22 @@ | |||||||
|  | package org.schabi.newpipe.util; | ||||||
|  |  | ||||||
|  | import android.content.Context; | ||||||
|  | import android.content.Intent; | ||||||
|  | import android.net.Uri; | ||||||
|  |  | ||||||
|  | import org.schabi.newpipe.R; | ||||||
|  |  | ||||||
|  | public class ShareUtils { | ||||||
|  |     public static void openUrlInBrowser(Context context, String url) { | ||||||
|  |         Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); | ||||||
|  |         context.startActivity(Intent.createChooser(intent, context.getString(R.string.share_dialog_title))); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public static void shareUrl(Context context, String subject, String url) { | ||||||
|  |         Intent intent = new Intent(Intent.ACTION_SEND); | ||||||
|  |         intent.setType("text/plain"); | ||||||
|  |         intent.putExtra(Intent.EXTRA_SUBJECT, subject); | ||||||
|  |         intent.putExtra(Intent.EXTRA_TEXT, url); | ||||||
|  |         context.startActivity(Intent.createChooser(intent, context.getString(R.string.share_dialog_title))); | ||||||
|  |     } | ||||||
|  | } | ||||||
		Reference in New Issue
	
	Block a user
	 Stypox
					Stypox