package com.app.wave.keyboard.utils;

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

import androidx.annotation.Nullable;

import com.app.wave.keyboard.App;
import com.app.wave.keyboard.R;


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


    public TextVCustom(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(App.Companion.getDefaultFont());
    }

}
