package com.cartoon.live.wallpaper.utils;



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

import androidx.annotation.Nullable;

import com.cartoon.live.wallpaper.MyApp;
import com.cartoon.live.wallpaper.R;


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


    public MyTextView(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.MyTextView);
        boolean aBoolean = typedArray.getBoolean(R.styleable.MyTextView_apply_font,false);
        if(aBoolean){
            setTypeface(MyApp.getDefaultFont());
        }

        typedArray.recycle();
    }



}
