package com.sunny.app.soft.timberkeyboardnew.ui.activity

import android.view.View
import android.view.inputmethod.InputMethodManager
import com.sunny.app.soft.timberkeyboardnew.databinding.ActivityDisplayBinding


class DisplayActivity : BaseActivity() {
    private lateinit var binding: ActivityDisplayBinding
    override fun loadAd(): Boolean = true

    private var inputMethod: InputMethodManager? = null

    private var showInput = false

    override fun setRootView(): View {
        binding = ActivityDisplayBinding.inflate(layoutInflater)
        init()
        return binding.root
    }

    private fun init() {
        binding.back.setOnClickListener {
            finish()
        }
        binding.et.requestFocus()

        inputMethod = getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager
        showInput = true
    }

    override fun onResume() {
        super.onResume()

        if (showInput) {
            showInput = false
            inputMethod?.showSoftInput(binding.et, InputMethodManager.SHOW_IMPLICIT)
        }

    }

}