package com.kaixed.kchat.ui.activity

import android.content.Intent
import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import com.kaixed.kchat.databinding.ActivityProfileDetailBinding
import com.kaixed.kchat.ui.base.BaseActivity
import com.kaixed.kchat.utils.ConstantsUtil.getNickName

class ProfileDetailActivity : BaseActivity<ActivityProfileDetailBinding>() {

    override fun inflateBinding(): ActivityProfileDetailBinding {
        return ActivityProfileDetailBinding.inflate(layoutInflater)
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()

        binding.ciAvatar.setOnItemClickListener {
            finish()
        }

        setListener()
        updateContent()

    }

    private fun setListener() {
        binding.ciNickname.setOnClickListener {
            startActivity(
                Intent(this, RenameActivity::class.java)
            )
        }
    }

    override fun onResume() {
        super.onResume()
        updateContent()
    }

    private fun updateContent() {
        binding.ciNickname.setItemDesc(getNickName())
    }
}
