ref: 5cb16913cd9ec8d0c721b7a7c7731ba3a35d52fc
app/src/main/java/ml/adamsprogs/bimba/dashboard/ui/map/MapFragment.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.map 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.FragmentMapBinding class MapFragment : Fragment() { private var _binding: FragmentMapBinding? = 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 mapViewModel = ViewModelProvider(this).get(MapViewModel::class.java) _binding = FragmentMapBinding.inflate(inflater, container, false) val root: View = binding.root val textView: TextView = binding.textNotifications mapViewModel.text.observe(viewLifecycleOwner) { textView.text = it } return root } override fun onDestroyView() { super.onDestroyView() _binding = null } } |