package com.yidianling.course.courseNew.sections;

import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.yidianling.course.R;
import com.yidianling.ydlcommon.adapter.section.Section;
import com.yidianling.ydlcommon.view.BaseViewHolder;

/**
 * Created by Jim on 2018/6/27 0027.
 */

public class ListEndSection extends Section {

    private final int IDENTIFY_TYPE=LIST_END_SECTION;


    public ListEndSection() {
        super(R.layout.item_list_end);
    }
    private String title;
    public ListEndSection(String title) {
        super(R.layout.item_list_end);
        this.title = title;
    }

    @Override
    public void bindViewHolder(RecyclerView.ViewHolder holder, int position) {
    }

    @Override
    public int getTotalDataNum() {
        return 1;
    }

    @Override
    public int getItemViewType(int position) {
        return combineType(IDENTIFY_TYPE,TYPE_BODY);
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view= LayoutInflater.from(parent.getContext()).inflate(itemResourceId,parent,false);
        BaseViewHolder viewHolder = new BaseViewHolder(view);
        viewHolder.setText(R.id.tv_title, title);
        return viewHolder;
    }

    @Override
    public boolean isBelongTo(int viewType) {
        return String.valueOf(viewType).startsWith(String.valueOf(IDENTIFY_TYPE));
    }

    @Override
    public boolean isHeadType(int position) {
        return false;
    }

    @Override
    public boolean isFooterType(int position) {
        return false;
    }

    @Override
    public int getSectionId() {
        return 0;
    }
}
