package com.xd.binddemokotlin

import android.R
import android.os.Bundle
import android.view.KeyEvent
import androidx.appcompat.app.AppCompatActivity

class MainActivity : AppCompatActivity() {
    private lateinit var mainUIFragment: MainUIFragment

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
//        setContentView(R.layout.activity_main)
        if (supportFragmentManager.findFragmentByTag("MainUIFragment") == null) {
            mainUIFragment = MainUIFragment()
            supportFragmentManager.beginTransaction().add(R.id.content, mainUIFragment, "MainUIFragment").commit()
        }
    }

//    override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
//        if (keyCode == KeyEvent.KEYCODE_BACK) {
//            println("debug: back button pressed")
//        }
//        return super.onKeyDown(keyCode, event)
//    }
}