package com.base.appzxhy.ui.views

import android.app.Activity
import android.content.Context
import android.graphics.Rect
import android.view.View
import android.view.animation.Animation
import com.base.appzxhy.utils.LogEx
import razerdp.basepopup.BasePopupWindow
import razerdp.util.animation.AnimationHelper
import razerdp.util.animation.TranslationConfig

class MyPopupMore : BasePopupWindow {

    private val TAG = "MyPopupM"

    constructor(context: Context) : super(context)

    constructor(activity: Activity, layout: Int) : this(activity) {
        setContentView(layout)
    }

    override fun onViewCreated(contentView: View) {
        super.onViewCreated(contentView)
        LogEx.logDebug(TAG, "onViewCreated")
    }

    override fun onCreateShowAnimation(): Animation {
        return AnimationHelper.asAnimation()
            .withTranslation(TranslationConfig.FROM_TOP)
            .toShow()
    }

    override fun onCreateDismissAnimation(): Animation {
        return AnimationHelper.asAnimation()
            .withTranslation(TranslationConfig.TO_TOP)
            .toDismiss()
    }


    override fun onPopupLayout(popupRect: Rect, anchorRect: Rect) {
        super.onPopupLayout(popupRect, anchorRect)
        LogEx.logDebug(TAG, "onPopupLayout")
    }
}