package com.adealink.weparty.room.micseat.decor

import android.content.Context
import androidx.appcompat.widget.AppCompatImageView
import androidx.constraintlayout.widget.ConstraintLayout
import com.adealink.weparty.commonui.commonSelectedDrawable
import com.adealink.weparty.commonui.ext.dpf
import com.adealink.weparty.room.R
import com.adealink.weparty.room.micseat.DecorDynamicLayers

open class AvatarFrameDecorView(
    dynamicLayers: DecorDynamicLayers
) : BaseDecorView<AppCompatImageView>(R.id.id_mic_seat_avatar_frame_decor, dynamicLayers),
    IAvatarFrameDecorApi {

    override fun createView(context: Context): AppCompatImageView {
        return AppCompatImageView(context)
    }

    override fun onViewAdded(view: AppCompatImageView) {
        super.onViewAdded(view)
        view.background = commonSelectedDrawable(baseSize.toFloat(), 1.dpf())
    }

    override fun getLayoutParams(): ConstraintLayout.LayoutParams {
        return ConstraintLayout.LayoutParams(baseSize, baseSize).apply {
            startToStart = R.id.id_mic_seat_avatar_decor
            endToEnd = R.id.id_mic_seat_avatar_decor
            topToTop = R.id.id_mic_seat_avatar_decor
            bottomToBottom = R.id.id_mic_seat_avatar_decor
        }
    }

    override fun showAvatarFrame(show: Boolean) {
        show(show)
    }
}