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

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

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

/**
 * Created by aaron on 23/10/2018
 */
public class SearchCategoryTitleViewHolder extends BaseViewHolder {

    private TextView mTextViewTitle;
    private TextView mTextViewCount;

    public SearchCategoryTitleViewHolder(ViewGroup viewGroup) {
        super(viewGroup, R.layout.item_search_category_title);

        initLayout();
    }

    private void initLayout() {
        mTextViewTitle = (TextView) itemView.findViewById(R.id.title_textView);
        mTextViewCount = (TextView) itemView.findViewById(R.id.count_textView);
    }

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

        if (object instanceof ViewHolderSearchType) {
            ViewHolderSearchType type = (ViewHolderSearchType) object;
            switch (type) {
                case MEMBER:
                    mTextViewTitle.setText(R.string.search_result_count_member);
                    break;
                case TODO:
                    mTextViewTitle.setText(R.string.search_result_count_todo);
                    break;
                case UNIT:
                    mTextViewTitle.setText(R.string.search_result_count_unit);
                    break;
            }
            mTextViewCount.setText(String.valueOf(count));
        }
    }
}
