package com.base.appzxhy.ui.play

import android.annotation.SuppressLint
import android.content.Context
import android.graphics.Color
import android.graphics.drawable.Drawable
import android.view.Gravity
import androidx.appcompat.widget.AppCompatTextView
import androidx.core.content.ContextCompat
import com.base.appzxhy.R
import com.bytedance.sdk.shortplay.api.PSSDK
import com.bytedance.sdk.shortplay.api.ShortPlay
import com.bytedance.sdk.shortplay.api.ShortPlayFragment

class CustomView : AppCompatTextView, PSSDK.IControlView {

    private val TAG = "CustomEPView"

    private var drawable: Drawable?

    constructor(context: Context, drawableRes: Int) : super(context) {
        gravity = Gravity.CENTER_HORIZONTAL
        setTextColor(Color.parseColor("#ffffff"))
        textSize = 12f
        drawable = ContextCompat.getDrawable(context, drawableRes)

        val size = resources.getDimensionPixelSize(R.dimen.dp_32)
        drawable?.setBounds(0, 0, size, size)

        setCompoundDrawables(null, drawable, null, null)
    }


    override fun getControlViewType(): PSSDK.ControlViewType {
        return PSSDK.ControlViewType.CUSTOM
    }

    override fun bindItemData(fragment: ShortPlayFragment?, shortPlay: ShortPlay, index: Int) {
    }


}