package com.gh.gamecenter.common.view

import android.content.Context
import android.util.AttributeSet
import androidx.appcompat.widget.AppCompatTextView

/***
 * 修复 onVisibilityAggregated 重复调用导致的 TextView marqueeRepeatLimit 失效
 */
class FixMarqueeTextView @JvmOverloads constructor(
    context: Context,
    attrs: AttributeSet? = null,
    defStyleAttr: Int = 0
) :
    AppCompatTextView(context, attrs, defStyleAttr) {
    private var isVisible = false
    override fun onVisibilityAggregated(isVisible: Boolean) {
        if (this.isVisible != isVisible) {
            this.isVisible = isVisible
            super.onVisibilityAggregated(isVisible)
        }
    }
}