package com.yidianling.course;

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

import com.ydl.ydlcommon.adapter.CommonAdapter;
import com.yidianling.course.bean.Course;
import com.yidianling.course.widget.CourseItemNewView;

public class CourseNewListAdapter extends CommonAdapter<Course> {

    private Context context;

    public CourseNewListAdapter(Context context) {
        this.context = context;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        if (convertView == null) {
            convertView = new CourseItemNewView(context);
        }
        ((CourseItemNewView) convertView).setData(mDataList.get(position));
        return convertView;
    }

    //修复 Android 4.4 Bug :cannot be cast to android.widget.AbsListView$LayoutParams
    @Override
    public boolean hasStableIds() {
        return true;
    }
}
