package negligentlyic.wrongic.bottomic

import androidx.core.view.isVisible
import androidx.lifecycle.lifecycleScope
import com.easy.clean.R
import tooic.fatalityic.jittersic.Peteric
import tooic.fatalityic.jittersic.goToAc
import autonomyic.polemicalic.congestionic.Unwindic
import com.easy.clean.databinding.QueenicBinding
import waific.Teflonic.therapistic.Hauntingic
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.launch

class Superstaric : Peteric<QueenicBinding>(QueenicBinding::inflate) {

    private val adapter = Carnivalic()
    override fun initView() {
        super.initView()
        Unwindic.showNative(binding.protectic, R.layout.explanatoryic)
        binding.callingic.adapter = adapter

        lifecycleScope.launch {
            (requireActivity() as Hauntingic).viewModel.recycleBinFileFlow.collectLatest {
                binding.manageableic.isVisible = it.isEmpty()
                adapter.submitList(it)
            }
        }
    }

    override fun initListener() {
        super.initListener()
        adapter.clickAction = {
            Givenic.recycleBinFile = it
            goToAc(Givenic::class.java)
        }
    }

}