From 9870433da30ab2a15cda6b89e1f012ba0959dd24 Mon Sep 17 00:00:00 2001 From: AngelSuarez03 Date: Wed, 8 May 2024 08:53:28 -0600 Subject: [PATCH] =?UTF-8?q?Reestructuraci=C3=B3n=20pagina=20principal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../medicalhealth/PrincipalActivity.kt | 28 +------------ .../ui/dashboard/DashboardFragment.kt | 42 ------------------- .../ui/dashboard/DashboardViewModel.kt | 13 ------ .../medicalhealth/ui/home/HomeFragment.kt | 42 ------------------- .../medicalhealth/ui/home/HomeViewModel.kt | 13 ------ .../ui/notifications/NotificationsFragment.kt | 42 ------------------- .../notifications/NotificationsViewModel.kt | 13 ------ .../main/res/layout/activity_principal.xml | 28 +------------ .../main/res/layout/fragment_dashboard.xml | 22 ---------- app/src/main/res/layout/fragment_home.xml | 22 ---------- .../res/layout/fragment_notifications.xml | 22 ---------- 11 files changed, 4 insertions(+), 283 deletions(-) delete mode 100644 app/src/main/java/com/terratenientes/medicalhealth/ui/dashboard/DashboardFragment.kt delete mode 100644 app/src/main/java/com/terratenientes/medicalhealth/ui/dashboard/DashboardViewModel.kt delete mode 100644 app/src/main/java/com/terratenientes/medicalhealth/ui/home/HomeFragment.kt delete mode 100644 app/src/main/java/com/terratenientes/medicalhealth/ui/home/HomeViewModel.kt delete mode 100644 app/src/main/java/com/terratenientes/medicalhealth/ui/notifications/NotificationsFragment.kt delete mode 100644 app/src/main/java/com/terratenientes/medicalhealth/ui/notifications/NotificationsViewModel.kt delete mode 100644 app/src/main/res/layout/fragment_dashboard.xml delete mode 100644 app/src/main/res/layout/fragment_home.xml delete mode 100644 app/src/main/res/layout/fragment_notifications.xml diff --git a/app/src/main/java/com/terratenientes/medicalhealth/PrincipalActivity.kt b/app/src/main/java/com/terratenientes/medicalhealth/PrincipalActivity.kt index 039966f..555e0b7 100644 --- a/app/src/main/java/com/terratenientes/medicalhealth/PrincipalActivity.kt +++ b/app/src/main/java/com/terratenientes/medicalhealth/PrincipalActivity.kt @@ -1,35 +1,11 @@ package com.terratenientes.medicalhealth -import android.os.Bundle -import com.google.android.material.bottomnavigation.BottomNavigationView import androidx.appcompat.app.AppCompatActivity -import androidx.navigation.findNavController -import androidx.navigation.ui.AppBarConfiguration -import androidx.navigation.ui.setupActionBarWithNavController -import androidx.navigation.ui.setupWithNavController -import com.terratenientes.medicalhealth.databinding.ActivityPrincipalBinding +import android.os.Bundle class PrincipalActivity : AppCompatActivity() { - - private lateinit var binding: ActivityPrincipalBinding - override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - - binding = ActivityPrincipalBinding.inflate(layoutInflater) - setContentView(binding.root) - - val navView: BottomNavigationView = binding.navView - - val navController = findNavController(R.id.nav_host_fragment_activity_principal) - // Passing each menu ID as a set of Ids because each - // menu should be considered as top level destinations. - val appBarConfiguration = AppBarConfiguration( - setOf( - R.id.navigation_home, R.id.navigation_dashboard, R.id.navigation_notifications - ) - ) - setupActionBarWithNavController(navController, appBarConfiguration) - navView.setupWithNavController(navController) + setContentView(R.layout.activity_principal) } } \ No newline at end of file diff --git a/app/src/main/java/com/terratenientes/medicalhealth/ui/dashboard/DashboardFragment.kt b/app/src/main/java/com/terratenientes/medicalhealth/ui/dashboard/DashboardFragment.kt deleted file mode 100644 index 229a044..0000000 --- a/app/src/main/java/com/terratenientes/medicalhealth/ui/dashboard/DashboardFragment.kt +++ /dev/null @@ -1,42 +0,0 @@ -package com.terratenientes.medicalhealth.ui.dashboard - -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 com.terratenientes.medicalhealth.databinding.FragmentDashboardBinding - -class DashboardFragment : Fragment() { - - private var _binding: FragmentDashboardBinding? = 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 dashboardViewModel = - ViewModelProvider(this).get(DashboardViewModel::class.java) - - _binding = FragmentDashboardBinding.inflate(inflater, container, false) - val root: View = binding.root - - val textView: TextView = binding.textDashboard - dashboardViewModel.text.observe(viewLifecycleOwner) { - textView.text = it - } - return root - } - - override fun onDestroyView() { - super.onDestroyView() - _binding = null - } -} \ No newline at end of file diff --git a/app/src/main/java/com/terratenientes/medicalhealth/ui/dashboard/DashboardViewModel.kt b/app/src/main/java/com/terratenientes/medicalhealth/ui/dashboard/DashboardViewModel.kt deleted file mode 100644 index 48f7ba5..0000000 --- a/app/src/main/java/com/terratenientes/medicalhealth/ui/dashboard/DashboardViewModel.kt +++ /dev/null @@ -1,13 +0,0 @@ -package com.terratenientes.medicalhealth.ui.dashboard - -import androidx.lifecycle.LiveData -import androidx.lifecycle.MutableLiveData -import androidx.lifecycle.ViewModel - -class DashboardViewModel : ViewModel() { - - private val _text = MutableLiveData().apply { - value = "This is dashboard Fragment" - } - val text: LiveData = _text -} \ No newline at end of file diff --git a/app/src/main/java/com/terratenientes/medicalhealth/ui/home/HomeFragment.kt b/app/src/main/java/com/terratenientes/medicalhealth/ui/home/HomeFragment.kt deleted file mode 100644 index 40e9c99..0000000 --- a/app/src/main/java/com/terratenientes/medicalhealth/ui/home/HomeFragment.kt +++ /dev/null @@ -1,42 +0,0 @@ -package com.terratenientes.medicalhealth.ui.home - -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 com.terratenientes.medicalhealth.databinding.FragmentHomeBinding - -class HomeFragment : Fragment() { - - private var _binding: FragmentHomeBinding? = 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 homeViewModel = - ViewModelProvider(this).get(HomeViewModel::class.java) - - _binding = FragmentHomeBinding.inflate(inflater, container, false) - val root: View = binding.root - - val textView: TextView = binding.textHome - homeViewModel.text.observe(viewLifecycleOwner) { - textView.text = it - } - return root - } - - override fun onDestroyView() { - super.onDestroyView() - _binding = null - } -} \ No newline at end of file diff --git a/app/src/main/java/com/terratenientes/medicalhealth/ui/home/HomeViewModel.kt b/app/src/main/java/com/terratenientes/medicalhealth/ui/home/HomeViewModel.kt deleted file mode 100644 index a4b8e5d..0000000 --- a/app/src/main/java/com/terratenientes/medicalhealth/ui/home/HomeViewModel.kt +++ /dev/null @@ -1,13 +0,0 @@ -package com.terratenientes.medicalhealth.ui.home - -import androidx.lifecycle.LiveData -import androidx.lifecycle.MutableLiveData -import androidx.lifecycle.ViewModel - -class HomeViewModel : ViewModel() { - - private val _text = MutableLiveData().apply { - value = "This is home Fragment" - } - val text: LiveData = _text -} \ No newline at end of file diff --git a/app/src/main/java/com/terratenientes/medicalhealth/ui/notifications/NotificationsFragment.kt b/app/src/main/java/com/terratenientes/medicalhealth/ui/notifications/NotificationsFragment.kt deleted file mode 100644 index 3c3743b..0000000 --- a/app/src/main/java/com/terratenientes/medicalhealth/ui/notifications/NotificationsFragment.kt +++ /dev/null @@ -1,42 +0,0 @@ -package com.terratenientes.medicalhealth.ui.notifications - -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 com.terratenientes.medicalhealth.databinding.FragmentNotificationsBinding - -class NotificationsFragment : Fragment() { - - private var _binding: FragmentNotificationsBinding? = 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 notificationsViewModel = - ViewModelProvider(this).get(NotificationsViewModel::class.java) - - _binding = FragmentNotificationsBinding.inflate(inflater, container, false) - val root: View = binding.root - - val textView: TextView = binding.textNotifications - notificationsViewModel.text.observe(viewLifecycleOwner) { - textView.text = it - } - return root - } - - override fun onDestroyView() { - super.onDestroyView() - _binding = null - } -} \ No newline at end of file diff --git a/app/src/main/java/com/terratenientes/medicalhealth/ui/notifications/NotificationsViewModel.kt b/app/src/main/java/com/terratenientes/medicalhealth/ui/notifications/NotificationsViewModel.kt deleted file mode 100644 index 07b315d..0000000 --- a/app/src/main/java/com/terratenientes/medicalhealth/ui/notifications/NotificationsViewModel.kt +++ /dev/null @@ -1,13 +0,0 @@ -package com.terratenientes.medicalhealth.ui.notifications - -import androidx.lifecycle.LiveData -import androidx.lifecycle.MutableLiveData -import androidx.lifecycle.ViewModel - -class NotificationsViewModel : ViewModel() { - - private val _text = MutableLiveData().apply { - value = "This is notifications Fragment" - } - val text: LiveData = _text -} \ No newline at end of file diff --git a/app/src/main/res/layout/activity_principal.xml b/app/src/main/res/layout/activity_principal.xml index baf59bb..7fc1148 100644 --- a/app/src/main/res/layout/activity_principal.xml +++ b/app/src/main/res/layout/activity_principal.xml @@ -1,33 +1,9 @@ - - - - + tools:context=".PrincipalActivity"> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_dashboard.xml b/app/src/main/res/layout/fragment_dashboard.xml deleted file mode 100644 index 166ab0e..0000000 --- a/app/src/main/res/layout/fragment_dashboard.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml deleted file mode 100644 index f3d9b08..0000000 --- a/app/src/main/res/layout/fragment_home.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_notifications.xml b/app/src/main/res/layout/fragment_notifications.xml deleted file mode 100644 index d417935..0000000 --- a/app/src/main/res/layout/fragment_notifications.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - \ No newline at end of file