package mozilla.org.webmaker.fragment;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;

import mozilla.org.webmaker.R;
import mozilla.org.webmaker.view.WebmakerWebView;

@SuppressLint("SetJavaScriptEnabled")
public class WebviewFragment extends Fragment {

    /**
     * The fragment argument representing the section number for this fragment.
     */
    private static final String ARG_SECTION_NUMBER = "section_number";
    private WebmakerWebView mWebView = null;

    /**
     * Returns a new instance of this fragment for the given section number.
     */
    public static WebviewFragment newInstance(int sectionNumber) {
        WebviewFragment fragment = new WebviewFragment();
        Bundle args = new Bundle();
        args.putInt(ARG_SECTION_NUMBER, sectionNumber);
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View mView = inflater.inflate(R.layout.fragment_main, container, false);
        String sectionId = Integer.toString(super.getArguments().getInt(ARG_SECTION_NUMBER));
        String pageId = null;

        // Assign page by sectionId
        switch (sectionId) {
            case "1":
                pageId = "discover";
                break;
            case "2":
                pageId = "make";
                break;
        }

        // Create webview
        mWebView = new WebmakerWebView(mView.getContext(), (Activity) mView.getContext(), pageId);
        RelativeLayout layout = (RelativeLayout)mView.findViewById(R.id.webview_fragment);
        layout.addView(mWebView);
        return mView;
    }

    @Override
    public void onDestroyView() {
        if (mWebView == null) return;
        mWebView = null;
        super.onDestroyView();
    }
}
@@ -37,48 +37,8 @@
 t;%0A%0A
-import android.annotation.SuppressLint;%0A
 impo
@@ -335,46 +335,8 @@
 w;%0A%0A
-@SuppressLint(%22SetJavaScriptEnabled%22)%0A
 publ
@@ -964,32 +964,120 @@
 ragment;%0A    %7D%0A%0A
+    /**%0A     * Called to have the fragment instantiate its user interface view.%0A     */%0A
     @Override%0A  
@@ -1624,34 +1624,8 @@
  %7D%0A%0A
-        // Create webview%0A
     
@@ -1767,16 +1767,17 @@
 eLayout)
+ 
 mView.fi
@@ -1870,24 +1870,211 @@
 iew;%0A    %7D%0A%0A
+    /**%0A     * Called when the view previously created by %7B@link android.app.Fragment#onCreateView(LayoutInflater, ViewGroup, Bundle)%7D%0A     * has been detached from the fragment.%0A     */%0A
     @Overrid
@@ -2134,32 +2134,16 @@
 iew 
-=
+!
 = null)
- return;%0A       
  mWe

Add documentation and simplify logic for WebviewFragment