package com.revoapp.calendar.components;


import android.content.Context;
import android.util.AttributeSet;
import android.widget.EditText;

import com.revoapp.calendarapp.R;
import com.revoapp.calendar.helper.ThemeHelper;

public class RevoEditText extends EditText {
    public RevoEditText(Context context) {
        super(context);
        setAttributes(context);
    }

    public RevoEditText(Context context, AttributeSet attrs) {
        super(context, attrs);
        setAttributes(context);
    }

    public RevoEditText(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        setAttributes(context);
    }

    private void setAttributes(Context context) {
        if (!isInEditMode()) {
            setTypeface(ThemeHelper.get_primary_font());

            setTextColor(context.getResources().getColor(
                    ThemeHelper.get_primary_color()));
            setTextSize((int) getResources().getDimension(R.dimen.dialog_add_event));


            setBackgroundResource(ThemeHelper
                    .get_component_textbox_selector());

            if (getId() == R.id.hours || getId() == R.id.minutes) {
                setTextSize((int) getResources().getDimension(R.dimen.hours_minutes));

            }
        }
    }
}