<commit_before>package jupiter.broadcasting.live.holo;

import android.app.Activity;
import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.nostra13.universalimageloader.core.ImageLoader;

import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;


public class LazyAdapter extends BaseAdapter {

    private Activity activity;
    private Hashtable<String, String[]> data;
    private List<String> titles;
    private ArrayList<Boolean> markNew;
    private static LayoutInflater inflater = null;
    private ImageLoader iLoader;


    public LazyAdapter(Activity a, ImageLoader imageLoader, List<String> t, Hashtable<String, String[]> table, ArrayList<Boolean> aNew) {
        activity = a;
        data = table;
        titles = t;
        markNew = aNew;
        iLoader = imageLoader;
        inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    }

    public int getCount() {
        return data.size();
    }

    public Object getItem(int position) {
        return titles.get(position);
    }

    public long getItemId(int position) {
        return position;
    }

    public void add(List<String> t, Hashtable<String, String[]> table) {
        data.putAll(table);
        titles.addAll(t);
        notifyDataSetChanged();
    }

    public View getView(int position, View convertView, ViewGroup parent) {
        View vi = convertView;

        if (convertView == null) {
            vi = inflater.inflate(R.layout.episodelist_item, null);
        }
        TextView text = (TextView) vi.findViewById(R.id.title);
        ImageView image = (ImageView) vi.findViewById(R.id.thumb);
        TextView dura = (TextView) vi.findViewById(R.id.dur);
        ImageView newtag = (ImageView) vi.findViewById(R.id.newtag);

        String duration = null;
        String url = null;
        String title = null;
        // inconsistent rss formats, so making sure...
        try {
            if (data.get(titles.get(position))[3] != null) {
                title = titles.get(position);
                url = data.get(titles.get(position))[2];
                duration = data.get(titles.get(position))[3];

            }
        } catch (Exception e) {
            String err = (e.getMessage() == null) ? "Something wrong" : e.getMessage();
            Log.e("rss error: ", err);
        }
        if (null != duration) {
            dura.setText(duration);
        } else {
            dura.setText("11:11");
        }
        text.setText(title);
        iLoader.displayImage(url, image);

        if (markNew.size() > position) {
            if (markNew.get(position)) {
                newtag.setImageResource(R.drawable.newtag);
            }
        } else {
            newtag.setImageResource(R.drawable.nonewtag);
        }

        return vi;
    }
}




<commit_msg>ViewHolder pattern applied<commit_after>package jupiter.broadcasting.live.holo;

import android.app.Activity;
import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.nostra13.universalimageloader.core.ImageLoader;

import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;


public class LazyAdapter extends BaseAdapter {

    private Activity activity;
    private Hashtable<String, String[]> data;
    private List<String> titles;
    private ArrayList<Boolean> markNew;
    private static LayoutInflater inflater = null;
    private ImageLoader iLoader;


    public LazyAdapter(Activity a, ImageLoader imageLoader, List<String> t, Hashtable<String, String[]> table, ArrayList<Boolean> aNew) {
        activity = a;
        data = table;
        titles = t;
        markNew = aNew;
        iLoader = imageLoader;
        inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    }

    public int getCount() {
        return data.size();
    }

    public Object getItem(int position) {
        return titles.get(position);
    }

    public long getItemId(int position) {
        return position;
    }

    public void add(List<String> t, Hashtable<String, String[]> table) {
        data.putAll(table);
        titles.addAll(t);
        notifyDataSetChanged();
    }

    public View getView(int position, View convertView, ViewGroup parent) {
        View vi = convertView;
        ElementHolder eHolder;
        if (convertView == null) {
            vi = inflater.inflate(R.layout.episodelist_item, null);
            eHolder = new ElementHolder();
            eHolder.text = (TextView) vi.findViewById(R.id.title);
            eHolder.dura = (TextView) vi.findViewById(R.id.dur);
            eHolder.image = (ImageView) vi.findViewById(R.id.thumb);
            eHolder.newtag = (ImageView) vi.findViewById(R.id.newtag);

            vi.setTag(eHolder);
        }else {
            eHolder = (ElementHolder) vi.getTag();
        }

        String duration = null;
        String url = null;
        String title = null;
        // inconsistent rss formats, so making sure...
        try {
            title = titles.get(position);
            url = data.get(titles.get(position))[2];
            duration = data.get(titles.get(position))[3];
        } catch (Exception e) {
            String err = (e.getMessage() == null) ? "Something wrong" : e.getMessage();
            Log.e("rss error: ", err);
        }

        if (null != duration) {
            eHolder.dura.setText(duration);
        } else {
            eHolder.dura.setText("11:11");
        }
        eHolder.text.setText(title);
        iLoader.displayImage(url, eHolder.image);

        if (markNew.size() > position) {
            if (markNew.get(position)) {
                eHolder.newtag.setImageResource(R.drawable.newtag);
            }
        } else {
            eHolder.newtag.setImageResource(R.drawable.nonewtag);
        }

        return vi;
    }

    static class ElementHolder{
        ImageView image;
        ImageView newtag;
        TextView text;
        TextView dura;
    }
}





{'fraction_non_alphanumeric': 0.11015490533562823, 'fraction_numerical': 0.002659990611797841, 'mean_word_length': 2.3802221047065046, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 21, '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': '3743976', 'n_tokens_mistral': 1896, 'n_tokens_neox': 1810, 'n_words': 408}