ref: 0f3ae9e13096218a22641ba4684cd48d77f987e3
app/src/main/java/ml/adamsprogs/bimba/dashboard/ui/voyage/VoyageFragment.kt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
package ml.adamsprogs.bimba.dashboard.ui.voyage import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.TextView import androidx.fragment.app.Fragment import androidx.lifecycle.ViewModelProvider import ml.adamsprogs.bimba.databinding.FragmentVoyageBinding class VoyageFragment : Fragment() { private var _binding: FragmentVoyageBinding? = null // This property is only valid between onCreateView and // onDestroyView. private val binding get() = _binding!! override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? ): View { val voyageViewModel = ViewModelProvider(this)[VoyageViewModel::class.java] _binding = FragmentVoyageBinding.inflate(inflater, container, false) val root: View = binding.root val textView: TextView = binding.textDashboard voyageViewModel.text.observe(viewLifecycleOwner) { textView.text = it } return root } override fun onDestroyView() { super.onDestroyView() _binding = null } } |