You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
963 B
Java
42 lines
963 B
Java
package com.rehome.dywoa.adapter;
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
import com.rehome.dywoa.adapter.base.ItemViewDelegate;
|
|
|
|
import java.util.List;
|
|
|
|
public abstract class CommonAdapter<T> extends MultiItemTypeAdapter<T>
|
|
{
|
|
|
|
public CommonAdapter(Context context, final int layoutId, List<T> datas)
|
|
{
|
|
super(context, datas);
|
|
|
|
addItemViewDelegate(new ItemViewDelegate<T>()
|
|
{
|
|
@Override
|
|
public int getItemViewLayoutId()
|
|
{
|
|
return layoutId;
|
|
}
|
|
|
|
@Override
|
|
public boolean isForViewType(T item, int position)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public void convert(ViewHolder holder, T t, int position)
|
|
{
|
|
CommonAdapter.this.convert(holder, t, position);
|
|
}
|
|
});
|
|
}
|
|
|
|
protected abstract void convert(ViewHolder viewHolder, T item, int position);
|
|
|
|
}
|