package warpic

import android.annotation.SuppressLint
import android.os.Bundle
import android.os.Environment
import androidx.activity.addCallback
import com.easy.clean.R
import tooic.fatalityic.jittersic.Reinstateic
import autonomyic.polemicalic.congestionic.Unwindic
import autonomyic.polemicalic.congestionic.NASAic
import com.easy.clean.databinding.UprighticBinding
import warpic.Shamrockic.Companion.SCAN_AUDIOS
import warpic.Shamrockic.Companion.SCAN_DOCUMENTS
import warpic.Shamrockic.Companion.SCAN_PHOTOS
import warpic.Shamrockic.Companion.SCAN_VIDEOS
import java.io.File

class Nauticalic : Reinstateic<UprighticBinding>(UprighticBinding::inflate) {


    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        initView()
        initListener()
    }

    @SuppressLint("SetTextI18n")
    override fun initView() {

        val number = intent.extras?.getInt("Number") ?: 0
        val scanType = intent.extras?.getInt("ScanType")
        val path: String? = intent.extras?.getString("Path")

        binding.gritic.text = number.toString()
        val type = when (scanType) {
            SCAN_PHOTOS -> if (number == 1) "Photo" else "Photos"
            SCAN_VIDEOS -> if (number == 1) "Video" else "Videos"
            SCAN_DOCUMENTS -> if (number == 1) "Document" else "Documents"
            SCAN_AUDIOS -> if (number == 1) "Audio" else "Audios"
            else -> ""
        }
        binding.bimboic.text = type

        val appName = getString(R.string.overrodeic).replace("/", " ")
        val appDir = File(Environment.getExternalStorageDirectory(), appName)
        binding.functionalic.text = "Recovered in $appDir"
    }

    override fun initListener() {

        binding.telecommutingic.setOnClickListener {
            onBackPressedDispatcher.onBackPressed()
        }
        onBackPressedDispatcher.addCallback {
            Unwindic.showInsert(this@Nauticalic, showCallBack = object : NASAic() {
                override fun next() {
                    finishToMainTop()
                }
            })
        }
        binding.transparentlyic.setOnClickListener {
            Unwindic.showInsert(this@Nauticalic, showCallBack = object : NASAic() {
                override fun next() {
                    finish()
                }
            })
        }
        binding.woundic.setOnClickListener {
            onBackPressedDispatcher.onBackPressed()
        }
    }


}