package com.izipay.tradeizipay.ui

import android.annotation.SuppressLint
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.appcompat.app.AppCompatDelegate
import androidx.appcompat.widget.Toolbar
import androidx.fragment.app.Fragment
import com.izipay.izipay_pw_sdk.BuildConfig
import com.izipay.tradeizipay.R
import com.izipay.tradeizipay.databinding.ActivityNavigationBinding
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
class NavigationActivity : AppCompatActivity() {

    private lateinit var binding:ActivityNavigationBinding

    @SuppressLint("SetTextI18n")
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)
        binding = ActivityNavigationBinding.inflate(layoutInflater)
        setContentView(binding.root)

        val customToolbar: Toolbar = findViewById(R.id.customToolbar)
        setSupportActionBar(customToolbar)
        val homeFragment=HomeFragment()
        setCurrentFragment(homeFragment)

        val versionName = com.izipay.tradeizipay.BuildConfig.VERSION_NAME
        val versionSdk = BuildConfig.VERSION_NAME
        binding.tvVersionName.text = "App v.$versionName"
        binding.tvVersionSdk.text = "Sdk v.$versionSdk"
    }

    private fun setCurrentFragment(fragment:Fragment)= supportFragmentManager.beginTransaction().apply {
        replace(R.id.navContainer, fragment)
        commit()
    }
}