package com.base.superfilemanager.activity.photocompress.photo

import android.content.Intent
import android.graphics.Color
import android.widget.TextView
import androidx.core.view.updatePadding
import com.blankj.utilcode.util.BarUtils
import com.base.superfilemanager.R
import com.base.superfilemanager.databinding.ActivityPreviewCompressionPhotoBinding
import com.base.superfilemanager.helps.BaseActivity


class PreviewCompressionPhotoActivity : BaseActivity<ActivityPreviewCompressionPhotoBinding>() {
    override val isLightMode = true
    private var mPhotoCount: Int = 0

    override val binding: ActivityPreviewCompressionPhotoBinding by lazy {
        ActivityPreviewCompressionPhotoBinding.inflate(layoutInflater)
    }

    override fun initView() {
        BarUtils.setStatusBarColor(this, Color.TRANSPARENT)
        binding.root.updatePadding(top = BarUtils.getStatusBarHeight())
        mPhotoCount = intent.getIntExtra("count", 0)
        binding.fanhui.setOnClickListener {
            finish()
        }


        val manager = PreviewCompressionManager(this)


        findViewById<TextView>(R.id.btn_compress).setOnClickListener {
            val dialog = CustomDialog(this, R.layout.custom_dialog)
            dialog.setButtonClickListener(R.id.cancel) {
                dialog.dismiss()
            }

            dialog.setButtonClickListener(R.id.btnContinue) {
                CompressionPhotoListActivity.mActivity?.finish()
                val intent = Intent(this, CompressioningActivity::class.java)
                intent.putExtra("mode", manager.getMode())
                startActivity(intent)
                dialog.dismiss()
                finish()
            }
            dialog.show()
        }
    }

}