package com.adealink.weparty.commonui.widget.floatview

import com.adealink.weparty.commonui.widget.floatview.data.FloatWindowType
import com.adealink.weparty.commonui.widget.floatview.data.IFloatData
import com.adealink.weparty.commonui.widget.floatview.view.BaseFloatView
import java.util.concurrent.CopyOnWriteArrayList

interface IWindowManager<V : BaseFloatView<out IFloatData>> {
    fun addView(view: V)
    fun removeView(view: V, reason: String = "")
    fun findFloatViewByType(type: FloatWindowType): V?
    fun isFloatViewAdded(type: FloatWindowType): Boolean
    fun removeFloatViewByType(type: FloatWindowType, reason: String)
    fun setFloatViewVisibility(type: FloatWindowType, visibility: Int)

    //移除所有正在显示或者未显示的浮窗
    fun removeAllFloatViews(type: FloatWindowType, reason: String)

    //查找所有正在显示或者未显示的浮窗
    fun findAllFloatViews(type: FloatWindowType): CopyOnWriteArrayList<BaseFloatView<out IFloatData>>

    fun remove(predicate: (BaseFloatView<out IFloatData>) -> Boolean, reason: String)
}