package kr.co.zumo.app.lifeplus.view.fragment.signup;

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

import kr.co.zumo.app.R;

public class SignUpBenefitCustomView extends LinearLayout {

  LinearLayout benefitLayout;
  ImageView benefitImage;
  TextView benefitTitle;
  TextView benefitContents;
  TextView benefitCategory;


  public SignUpBenefitCustomView(Context context) {
    super(context);
    inflateViews(context);

  }

  public SignUpBenefitCustomView(Context context, @Nullable AttributeSet attrs) {
    super(context, attrs);
    inflateViews(context);
  }


  private void inflateViews(Context context) {
    Log.e("APP#  SignUpBenefitCustomView | inflateViews", "|" + context.toString());
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(R.layout.sign_up_benefit_view, this);

    benefitLayout = (LinearLayout) findViewById(R.id.benefit_layout);
    benefitImage = (ImageView) findViewById(R.id.benefit_image);
    benefitTitle = (TextView) findViewById(R.id.benefit_title);
    benefitContents = (TextView) findViewById(R.id.benefit_contents);
    benefitCategory = (TextView) findViewById(R.id.benefit_category);
  }


  private void getAttrs(AttributeSet attrs) {
    //TypedArray typedArray = getContext().obtainStyledAttributes(attrs , R.styleable.BenefitView);
  }


  public void setSignUpBenefit(int imageResource, String title, String contents, String category) {

    benefitImage.setImageResource(imageResource);
    benefitTitle.setText(title);
    benefitContents.setText(contents);
    benefitCategory.setText(category);

  }
}
