<commit_before>package de.stephanlindauer.criticalmaps.fragments;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.widget.SwipeRefreshLayout;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.ProgressBar;

import java.util.ArrayList;

import butterknife.Bind;
import butterknife.ButterKnife;
import de.stephanlindauer.criticalmaps.R;
import de.stephanlindauer.criticalmaps.adapter.TweetAdapter;
import de.stephanlindauer.criticalmaps.handler.TwitterGetHandler;
import de.stephanlindauer.criticalmaps.model.TwitterModel;
import de.stephanlindauer.criticalmaps.vo.twitter.Tweet;

public class TwitterFragment extends Fragment {

    //dependencies
    private TwitterModel twitterModel = TwitterModel.getInstance();

    //view
    @Bind(R.id.twitter_error)
    LinearLayout errorMessage;

    @Bind(R.id.twitter_error_button)
    Button errorButton;

    @Bind(R.id.progressSpinner)
    ProgressBar loadingSpinner;

    @Bind(R.id.tweet_list)
    ListView tweetListView;

    @Bind(R.id.swipe_container)
    SwipeRefreshLayout swipeLayout;

    //adapter
    private TweetAdapter tweetAdapter;
    //misc
    private final TwitterFragment thiz = this;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        super.onCreateView(inflater, container, savedInstanceState);
        View view = inflater.inflate(R.layout.fragment_twitter, container, false);
        ButterKnife.bind(this, view);
        return view;
    }

    @Override
    public void onActivityCreated(final Bundle savedState) {
        super.onActivityCreated(savedState);

        tweetAdapter = new TweetAdapter(getActivity(), R.layout.view_tweet, new ArrayList<Tweet>());
        tweetListView.setAdapter(tweetAdapter);

        swipeLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
            @Override
            public void onRefresh() {
                new TwitterGetHandler(thiz).execute();
            }
        });
        swipeLayout.setColorSchemeResources(android.R.color.holo_blue_bright, android.R.color.darker_gray);

        errorButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                new TwitterGetHandler(thiz).execute();
                loadingSpinner.setVisibility(View.VISIBLE);
                errorMessage.setVisibility(View.GONE);
            }
        });

        new TwitterGetHandler(this).execute();
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();<commit_msg>No field needed to access this<commit_after>package de.stephanlindauer.criticalmaps.fragments;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.widget.SwipeRefreshLayout;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.ProgressBar;

import java.util.ArrayList;

import butterknife.Bind;
import butterknife.ButterKnife;
import de.stephanlindauer.criticalmaps.R;
import de.stephanlindauer.criticalmaps.adapter.TweetAdapter;
import de.stephanlindauer.criticalmaps.handler.TwitterGetHandler;
import de.stephanlindauer.criticalmaps.model.TwitterModel;
import de.stephanlindauer.criticalmaps.vo.twitter.Tweet;

public class TwitterFragment extends Fragment {

    //dependencies
    private TwitterModel twitterModel = TwitterModel.getInstance();

    //view
    @Bind(R.id.twitter_error)
    LinearLayout errorMessage;

    @Bind(R.id.twitter_error_button)
    Button errorButton;

    @Bind(R.id.progressSpinner)
    ProgressBar loadingSpinner;

    @Bind(R.id.tweet_list)
    ListView tweetListView;

    @Bind(R.id.swipe_container)
    SwipeRefreshLayout swipeLayout;

    //adapter
    private TweetAdapter tweetAdapter;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        super.onCreateView(inflater, container, savedInstanceState);
        View view = inflater.inflate(R.layout.fragment_twitter, container, false);
        ButterKnife.bind(this, view);
        return view;
    }

    @Override
    public void onActivityCreated(final Bundle savedState) {
        super.onActivityCreated(savedState);

        tweetAdapter = new TweetAdapter(getActivity(), R.layout.view_tweet, new ArrayList<Tweet>());
        tweetListView.setAdapter(tweetAdapter);

        swipeLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
            @Override
            public void onRefresh() {
                new TwitterGetHandler(TwitterFragment.this).execute();
            }
        });
        swipeLayout.setColorSchemeResources(android.R.color.holo_blue_bright, android.R.color.darker_gray);

        errorButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                new TwitterGetHandler(TwitterFragment.this).execute();
                loadingSpinner.setVisibility(View.VISIBLE);
                errorMessage.setVisibility(View.GONE);
            }
        });

        new TwitterGetHandler(this).execute();
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
{'fraction_non_alphanumeric': 0.08894445436685122, 'fraction_numerical': 0.0007144132880871584, 'mean_word_length': 3.357976653696498, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1467217', 'n_tokens_mistral': 1618, 'n_tokens_neox': 1510, 'n_words': 272}