package kr.co.hanwha.hifive.view;

import android.content.Context;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import kr.co.hanwha.hifive.R;

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

public class HFDotTextView extends LinearLayout {
    private ImageView mImageViewDot;
    private TextView mTextView;
    private String mText = "";

    public HFDotTextView(Context context) {
        super(context);
        initialize(context, null);
    }

    public HFDotTextView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        initialize(context, attrs);
    }

    public HFDotTextView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        initialize(context, attrs);
    }

    private void initialize(Context context, @Nullable AttributeSet attrs) {
        if (isInEditMode()) return;

        LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        inflater.inflate(R.layout.view_hf_dot_textview, this, true);

        mImageViewDot = (ImageView) findViewById(R.id.dot_imageView);
        mTextView = (TextView) findViewById(R.id.textView);
    }

    public void setVisibleDot(boolean visible) {
        mImageViewDot.setVisibility(visible ? View.VISIBLE : View.GONE);
    }

    public void setText(String text) {
        mTextView.setText(text);
    }
}
