completed bottom bar

This commit is contained in:
Ethan Pearson
2022-10-25 15:29:37 -03:00
parent 597ffd1bd6
commit f6015b9621
18 changed files with 89 additions and 91 deletions

View File

@ -25,7 +25,7 @@ class MainActivity : AppCompatActivity() {
// 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))
R.id.navigation_compressing, R.id.navigation_completed,R.id.navigation_settings))
setupActionBarWithNavController(navController, appBarConfiguration)
navView.setupWithNavController(navController)
}

View File

@ -1,4 +1,4 @@
package com.example.myapplication.ui.dashboard
package com.example.myapplication.ui.completed
import android.os.Bundle
import android.view.LayoutInflater
@ -7,11 +7,11 @@ import android.view.ViewGroup
import android.widget.TextView
import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
import com.example.myapplication.databinding.FragmentDashboardBinding
import com.example.myapplication.databinding.FragmentCompletedBinding
class DashboardFragment : Fragment() {
class CompletedFragment : Fragment() {
private var _binding: FragmentDashboardBinding? = null
private var _binding: FragmentCompletedBinding? = null
// This property is only valid between onCreateView and
// onDestroyView.
@ -23,12 +23,12 @@ class DashboardFragment : Fragment() {
savedInstanceState: Bundle?
): View {
val dashboardViewModel =
ViewModelProvider(this).get(DashboardViewModel::class.java)
ViewModelProvider(this).get(CompletedViewModel::class.java)
_binding = FragmentDashboardBinding.inflate(inflater, container, false)
_binding = FragmentCompletedBinding.inflate(inflater, container, false)
val root: View = binding.root
val textView: TextView = binding.textDashboard
val textView: TextView = binding.textCompleted
dashboardViewModel.text.observe(viewLifecycleOwner) {
textView.text = it
}

View File

@ -1,13 +1,13 @@
package com.example.myapplication.ui.dashboard
package com.example.myapplication.ui.completed
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
class DashboardViewModel : ViewModel() {
class CompletedViewModel : ViewModel() {
private val _text = MutableLiveData<String>().apply {
value = "This is dashboard Fragment"
value = "This is completed Fragment"
}
val text: LiveData<String> = _text
}

View File

@ -1,4 +1,4 @@
package com.example.myapplication.ui.notifications
package com.example.myapplication.ui.compressing
import android.os.Bundle
import android.view.LayoutInflater
@ -7,11 +7,11 @@ import android.view.ViewGroup
import android.widget.TextView
import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
import com.example.myapplication.databinding.FragmentNotificationsBinding
import com.example.myapplication.databinding.FragmentCompressingBinding
class NotificationsFragment : Fragment() {
class CompressingFragment : Fragment() {
private var _binding: FragmentNotificationsBinding? = null
private var _binding: FragmentCompressingBinding? = null
// This property is only valid between onCreateView and
// onDestroyView.
@ -22,14 +22,14 @@ class NotificationsFragment : Fragment() {
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
val notificationsViewModel =
ViewModelProvider(this).get(NotificationsViewModel::class.java)
val homeViewModel =
ViewModelProvider(this).get(CompressingViewModel::class.java)
_binding = FragmentNotificationsBinding.inflate(inflater, container, false)
_binding = FragmentCompressingBinding.inflate(inflater, container, false)
val root: View = binding.root
val textView: TextView = binding.textNotifications
notificationsViewModel.text.observe(viewLifecycleOwner) {
val textView: TextView = binding.textCompressing
homeViewModel.text.observe(viewLifecycleOwner) {
textView.text = it
}
return root

View File

@ -1,13 +1,13 @@
package com.example.myapplication.ui.notifications
package com.example.myapplication.ui.compressing
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
class NotificationsViewModel : ViewModel() {
class CompressingViewModel : ViewModel() {
private val _text = MutableLiveData<String>().apply {
value = "This is notifications Fragment"
value = "This is compressing Fragment"
}
val text: LiveData<String> = _text
}

View File

@ -1,4 +1,4 @@
package com.example.myapplication.ui.home
package com.example.myapplication.ui.settings
import android.os.Bundle
import android.view.LayoutInflater
@ -7,11 +7,12 @@ import android.view.ViewGroup
import android.widget.TextView
import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
import com.example.myapplication.databinding.FragmentHomeBinding
import com.example.myapplication.databinding.FragmentSettingsBinding
class HomeFragment : Fragment() {
private var _binding: FragmentHomeBinding? = null
class SettingsFragment : Fragment() {
private var _binding: FragmentSettingsBinding? = null
// This property is only valid between onCreateView and
// onDestroyView.
@ -23,12 +24,12 @@ class HomeFragment : Fragment() {
savedInstanceState: Bundle?
): View {
val homeViewModel =
ViewModelProvider(this).get(HomeViewModel::class.java)
ViewModelProvider(this).get(SettingsViewModel::class.java)
_binding = FragmentHomeBinding.inflate(inflater, container, false)
_binding = FragmentSettingsBinding.inflate(inflater, container, false)
val root: View = binding.root
val textView: TextView = binding.textHome
val textView: TextView = binding.textSettings
homeViewModel.text.observe(viewLifecycleOwner) {
textView.text = it
}

View File

@ -1,13 +1,13 @@
package com.example.myapplication.ui.home
package com.example.myapplication.ui.settings
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
class HomeViewModel : ViewModel() {
class SettingsViewModel : ViewModel() {
private val _text = MutableLiveData<String>().apply {
value = "This is home Fragment"
value = "This is settings Fragment"
}
val text: LiveData<String> = _text
}