package com.kaixed.kchat.ui.fragment

import android.annotation.SuppressLint
import android.content.Intent
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.kaixed.kchat.databinding.FragmentMineBinding
import com.kaixed.kchat.ui.activity.ProfileDetailActivity
import com.kaixed.kchat.ui.base.BaseFragment
import com.kaixed.kchat.utils.ConstantsUtil


class MineFragment : BaseFragment<FragmentMineBinding>() {

    override fun inflateBinding(
        inflater: LayoutInflater,
        container: ViewGroup?
    ): FragmentMineBinding {
        return FragmentMineBinding.inflate(inflater, container, false)
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)

        binding.clProfile.setOnClickListener {
            startActivity(Intent(requireContext(), ProfileDetailActivity::class.java))
        }

        binding.ciSetting.setOnClickListener {
            val bottomSheetFragment = MyBottomSheetFragment()
            bottomSheetFragment.show(
                requireActivity().supportFragmentManager,
                bottomSheetFragment.tag
            )
        }

        binding.ciSetting.setRedTipVisibility(true)

    }

    @SuppressLint("SetTextI18n")
    override fun onResume() {
        super.onResume()
        val nickname = ConstantsUtil.getNickName()
        binding.tvId.text = "kid: $nickname"
    }
}
