<commit_before>package com.moko256.twitterviewer256;

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.LayoutRes;
import android.support.v4.app.Fragment;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import java.util.ArrayList;

/**
 * Created by moko256 on 2016/10/09.
 *
 * @author moko256
 */
public abstract class BaseListFragment<A extends BaseListAdapter<LI,? extends RecyclerView.ViewHolder>,LI> extends Fragment {

    private A adapter;
    private ArrayList<LI> list;
    private RecyclerView recyclerView;
    private SwipeRefreshLayout swipeRefreshLayout;

    @Override
    public void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
        super.onCreateView(inflater,container,savedInstanceState);

        View view=inflater.inflate(getLayoutResourceId(), null);

        list=new ArrayList<>();
        adapter=getAdapterInstance(getContext(),list);
        recyclerView=(RecyclerView) view.findViewById(R.id.TLlistView);
        recyclerView.setAdapter(adapter);
        recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
        recyclerView.addOnScrollListener(new LoadScrollListener((LinearLayoutManager) recyclerView.getLayoutManager()) {
            @Override
            public void load(int page) {
                if(isInitializedList()){
                    onLoadMoreList();
                }
            }
        });

        swipeRefreshLayout=(SwipeRefreshLayout)view.findViewById(R.id.srl);
        swipeRefreshLayout.setColorSchemeResources(R.color.colorPrimary);
        swipeRefreshLayout.setOnRefreshListener(()->{
            if (isInitializedList()){
                onUpdateList();
            }else{
                onInitializeList();
            }
        });

        if (savedInstanceState != null){
            ArrayList<LI> list=(ArrayList<LI>) savedInstanceState.getSerializable("list");
            if(list!=null){
                list.addAll(list);
                adapter.notifyDataSetChanged();
            }
            else onInitializeList();
        }else{
            onInitializeList();
        }
<commit_msg>bug fixed<commit_after>package com.moko256.twitterviewer256;

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.LayoutRes;
import android.support.v4.app.Fragment;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import java.util.ArrayList;

/**
 * Created by moko256 on 2016/10/09.
 *
 * @author moko256
 */
public abstract class BaseListFragment<A extends BaseListAdapter<LI,? extends RecyclerView.ViewHolder>,LI> extends Fragment {

    private A adapter;
    private ArrayList<LI> list;
    private RecyclerView recyclerView;
    private SwipeRefreshLayout swipeRefreshLayout;

    @Override
    public void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
        super.onCreateView(inflater,container,savedInstanceState);

        View view=inflater.inflate(getLayoutResourceId(), null);

        list=new ArrayList<>();
        adapter=getAdapterInstance(getContext(),list);
        recyclerView=(RecyclerView) view.findViewById(R.id.TLlistView);
        recyclerView.setAdapter(adapter);
        recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
        recyclerView.addOnScrollListener(new LoadScrollListener((LinearLayoutManager) recyclerView.getLayoutManager()) {
            @Override
            public void load(int page) {
                if(isInitializedList()){
                    onLoadMoreList();
                }
            }
        });

        swipeRefreshLayout=(SwipeRefreshLayout)view.findViewById(R.id.srl);
        swipeRefreshLayout.setColorSchemeResources(R.color.colorPrimary);
        swipeRefreshLayout.setOnRefreshListener(()->{
            if (isInitializedList()){
                onUpdateList();
            }else{
                onInitializeList();
            }
        });

        if (savedInstanceState != null){
            ArrayList<LI> l=(ArrayList<LI>) savedInstanceState.getSerializable("list");
            if(l!=null){
                list.addAll(l);
                adapter.notifyDataSetChanged();
            }
            else onInitializeList();
        }else{
            onInitializeList();
        }

{'fraction_non_alphanumeric': 0.0986908358509567, 'fraction_numerical': 0.009667673716012085, 'mean_word_length': 2.985553772070626, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 17, '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': '6744323', 'n_tokens_mistral': 1354, 'n_tokens_neox': 1275, 'n_words': 223}