package kr.co.hanwha.hifive.adapter.viewholder;

import android.support.annotation.NonNull;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import kr.co.hanwha.hifive.R;
import kr.co.hanwha.hifive.base.BaseViewHolder;

/**
 * Created by sanghoonkwon on 2018. 1. 25..
 */

public class MainHomeTodayHeaderViewHolder extends BaseViewHolder {
    private TextView mTextViewTitle;
    private TextView mTextViewCount;
    private TextView mTextViewEmpty;

    public MainHomeTodayHeaderViewHolder(@NonNull ViewGroup viewGroup) {

        super(viewGroup, R.layout.item_main_home_today_header);

        mTextViewTitle = (TextView) itemView.findViewById(R.id.title_textView);
        mTextViewCount = (TextView) itemView.findViewById(R.id.count_textView);
        mTextViewEmpty = (TextView) itemView.findViewById(R.id.empty_textView);
    }

    @Override
    public void onBind(Object object, int count) {
        super.onBind(object, count);

        if (count > 0) {
            mTextViewCount.setText(Integer.toString(count));
            mTextViewCount.setVisibility(View.VISIBLE);
            mTextViewEmpty.setVisibility(View.GONE);
        } else {
            mTextViewCount.setVisibility(View.GONE);
            mTextViewEmpty.setVisibility(View.VISIBLE);
        }
    }
}
