diff --git a/app/src/main/java/de/chrissthecoder/store/MainActivity.kt b/app/src/main/java/de/chrissthecoder/store/MainActivity.kt
index f5bc673..8de4969 100644
--- a/app/src/main/java/de/chrissthecoder/store/MainActivity.kt
+++ b/app/src/main/java/de/chrissthecoder/store/MainActivity.kt
@@ -37,7 +37,7 @@ class MainActivity : AppCompatActivity() {
// menu should be considered as top level destinations.
appBarConfiguration = AppBarConfiguration(
setOf(
- R.id.nav_home, R.id.nav_gallery, R.id.nav_slideshow
+ R.id.nav_dashboard, R.id.nav_gallery, R.id.nav_slideshow
), drawerLayout
)
setupActionBarWithNavController(navController, appBarConfiguration)
diff --git a/app/src/main/java/de/chrissthecoder/store/ui/home/HomeFragment.kt b/app/src/main/java/de/chrissthecoder/store/ui/dashboard/DashboardFragment.kt
similarity index 54%
rename from app/src/main/java/de/chrissthecoder/store/ui/home/HomeFragment.kt
rename to app/src/main/java/de/chrissthecoder/store/ui/dashboard/DashboardFragment.kt
index 6cdf999..276ccf3 100644
--- a/app/src/main/java/de/chrissthecoder/store/ui/home/HomeFragment.kt
+++ b/app/src/main/java/de/chrissthecoder/store/ui/dashboard/DashboardFragment.kt
@@ -1,17 +1,16 @@
-package de.chrissthecoder.store.ui.home
+package de.chrissthecoder.store.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 de.chrissthecoder.store.databinding.FragmentHomeBinding
+import de.chrissthecoder.store.databinding.FragmentDashboardBinding
-class HomeFragment : Fragment() {
+class DashboardFragment : Fragment() {
- private var _binding: FragmentHomeBinding? = null
+ private var _binding: FragmentDashboardBinding? = null
// This property is only valid between onCreateView and
// onDestroyView.
@@ -22,16 +21,11 @@ class HomeFragment : Fragment() {
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
- val homeViewModel =
- ViewModelProvider(this).get(HomeViewModel::class.java)
+ val dashboardViewModel = ViewModelProvider(this).get(DashboardViewModel::class.java)
- _binding = FragmentHomeBinding.inflate(inflater, container, false)
+ _binding = FragmentDashboardBinding.inflate(inflater, container, false)
val root: View = binding.root
- val textView: TextView = binding.textHome
- homeViewModel.text.observe(viewLifecycleOwner) {
- textView.text = it
- }
return root
}
diff --git a/app/src/main/java/de/chrissthecoder/store/ui/home/HomeViewModel.kt b/app/src/main/java/de/chrissthecoder/store/ui/dashboard/DashboardViewModel.kt
similarity index 75%
rename from app/src/main/java/de/chrissthecoder/store/ui/home/HomeViewModel.kt
rename to app/src/main/java/de/chrissthecoder/store/ui/dashboard/DashboardViewModel.kt
index ccd4b33..d3bf510 100644
--- a/app/src/main/java/de/chrissthecoder/store/ui/home/HomeViewModel.kt
+++ b/app/src/main/java/de/chrissthecoder/store/ui/dashboard/DashboardViewModel.kt
@@ -1,10 +1,10 @@
-package de.chrissthecoder.store.ui.home
+package de.chrissthecoder.store.ui.dashboard
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
-class HomeViewModel : ViewModel() {
+class DashboardViewModel : ViewModel() {
private val _text = MutableLiveData().apply {
value = "This is home Fragment"
diff --git a/app/src/main/res/layout/fragment_dashboard.xml b/app/src/main/res/layout/fragment_dashboard.xml
new file mode 100644
index 0000000..3f4fb26
--- /dev/null
+++ b/app/src/main/res/layout/fragment_dashboard.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
\ 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/menu/activity_main_drawer.xml b/app/src/main/res/menu/activity_main_drawer.xml
index d7f2df2..0219874 100644
--- a/app/src/main/res/menu/activity_main_drawer.xml
+++ b/app/src/main/res/menu/activity_main_drawer.xml
@@ -5,9 +5,9 @@
+ android:title="@string/menu_dashboard" />
-
+ app:startDestination="@+id/nav_dashboard">
+ android:id="@+id/nav_dashboard"
+ android:name="de.chrissthecoder.store.ui.dashboard.DashboardFragment"
+ android:label="@string/menu_dashboard"
+ tools:layout="@layout/fragment_dashboard" />
Navigation header
Settings
- Home
+ Dashboard
Gallery
Slideshow
+
+ Einkaufszettel
+ Minderbestand
\ No newline at end of file