package io.dwak.holohackernews.app.util;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;

public final class IntentUtils {
    public static void openInBrowser(final Context context, final String uri){
        Intent browserIntent = new Intent();
        browserIntent.setAction(Intent.ACTION_VIEW);
        browserIntent.setData(Uri.parse(uri));
        context.startActivity(browserIntent);
    }

    public static void share(final Context context, final String text){
        share(context, text, "text/plain");
    }

    public static void share(final Context context, final String text, final String type){
        Intent shareIntent = new Intent();
        shareIntent.setAction(Intent.ACTION_SEND);
        shareIntent.setType(type);
        shareIntent.putExtra(Intent.EXTRA_TEXT, text);
        context.startActivity(shareIntent);
    }
}

@@ -156,16 +156,223 @@
 Utils %7B%0A
+    /**%0A     * Opens the given url in the system browser%0A     * @param context Context with which to open the browser from%0A     * @param uri Url to open in the browser%0A     * @see Intent#ACTION_VIEW%0A     */%0A
     publ
@@ -648,126 +648,176 @@
     
-public static void share(final C
+/**%0A     * Share plain text using system share%0A     * @param c
 ontext 
-c
+C
 ontext
-, final Str
+ to share from%0A     * @param text pla
 in
-g
  text
-)%7B%0A        share(context, text, %22text/plain%22);
+ to share%0A     * @see Intent#ACTION_SEND
 %0A    
-%7D%0A
+ */
 %0A   
@@ -886,27 +886,8 @@
 text
-, final String type
 )%7B%0A 
@@ -1011,12 +1011,20 @@
 ype(
-type
+%22text/plain%22
 );%0A 

update share in intentutils