<commit_before>package com.grishman.rssfeed.fragments;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.grishman.rssfeed.R;

/**
 * A Detail View fragment containing a web view
 * for displaying URL from feed list.
 */
public class DetailWebViewFragment extends Fragment {

    public static final String DETAIL_URL = "URL";
    private String mUrl;

    public DetailWebViewFragment() {
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.fragment_detail, container, false);
        WebView myWebView = (WebView) rootView.findViewById(R.id.webview);
        Bundle arguments = getArguments();
        if (arguments != null) {
            mUrl = arguments.getString(DetailWebViewFragment.DETAIL_URL);
        }
        Log.d("URT TO DETAIL", "" + mUrl);
        // TODO Fix rotation
        myWebView.getSettings().setJavaScriptEnabled(true);
        myWebView.setWebViewClient(new FeedWebViewClient());
        myWebView.loadUrl(mUrl);
        return rootView;
    }

    private class FeedWebViewClient extends WebViewClient {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            view.loadUrl(url);<commit_msg>Update webView to use DOM Try to restore state of webView<commit_after>package com.grishman.rssfeed.fragments;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.grishman.rssfeed.R;

/**
 * A Detail View fragment containing a web view
 * for displaying URL from feed list.
 */
public class DetailWebViewFragment extends Fragment {

    public static final String DETAIL_URL = "URL";
    private String mUrl;
    private WebView detailWebView;
    private Bundle webViewBundle;

    public DetailWebViewFragment() {
    }

    @Override
    public void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        detailWebView.saveState(outState);
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        detailWebView.restoreState(savedInstanceState);
    }
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.fragment_detail, container, false);
        detailWebView = (WebView) rootView.findViewById(R.id.webview);
        Bundle arguments = getArguments();
        if (arguments != null) {
            mUrl = arguments.getString(DetailWebViewFragment.DETAIL_URL);
        }
        Log.d("URT TO DETAIL", "" + mUrl);
        // TODO Fix rotation
        detailWebView.getSettings().setJavaScriptEnabled(true);
        detailWebView.getSettings().setDomStorageEnabled(true);
        detailWebView.setWebViewClient(new FeedWebViewClient());
//        detailWebView.loadUrl(mUrl);

        if (webViewBundle == null) {
            detailWebView.loadUrl(mUrl);
        } else {
            detailWebView.restoreState(webViewBundle);
        }
        return rootView;
    }
    @Override
    public void onPause() {
        super.onPause();

        webViewBundle = new Bundle();
        detailWebView.saveState(webViewBundle);
    }

    private class FeedWebViewClient extends WebViewClient {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            view.loadUrl(url);
{'fraction_non_alphanumeric': 0.08702290076335878, 'fraction_numerical': 0.0005089058524173028, 'mean_word_length': 3.099061522419187, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2147629', 'n_tokens_mistral': 1105, 'n_tokens_neox': 1048, 'n_words': 248}