<commit_before>package com.kerchin.yellownote.base;

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

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

import com.kerchin.yellownote.base.CommonViewHolder;

/**
 * extends CommonAdapter<Bean>
 * 构造方法中super(context, datas, R.layout.xx);
 * @author Kerchin
 *
 * @param <T>
 */
public abstract class CommonAdapter<T> extends BaseAdapter {
	private List<T> mDatas = new ArrayList<T>();
	private Context mContext;
	private int layoutId;

	public CommonAdapter(Context context, List<T> datas, int layoutId){
		this.mContext = context;
		this.mDatas = datas;
		this.layoutId = layoutId;
	}
	
	@Override
	public int getCount() {
		return mDatas.size();
	}

	@Override
	public T getItem(int position) {
		return mDatas.get(position);
	}

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

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		CommonViewHolder holder = CommonViewHolder.get(mContext, convertView, parent, layoutId, position);
		convert(holder, getItem(position));
		return holder.getConvertView();
	}

	/**
	 * ((TextView)holder.getView(R.id.id_title)).setText(bean.getTitle());
	 * @param holder
	 * @param t
	 */
	public abstract void convert(CommonViewHolder holder, T t);
}<commit_msg>prove commonAdapter<commit_after>package com.kerchin.yellownote.base;

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

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

import com.kerchin.yellownote.base.CommonViewHolder;

/**
 * extends CommonAdapter<Bean>
 * 构造方法中super(context, datas, R.layout.xx);
 * @author Kerchin
 *
 * @param <T>
 */
public abstract class CommonAdapter<T> extends BaseAdapter {
	private List<T> mDatas = new ArrayList<T>();
	private Context mContext;
	private int layoutId;

	public CommonAdapter(Context context, List<T> datas, int layoutId){
		this.mContext = context;
		this.mDatas = datas;
		this.layoutId = layoutId;
	}

	@Override
	public int getCount() {
		return mDatas.size();
	}

	@Override
	public T getItem(int position) {
		return mDatas.get(position);
	}

	public void setList(List<T> newData){
		mDatas = newData;
		notifyDataSetChanged();
	}

	public List<T> getList(){
		return mDatas;
	}

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

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		CommonViewHolder holder = CommonViewHolder.get(mContext, convertView, parent, layoutId, position);
		convert(holder, getItem(position), position);
		return holder.getConvertView();
	}

	/**
	 * ((TextView)holder.getView(R.id.id_title)).setText(bean.getTitle());
	 * @param holder
	 * @param t
	 */
	public abstract void convert(CommonViewHolder holder, T t, int position);
}
{'fraction_non_alphanumeric': 0.11909650924024641, 'fraction_numerical': 0.0, 'mean_word_length': 4.881287726358149, 'pattern_counts': {'":': 0, '<': 17, '<?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': '2014242', 'n_tokens_mistral': 997, 'n_tokens_neox': 941, 'n_words': 230}