package com.remax.visualnovel.widget.ui.buttons

import android.content.Context
import android.util.AttributeSet
import android.view.Gravity
import com.remax.visualnovel.R
import com.remax.visualnovel.extension.getIconFontType
import com.remax.visualnovel.utils.spannablex.utils.dp
import com.remax.visualnovel.widget.uitoken.changeBackground
import com.remax.visualnovel.widget.uitoken.changeTextColor
import com.remax.visualnovel.widget.uitoken.expend.dsl.expand
import com.remax.visualnovel.widget.uitoken.view.UITokenTextView

/**
 * Created by HJW on 2022/8/31
 *
 */
class FloatActionButtonView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) :
    UITokenTextView(context, attrs, defStyleAttr) {

    init {
        textSize = 24f

        val clickExpend = 24.dp
        expand(clickExpend, clickExpend)

        customViewToken.apply {
            textUIColorToken = context.getString(R.string.color_txt_primary_normal)
            backgroundUIColorToken = context.getString(R.string.color_primary_gradient_normal)
            backgroundUIPressedColorToken = context.getString(R.string.color_primary_gradient_press)
            backgroundUIHoveredColorToken = context.getString(R.string.color_primary_gradient_hover)
            backgroundUIDisabledColorToken = context.getString(R.string.color_primary_gradient_disabled)
            radiusToken = context.getString(R.string.radius_pill)
        }

        changeBackground(customViewToken)
        changeTextColor(customViewToken)

        gravity = Gravity.CENTER
        typeface = context.getIconFontType()

        height = 56.dp
        width = 56.dp
    }

}