Back to project page Vispin.
The source code is released under:
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. ...
If you think the Android project Vispin listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.jpardogo.vispin.adapters.delegates; /*from w w w. j a v a2 s .c om*/ import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.jpardogo.vispin.adapters.BaseAllAdapters; import com.jpardogo.vispin.models.ListItem; public abstract class BaseDelegateAdapter<T> implements DelegateAdapter<T> { private final int mViewLayoutId; protected BaseDelegateAdapter(int viewLayoutId) { mViewLayoutId = viewLayoutId; } @Override public View getView(Context context, int position, View convertView, ViewGroup parent, LayoutInflater inflater, ListItem<T> item) { BaseAllAdapters.ViewHolder holder; if (convertView == null) { convertView = LayoutInflater.from(context).inflate(mViewLayoutId, parent, false); holder = getHolderInstance(convertView); if(holder== null) holder = new BaseAllAdapters.ViewHolder(convertView); convertView.setTag(holder); }else{ holder = (BaseAllAdapters.ViewHolder) convertView.getTag(); } bindView(position, convertView, item, holder); return convertView; } protected abstract void bindView(int position, View convertView, ListItem<T> item, BaseAllAdapters.ViewHolder parentHolder); protected abstract BaseAllAdapters.ViewHolder getHolderInstance(View convertView); }