package com.gh.common.pop

import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.core.view.updateLayoutParams
import com.gh.gamecenter.R
import com.gh.gamecenter.common.databinding.LayoutPopupContainerBinding
import com.gh.gamecenter.common.view.BugFixedPopupWindow
import com.gh.gamecenter.core.utils.DisplayUtils
import com.gh.gamecenter.databinding.LayoutAddKaifuPopupItemBinding

class BatchManagementPop(
    binding: LayoutPopupContainerBinding,
    private val listener: OnBatchManagementListener
) :
    CommonPopupWindow(binding) {
    override val viewDataList: List<ViewData>
        get() = listOf(
            ViewData(R.string.enable_automatic_downloading_in_batches) {
                listener.enableAutoDownload()
            },
            ViewData(R.string.batch_management) {
                listener.batchManage()
            }
        )

    companion object {

        fun create(context: Context, listener: OnBatchManagementListener): BatchManagementPop {
            val binding = LayoutPopupContainerBinding.inflate(LayoutInflater.from(context))
            return BatchManagementPop(binding, listener).apply {
                initView()
            }
        }
    }

    interface OnBatchManagementListener {

        fun enableAutoDownload()

        fun batchManage()
    }
}