package net.elprespufferfish.rssreader;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.widget.TextView;

public class ArticleFragment extends Fragment {

    public static String TITLE_KEY = "title";
    public static String LINK_KEY = "link";
    public static String DESCRIPTION_KEY = "description";

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.article_fragment, container, false);
        Bundle arguments = getArguments();

        ((TextView) view.findViewById(R.id.title)).setText(arguments.getString(TITLE_KEY));

        ((TextView) view.findViewById(R.id.link)).setText(arguments.getString(LINK_KEY));

        WebView webView = (WebView) view.findViewById(R.id.description);
        webView.setWebChromeClient(new WebChromeClient()); // HTML5 video requires a WebChromeClient
        enableJavaScript(webView);
        webView.loadData(arguments.getString(DESCRIPTION_KEY), "text/html", null);

        return view;
    }

    /* JavaScript is required to play youtube videos */
    @SuppressLint("SetJavaScriptEnabled")
    private void enableJavaScript(WebView webView) {
        webView.getSettings().setJavaScriptEnabled(true);
    }

}

@@ -70,24 +70,79 @@
 ppressLint;%0A
+import android.content.Intent;%0Aimport android.net.Uri;%0A
 import andro
@@ -155,16 +155,16 @@
 Bundle;%0A
-
 import a
@@ -253,24 +253,66 @@
 .view.View;%0A
+import android.view.View.OnClickListener;%0A
 import andro
@@ -969,33 +969,48 @@
 KEY));%0A%0A        
-(
+TextView link = 
 (TextView) view.
@@ -1036,47 +1036,435 @@
 ink)
-).setText(arguments.getString(LINK_KEY)
+;%0A        final String linkAddress = arguments.getString(LINK_KEY);%0A        link.setText(linkAddress);%0A        link.setClickable(true);%0A        link.setOnClickListener(new OnClickListener() %7B%0A            @Override%0A            public void onClick(View v) %7B%0A                Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(linkAddress));%0A                ArticleFragment.this.startActivity(intent);%0A            %7D%0A        %7D
 );%0A%0A

Make URLs clickable