package com.jimind.sportdemo.adapter;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.jimind.sportdemo.listener.PopupListener;
import com.jimind.sportdemo.R;
import com.jimind.sportdemo.base.BaseRecyclerAdapter;
import com.jimind.sportdemo.base.BaseViewHolder;

/**
 * 弹出框
 *
 *  @author Any
 */
public class PopupAdapter extends BaseRecyclerAdapter<String> {

    private PopupListener mListener;

    public PopupAdapter(Context context) {
        super(context);
        mListener = (PopupListener) mContext;
    }

    @Override
    protected int getLayoutId() {
        return R.layout.item_popup;
    }

    @Override
    protected void onBindItemHolder(final BaseViewHolder holder, final int position) {
        final TextView tvContent = holder.getView(R.id.tv_content);
        tvContent.setText(mDataList.get(position));
        tvContent.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                mListener.click(mDataList.get(holder.getAdapterPosition()));
            }
        });

    }
}
