refactor home-fragment to dashboard-fragment and add a tablayout

This commit is contained in:
2024-05-31 16:09:58 +02:00
parent 82e7b9ecd8
commit 3544915f89
8 changed files with 47 additions and 45 deletions

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.dashboard.DashboardFragment">
<com.google.android.material.tabs.TabLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0">
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/tab_shoppinglist" />
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/tab_understock" />
</com.google.android.material.tabs.TabLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -1,22 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.home.HomeFragment">
<TextView
android:id="@+id/text_home"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:textAlignment="center"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -5,9 +5,9 @@
<group android:checkableBehavior="single">
<item
android:id="@+id/nav_home"
android:id="@+id/nav_dashboard"
android:icon="@drawable/ic_menu_camera"
android:title="@string/menu_home" />
android:title="@string/menu_dashboard" />
<item
android:id="@+id/nav_gallery"
android:icon="@drawable/ic_menu_gallery"

View File

@@ -3,13 +3,13 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/mobile_navigation"
app:startDestination="@+id/nav_home">
app:startDestination="@+id/nav_dashboard">
<fragment
android:id="@+id/nav_home"
android:name="de.chrissthecoder.store.ui.home.HomeFragment"
android:label="@string/menu_home"
tools:layout="@layout/fragment_home" />
android:id="@+id/nav_dashboard"
android:name="de.chrissthecoder.store.ui.dashboard.DashboardFragment"
android:label="@string/menu_dashboard"
tools:layout="@layout/fragment_dashboard" />
<fragment
android:id="@+id/nav_gallery"

View File

@@ -7,7 +7,10 @@
<string name="nav_header_desc">Navigation header</string>
<string name="action_settings">Settings</string>
<string name="menu_home">Home</string>
<string name="menu_dashboard">Dashboard</string>
<string name="menu_gallery">Gallery</string>
<string name="menu_slideshow">Slideshow</string>
<string name="tab_shoppinglist">Einkaufszettel</string>
<string name="tab_understock">Minderbestand</string>
</resources>