From 917e0f9e3d38cd2ab582621af1cdda29ad19233d Mon Sep 17 00:00:00 2001
From: Fabio Heyming <fabio.heyming@web.de>
Date: Wed, 31 May 2023 00:57:19 +0200
Subject: [PATCH] keine Ahnung was

---
 .../com/example/mampfmobil/ui/CustomerActivity.java | 13 ++++++++-----
 .../ui/customer/CustomerOrdersFragment.java         | 10 ++++++++++
 .../ui/customer/CustomerShopFragment.java           |  9 +++++++++
 .../ui/customer/CustomerShoppingCartFragment.java   | 10 ++++++++++
 .../ui/supplier/SupplierOrdersFragment.java         | 11 +++++++++++
 app/src/main/res/layout/activity_supplier.xml       |  3 +--
 app/src/main/res/layout/recyclerview_ordersrow.xml  |  2 +-
 .../main/res/navigation/mobile_navigation_cus.xml   |  3 ++-
 .../main/res/navigation/mobile_navigation_del.xml   |  3 ++-
 .../main/res/navigation/mobile_navigation_sup.xml   |  3 ++-
 app/src/main/res/values-de-rDE/strings.xml          |  1 +
 app/src/main/res/values/strings.xml                 |  1 +
 12 files changed, 58 insertions(+), 11 deletions(-)

diff --git a/app/src/main/java/com/example/mampfmobil/ui/CustomerActivity.java b/app/src/main/java/com/example/mampfmobil/ui/CustomerActivity.java
index 64e970e..0e4e461 100644
--- a/app/src/main/java/com/example/mampfmobil/ui/CustomerActivity.java
+++ b/app/src/main/java/com/example/mampfmobil/ui/CustomerActivity.java
@@ -7,6 +7,7 @@ import android.util.Log;
 import com.example.mampfmobil.MainActivity;
 import com.example.mampfmobil.R;
 
+import androidx.appcompat.app.ActionBar;
 import androidx.appcompat.app.AppCompatActivity;
 import androidx.navigation.NavController;
 import androidx.navigation.Navigation;
@@ -36,9 +37,7 @@ private ActivityCustomerBinding binding;
 
         binding = ActivityCustomerBinding.inflate(getLayoutInflater());
         setContentView(binding.getRoot());
-
-
-
+        // Enable the back button in the ActionBar
 
 
         AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder(
@@ -47,7 +46,11 @@ private ActivityCustomerBinding binding;
         NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment_activity_customer);
         NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration);
         NavigationUI.setupWithNavController(binding.navView1, navController);
-
+        // Enable the back button in the ActionBar
+        ActionBar actionBar = getSupportActionBar();
+        if (actionBar != null) {
+            actionBar.setDisplayHomeAsUpEnabled(true);
+        }
 
 
 
@@ -106,4 +109,4 @@ private ActivityCustomerBinding binding;
     }
 
 
-}
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/mampfmobil/ui/customer/CustomerOrdersFragment.java b/app/src/main/java/com/example/mampfmobil/ui/customer/CustomerOrdersFragment.java
index ba6b377..6840c1a 100644
--- a/app/src/main/java/com/example/mampfmobil/ui/customer/CustomerOrdersFragment.java
+++ b/app/src/main/java/com/example/mampfmobil/ui/customer/CustomerOrdersFragment.java
@@ -1,5 +1,7 @@
 package com.example.mampfmobil.ui.customer;
 
+import androidx.appcompat.app.ActionBar;
+import androidx.appcompat.app.AppCompatActivity;
 import androidx.lifecycle.ViewModelProvider;
 
 import android.os.Bundle;
@@ -47,6 +49,14 @@ public class CustomerOrdersFragment extends Fragment {
         adapter.notifyDataSetChanged();
 
 
+        AppCompatActivity activity = (AppCompatActivity) requireActivity();
+        // Enable the back button in the ActionBar
+        ActionBar actionBar = activity.getSupportActionBar();
+        if (actionBar != null) {
+            actionBar.setDisplayHomeAsUpEnabled(true);
+        }
+
+
         return rootView;
     }
 
diff --git a/app/src/main/java/com/example/mampfmobil/ui/customer/CustomerShopFragment.java b/app/src/main/java/com/example/mampfmobil/ui/customer/CustomerShopFragment.java
index fd38a7e..f411482 100644
--- a/app/src/main/java/com/example/mampfmobil/ui/customer/CustomerShopFragment.java
+++ b/app/src/main/java/com/example/mampfmobil/ui/customer/CustomerShopFragment.java
@@ -1,5 +1,7 @@
 package com.example.mampfmobil.ui.customer;
 
+import androidx.appcompat.app.ActionBar;
+import androidx.appcompat.app.AppCompatActivity;
 import androidx.lifecycle.ViewModelProvider;
 
 import android.os.Bundle;
@@ -59,6 +61,13 @@ public class CustomerShopFragment extends Fragment {
             }
         });
 
+        AppCompatActivity activity = (AppCompatActivity) requireActivity();
+        // Enable the back button in the ActionBar
+        ActionBar actionBar = activity.getSupportActionBar();
+        if (actionBar != null) {
+            actionBar.setDisplayHomeAsUpEnabled(true);
+        }
+
         // Return the inflated rootView
         return rootView;
     }
diff --git a/app/src/main/java/com/example/mampfmobil/ui/customer/CustomerShoppingCartFragment.java b/app/src/main/java/com/example/mampfmobil/ui/customer/CustomerShoppingCartFragment.java
index d55befa..3dd92a5 100644
--- a/app/src/main/java/com/example/mampfmobil/ui/customer/CustomerShoppingCartFragment.java
+++ b/app/src/main/java/com/example/mampfmobil/ui/customer/CustomerShoppingCartFragment.java
@@ -1,5 +1,7 @@
 package com.example.mampfmobil.ui.customer;
 
+import androidx.appcompat.app.ActionBar;
+import androidx.appcompat.app.AppCompatActivity;
 import androidx.fragment.app.FragmentManager;
 import androidx.fragment.app.FragmentTransaction;
 import androidx.lifecycle.ViewModelProvider;
@@ -92,6 +94,14 @@ public class CustomerShoppingCartFragment extends Fragment {
             }
         });
 
+        AppCompatActivity activity = (AppCompatActivity) requireActivity();
+        // Enable the back button in the ActionBar
+        ActionBar actionBar = activity.getSupportActionBar();
+        if (actionBar != null) {
+            actionBar.setDisplayHomeAsUpEnabled(true);
+        }
+
+
         return rootView;
     }
 
diff --git a/app/src/main/java/com/example/mampfmobil/ui/supplier/SupplierOrdersFragment.java b/app/src/main/java/com/example/mampfmobil/ui/supplier/SupplierOrdersFragment.java
index 75a5080..2cb391a 100644
--- a/app/src/main/java/com/example/mampfmobil/ui/supplier/SupplierOrdersFragment.java
+++ b/app/src/main/java/com/example/mampfmobil/ui/supplier/SupplierOrdersFragment.java
@@ -1,5 +1,7 @@
 package com.example.mampfmobil.ui.supplier;
 
+import androidx.appcompat.app.ActionBar;
+import androidx.appcompat.app.AppCompatActivity;
 import androidx.lifecycle.ViewModelProvider;
 
 import android.os.Bundle;
@@ -25,6 +27,15 @@ public class SupplierOrdersFragment extends Fragment {
     @Override
     public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
                              @Nullable Bundle savedInstanceState) {
+
+
+        AppCompatActivity activity = (AppCompatActivity) requireActivity();
+        // Enable the back button in the ActionBar
+        ActionBar actionBar = activity.getSupportActionBar();
+        if (actionBar != null) {
+            actionBar.setDisplayHomeAsUpEnabled(true);
+        }
+
         return inflater.inflate(R.layout.fragment_supplier_orders, container, false);
     }
 
diff --git a/app/src/main/res/layout/activity_supplier.xml b/app/src/main/res/layout/activity_supplier.xml
index 39be748..ddacef9 100644
--- a/app/src/main/res/layout/activity_supplier.xml
+++ b/app/src/main/res/layout/activity_supplier.xml
@@ -4,8 +4,7 @@
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:id="@+id/container"
     android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:paddingTop="?attr/actionBarSize" >
+    android:layout_height="match_parent">
 
     <com.google.android.material.bottomnavigation.BottomNavigationView
         android:id="@+id/nav_view2"
diff --git a/app/src/main/res/layout/recyclerview_ordersrow.xml b/app/src/main/res/layout/recyclerview_ordersrow.xml
index c8147be..d2fa40b 100644
--- a/app/src/main/res/layout/recyclerview_ordersrow.xml
+++ b/app/src/main/res/layout/recyclerview_ordersrow.xml
@@ -71,7 +71,7 @@
                 android:id="@+id/textView7"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:text="State: "
+                android:text="@string/state_dp"
                 app:layout_constraintStart_toStartOf="@+id/textViewID"
                 app:layout_constraintTop_toBottomOf="@+id/textViewID" />
 
diff --git a/app/src/main/res/navigation/mobile_navigation_cus.xml b/app/src/main/res/navigation/mobile_navigation_cus.xml
index b987482..51c3fe1 100644
--- a/app/src/main/res/navigation/mobile_navigation_cus.xml
+++ b/app/src/main/res/navigation/mobile_navigation_cus.xml
@@ -3,7 +3,8 @@
     xmlns:app="http://schemas.android.com/apk/res-auto"
     xmlns:tools="http://schemas.android.com/tools"
     android:id="@+id/mobile_navigation_cus"
-    app:startDestination="@+id/navigation_shop">
+    app:startDestination="@+id/navigation_shop"
+    app:defaultNavHost="true">
 
     <fragment
         android:id="@+id/navigation_shop"
diff --git a/app/src/main/res/navigation/mobile_navigation_del.xml b/app/src/main/res/navigation/mobile_navigation_del.xml
index 5dcaf46..18692b6 100644
--- a/app/src/main/res/navigation/mobile_navigation_del.xml
+++ b/app/src/main/res/navigation/mobile_navigation_del.xml
@@ -3,7 +3,8 @@
     xmlns:app="http://schemas.android.com/apk/res-auto"
     xmlns:tools="http://schemas.android.com/tools"
     android:id="@+id/mobile_navigation_del"
-    app:startDestination="@+id/navigation_open_orders">
+    app:startDestination="@+id/navigation_open_orders"
+    app:defaultNavHost="true">
 
     <fragment
         android:id="@+id/navigation_open_orders"
diff --git a/app/src/main/res/navigation/mobile_navigation_sup.xml b/app/src/main/res/navigation/mobile_navigation_sup.xml
index 0cdaf29..3a66987 100644
--- a/app/src/main/res/navigation/mobile_navigation_sup.xml
+++ b/app/src/main/res/navigation/mobile_navigation_sup.xml
@@ -3,7 +3,8 @@
     xmlns:app="http://schemas.android.com/apk/res-auto"
     xmlns:tools="http://schemas.android.com/tools"
     android:id="@+id/mobile_navigation_sup"
-    app:startDestination="@+id/navigation_edit_item">
+    app:startDestination="@+id/navigation_edit_item"
+    app:defaultNavHost="true">
 
     <fragment
         android:id="@+id/navigation_add_item"
diff --git a/app/src/main/res/values-de-rDE/strings.xml b/app/src/main/res/values-de-rDE/strings.xml
index 3fbde07..53da538 100644
--- a/app/src/main/res/values-de-rDE/strings.xml
+++ b/app/src/main/res/values-de-rDE/strings.xml
@@ -33,4 +33,5 @@
     <string name="supplier_dp">Lieferant: </string>
     <string name="buyamount_dp">Kaufmenge:</string>
     <string name="price_dp">Preis: </string>
+    <string name="state_dp">"Status: "</string>
 </resources>
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 7bd5dac..3ed5454 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -32,4 +32,5 @@
     <string name="supplier_dp">Supplier: </string>
     <string name="buyamount_dp">Buyamount:</string>
     <string name="price_dp">Price: </string>
+    <string name="state_dp">"State: "</string>
 </resources>
\ No newline at end of file
-- 
GitLab