package com.base.pdfreaderallpdfreader.ui.feedback

import androidx.activity.addCallback
import androidx.core.widget.addTextChangedListener
import com.base.pdfreaderallpdfreader.base.BaseActivity
import com.base.pdfreaderallpdfreader.databinding.ActivityFeedbackBinding
import com.base.pdfreaderallpdfreader.helper.EventUtils
import com.base.pdfreaderallpdfreader.utils.ToastUtils.toast

class FeedbackActivity : BaseActivity<ActivityFeedbackBinding>() {

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

    override fun initView() {

    }

    override fun onResume() {
        super.onResume()
//        updateAppLanguage(MyApplication.feedbackLanguage) {
//            MyApplication.feedbackLanguage = it
//        }
    }

    override fun initListener() {
        super.initListener()
        onBackPressedDispatcher.addCallback {
            finish()
        }
        binding.flFanhui.setOnClickListener {
            onBackPressedDispatcher.onBackPressed()
        }
        binding.edit.addTextChangedListener {
            binding.tvBtn.isEnabled = it?.isNotEmpty() == true
        }
        binding.tvBtn.setOnClickListener {
            toast("Feedback success")
            EventUtils.event("Feedback", "${binding.edit.text}")
            onBackPressedDispatcher.onBackPressed()
        }
    }

}