40 lines
1.3 KiB
Kotlin
40 lines
1.3 KiB
Kotlin
package com.example.defenseapplication.home
|
|
|
|
import android.content.Intent
|
|
import android.os.Bundle
|
|
import androidx.fragment.app.Fragment
|
|
import android.view.LayoutInflater
|
|
import android.view.View
|
|
import android.view.ViewGroup
|
|
import com.bumptech.glide.Glide
|
|
import com.example.defenseapplication.R
|
|
import com.example.defenseapplication.databinding.PersonalFragmentBinding
|
|
import com.example.defenseapplication.personal.PersonalProfileActivity
|
|
|
|
class PersonalFragment : Fragment() {
|
|
// ViewBinding
|
|
private var _binding: PersonalFragmentBinding? = null
|
|
private val binding get() = _binding!!
|
|
|
|
override fun onCreateView(
|
|
inflater: LayoutInflater,
|
|
container: ViewGroup?,
|
|
savedInstanceState: Bundle?
|
|
): View {
|
|
_binding = PersonalFragmentBinding.inflate(inflater, container, false)
|
|
Glide.with(this)
|
|
.load(R.mipmap.ic_launcher_round)
|
|
.circleCrop()
|
|
.into(binding.ivAvatar)
|
|
binding.headerLayout.setOnClickListener {
|
|
val intent= Intent(requireContext(), PersonalProfileActivity::class.java)
|
|
startActivity(intent)
|
|
}
|
|
return binding.root
|
|
}
|
|
|
|
override fun onDestroyView() {
|
|
super.onDestroyView()
|
|
_binding = null // 避免内存泄漏
|
|
}
|
|
} |