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

import android.content.Context;
import android.support.annotation.NonNull;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;

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

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

public class MarginViewHolder extends BaseViewHolder {
    private TextView mTextViewEmpty;

    public MarginViewHolder(@NonNull ViewGroup viewGroup) {

        super(viewGroup, R.layout.item_margin_list);

        mTextViewEmpty = (TextView) itemView.findViewById(R.id.empty_textView);
    }

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

        String message = (String) object;
        if (TextUtils.isEmpty(message) == false) {
            mTextViewEmpty.setText(message);

        }

        if (height > 0) {
            LinearLayout.LayoutParams param = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, height);
            mTextViewEmpty.setLayoutParams(param);
        }
    }
}
