package com.app.input.personalised.board.helpers;

import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.app.input.personalised.board.BoartApp;
import com.app.input.personalised.board.R;


public class FontTextView extends androidx.appcompat.widget.AppCompatTextView {


    public FontTextView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        initAttrs(context,attrs);
    }


    private void initAttrs(Context context, AttributeSet attrs){
        TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.MyTV);
        boolean aBoolean = typedArray.getBoolean(R.styleable.MyTV_apply_font,false);
        if(aBoolean){
             initFont(this);
        }

        typedArray.recycle();
    }

    public static void initFont(TextView tv) {
        tv.setTypeface(BoartApp.Companion.getDefaultFont());
    }

}
