package com.soundapp.soundgags.setting

import android.content.Context
import android.graphics.Typeface
import android.util.AttributeSet
import androidx.appcompat.widget.AppCompatTextView
import com.soundapp.soundgags.R
import com.soundapp.soundgags.ReloadApplication

class SetTxtView(context: Context, attrs: AttributeSet?) :
    AppCompatTextView(context, attrs) {

    init {
        initAttrs(context, attrs)
    }


    private fun initAttrs(context: Context, attrs: AttributeSet?) {
        this.setTypeface(ReloadApplication.typeface)
        val typedArray=context.obtainStyledAttributes(attrs,R.styleable.SetTxtView)
        val isBold=typedArray.getBoolean(R.styleable.SetTxtView_isBold,false)
        setBold(isBold);
    }
    fun setBold(isBold:Boolean){
        if(isBold){
            this.setTypeface(ReloadApplication.typeface,Typeface.BOLD)
        }else{
            this.setTypeface(ReloadApplication.typeface,Typeface.NORMAL)
        }
    }

}