package com.atmob.keyboard_android.component.base.animator.impl

import android.view.View
import com.atmob.keyboard_android.component.base.animator.ComponentAnimator

/**
 * 没有动画效果的动画执行器
 */
class NoAnimationAnimator : ComponentAnimator() {
    override fun show(onStart: (() -> Unit)?, onFinish: (() -> Unit)?) {
        val uiComponent = getUIComponent()
        uiComponent?.asView()?.let { rootView ->
            onStart?.invoke()
            rootView.visibility = View.VISIBLE
            onFinish?.invoke()
        }
    }

    override fun hide(onStart: (() -> Unit)?, onFinish: (() -> Unit)?) {
        val uiComponent = getUIComponent()
        uiComponent?.asView()?.let { rootView ->
            onStart?.invoke()
            rootView.visibility = View.GONE
            onFinish?.invoke()
        }
    }
}