package com.base.pdfviewerscannerwhite.ui.set

import androidx.activity.addCallback
import androidx.core.widget.addTextChangedListener
import com.base.pdfviewerscannerwhite.databinding.ActivityFeedbackBinding
import com.base.pdfviewerscannerwhite.helper.BaseActivity
import com.base.pdfviewerscannerwhite.helper.MyApplication
import com.base.pdfviewerscannerwhite.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")
            onBackPressedDispatcher.onBackPressed()
        }
    }

}