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 MainHomeTitleHeaderViewHolder extends BaseViewHolder {
    private TextView mTextViewTitle;
    private TextView mTextViewCount;

    public MainHomeTitleHeaderViewHolder(@NonNull ViewGroup viewGroup) {

        super(viewGroup, R.layout.item_main_home_title_header);

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

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

        if (object != null && object instanceof String) {
            String format = (String) object;
            mTextViewTitle.setText(format);
        }

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