diff --git a/app/build.gradle b/app/build.gradle index cc693e15172ce4d1af48f70e08b25c672e43ac36..ae10dae5260168c66ffca157a6061ded8379b13a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -40,6 +40,7 @@ dependencies { implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1' implementation 'androidx.navigation:navigation-fragment:2.5.3' implementation 'androidx.navigation:navigation-ui:2.5.3' + implementation 'androidx.legacy:legacy-support-v4:1.0.0' testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.5' androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 7816bbe41312a360126baf465e0be525050f3a3c..cd007334236e58213bde063a6c70bd4398dbb4f4 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -6,12 +6,22 @@ android:allowBackup="true" android:dataExtractionRules="@xml/data_extraction_rules" android:fullBackupContent="@xml/backup_rules" - android:icon="@mipmap/ic_launcher" + android:icon="@drawable/mampfmobil_logo" android:label="@string/app_name" - android:roundIcon="@mipmap/ic_launcher_round" + android:roundIcon="@drawable/mampfmobil_logo" android:supportsRtl="true" android:theme="@style/Theme.MampfMobil" tools:targetApi="31"> + <activity + android:name=".ui.SupplierActivity" + android:exported="false" /> + <activity + android:name=".ui.DelivererActivity" + android:exported="false" /> + <activity + android:name=".ui.CustomerActivity" + android:exported="false" + android:label="@string/title_activity_customer" /> <activity android:name=".MainActivity" android:exported="true" diff --git a/app/src/main/java/com/example/mampfmobil/MainActivity.java b/app/src/main/java/com/example/mampfmobil/MainActivity.java index 6c02b9463cc18bfd45bdc610844fd5480971ac4b..9717569680bb927cacd185e7e863b651641b4110 100644 --- a/app/src/main/java/com/example/mampfmobil/MainActivity.java +++ b/app/src/main/java/com/example/mampfmobil/MainActivity.java @@ -1,16 +1,14 @@ package com.example.mampfmobil; +import android.content.Intent; import android.os.Bundle; - -import com.google.android.material.bottomnavigation.BottomNavigationView; +import android.util.Log; +import android.view.View; import androidx.appcompat.app.AppCompatActivity; -import androidx.navigation.NavController; -import androidx.navigation.Navigation; -import androidx.navigation.ui.AppBarConfiguration; -import androidx.navigation.ui.NavigationUI; import com.example.mampfmobil.databinding.ActivityMainBinding; +import com.example.mampfmobil.ui.MampfMobil; public class MainActivity extends AppCompatActivity { @@ -20,18 +18,48 @@ public class MainActivity extends AppCompatActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + + binding = ActivityMainBinding.inflate(getLayoutInflater()); setContentView(binding.getRoot()); + MampfMobil meinMampf = new MampfMobil(binding.getRoot().getContext()); + + // Hier wird die Bottom Navigation View ausgeblendet + binding.navView.setVisibility(View.GONE); + + // Fragment "fragment_decide" wird angezeigt + //Fragment fragment = new DecideFragment(); + //FragmentManager fragmentManager = getSupportFragmentManager(); + //fragmentManager.beginTransaction().replace(R.id.nav_host_fragment_activity_main, fragment).commit(); - BottomNavigationView navView = findViewById(R.id.nav_view); - // Passing each menu ID as a set of Ids because each - // menu should be considered as top level destinations. - AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder( - R.id.navigation_home, R.id.navigation_dashboard, R.id.navigation_notifications) - .build(); - NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment_activity_main); - NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration); - NavigationUI.setupWithNavController(binding.navView, navController); } + @Override + public boolean onSupportNavigateUp() { + Intent intent = new Intent(this, MainActivity.class); + startActivity(intent); + return true; // true zurückgeben, um anzugeben, dass die Aktion behandelt wurde + } + + @Override + protected void onPause() { + Log.d("myTag", "This ONPAUSE"); + super.onPause(); + } + + @Override + protected void onStop() { + Log.d("myTag", "SAVED PERSISTANT"); + MampfMobil.savePersistant(); + super.onStop(); + } + + @Override + protected void onDestroy() { + Log.d("myTag", "This ONDESTROY"); + super.onDestroy(); + } + + + } \ No newline at end of file diff --git a/app/src/main/java/com/example/mampfmobil/ui/CSVFileHelper.java b/app/src/main/java/com/example/mampfmobil/ui/CSVFileHelper.java new file mode 100644 index 0000000000000000000000000000000000000000..7f621485f0d136e35e6f00681fc51c5ab72f5c18 --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/CSVFileHelper.java @@ -0,0 +1,53 @@ +package com.example.mampfmobil.ui; + +import android.content.Context; + +import java.io.BufferedReader; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; + +public class CSVFileHelper { + public static void saveCSVFile(Context context, String fileName, String csvData) { + FileOutputStream fos = null; + try { + fos = context.openFileOutput(fileName, Context.MODE_PRIVATE); + fos.write(csvData.getBytes()); + } catch (IOException e) { + e.printStackTrace(); + } finally { + if (fos != null) { + try { + fos.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } + public static String loadCSVFile(Context context, String fileName) { + FileInputStream fis = null; + try { + fis = context.openFileInput(fileName); + BufferedReader reader = new BufferedReader(new InputStreamReader(fis)); + StringBuilder sb = new StringBuilder(); + String line; + while ((line = reader.readLine()) != null) { + sb.append(line).append("\n"); + } + return sb.toString(); + } catch (IOException e) { + e.printStackTrace(); + } finally { + if (fis != null) { + try { + fis.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + return null; + } +} diff --git a/app/src/main/java/com/example/mampfmobil/ui/Classes/Bestellung.java b/app/src/main/java/com/example/mampfmobil/ui/Classes/Bestellung.java new file mode 100644 index 0000000000000000000000000000000000000000..9549ef10ceabaa756fff6dc757921c79c3469772 --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/Classes/Bestellung.java @@ -0,0 +1,86 @@ +package com.example.mampfmobil.ui.Classes; + +import android.content.Context; +import android.util.Log; + +import com.example.mampfmobil.R; +import com.example.mampfmobil.ui.MampfMobil; + +import java.util.Vector; + +public class Bestellung { + + static int idCounter = 1; + + public boolean delivery = true; + public Deliverer deliverer = null; + + public String state; + public Supplier supplier; + public Customer costumer; + public Vector<BestellungsTeil> bestellungsTeile; + + public int id; + + public Bestellung(Supplier supplier, Boolean delivery, Context context){ + bestellungsTeile = new Vector<>(); + this.supplier = supplier; + state = context.getString(R.string.ordered) ; + this.delivery = delivery; + this.costumer = MampfMobil.currentCustomer; + id = idCounter; + idCounter++; + } + + public Bestellung(Supplier supplier, Boolean delivery,String state){ + bestellungsTeile = new Vector<>(); + this.supplier = supplier; + this.state = state ; + this.delivery = delivery; + this.costumer = MampfMobil.currentCustomer; + id = idCounter; + idCounter++; + } + + //for dummy data + public Bestellung(Supplier supplier, Boolean delivery,String state,Customer costumer){ + bestellungsTeile = new Vector<>(); + this.supplier = supplier; + this.state = state ; + this.delivery = delivery; + this.costumer = costumer; + id = idCounter; + idCounter++; + } + + public Bestellung(int id,Supplier supplier, Boolean delivery,String state,Customer costumer, int delivererID){ + bestellungsTeile = new Vector<>(); + this.supplier = supplier; + this.state = state ; + this.delivery = delivery; + this.costumer = costumer; + this.id = id; + if(delivererID != 0){ + for(Deliverer d: MampfMobil.deliverers){ + if(d.id == delivererID) { + this.deliverer = d; + } + } + } + } + public void addBestellungsteil(BestellungsTeil bt){ + + Boolean notFound = true; + for(BestellungsTeil btOld: bestellungsTeile){ + if(btOld.item == bt.item){ + notFound = false; + btOld.quantity = btOld.quantity + bt.quantity; + } + } + if(notFound){ + bestellungsTeile.add(bt); + } + + } + +} diff --git a/app/src/main/java/com/example/mampfmobil/ui/Classes/BestellungsTeil.java b/app/src/main/java/com/example/mampfmobil/ui/Classes/BestellungsTeil.java new file mode 100644 index 0000000000000000000000000000000000000000..0964c9ab2bab71009fd12ae0f8d36d67e9c6cd23 --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/Classes/BestellungsTeil.java @@ -0,0 +1,11 @@ +package com.example.mampfmobil.ui.Classes; + +public class BestellungsTeil { + public Item item; + public int quantity; + + public BestellungsTeil(Item item, int quantity){ + this.item = item; + this.quantity = quantity; + } +} diff --git a/app/src/main/java/com/example/mampfmobil/ui/Classes/Customer.java b/app/src/main/java/com/example/mampfmobil/ui/Classes/Customer.java new file mode 100644 index 0000000000000000000000000000000000000000..46ae62b3463bf8020d8121c9d8a27ad5bdaec653 --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/Classes/Customer.java @@ -0,0 +1,78 @@ +package com.example.mampfmobil.ui.Classes; + +import android.util.Log; + +import java.util.ArrayList; +import java.util.Vector; + +public class Customer { + public String vorname; + public String nachname; + public String adresse; + + public Vector<Bestellung> bestellungen; + + public Vector<ShopItem> favoriten; + public Vector<BestellungsTeil> shoppingCart; + + public static int idCounter = 1; + public int id; + + public void addBestellung(Bestellung bestellung){ + if (bestellungen == null) { + bestellungen = new Vector<>(); + } + bestellungen.add(bestellung); + } + + public Customer(String vorname,String nachname,String adresse) { + this.vorname = vorname; + this.nachname = nachname; + this.adresse = adresse; + favoriten = new Vector<>(); + shoppingCart = new Vector<>(); + bestellungen = new Vector<>(); + id = idCounter; + idCounter++; + } + + public Customer(int id,String vorname,String nachname,String adresse) { + this.vorname = vorname; + this.nachname = nachname; + this.adresse = adresse; + favoriten = new Vector<>(); + shoppingCart = new Vector<>(); + bestellungen = new Vector<>(); + this.id = id; + } + + public void addToShoppingCart(BestellungsTeil bt){ + if (shoppingCart == null) { + shoppingCart = new Vector<>(); + } + Boolean notFound = true; + for(BestellungsTeil btOld: shoppingCart){ + if(btOld.item == bt.item){ + notFound = false; + btOld.quantity = btOld.quantity + bt.quantity; + } + } + if(notFound){ + shoppingCart.add(bt); + } + } + public void addToFavourits(ShopItem sI){ + favoriten.add(sI); + } + public void removeFromFavourits(ShopItem sI){ + + ArrayList<ShopItem> itemsToRemove = new ArrayList<>(); + + for(ShopItem si: favoriten){ + if(si == sI){ + itemsToRemove.add(si); + } + } + favoriten.removeAll(itemsToRemove); + } +} diff --git a/app/src/main/java/com/example/mampfmobil/ui/Classes/Deliverer.java b/app/src/main/java/com/example/mampfmobil/ui/Classes/Deliverer.java new file mode 100644 index 0000000000000000000000000000000000000000..74dd0bf73057fe8a9d7cd2a8e8fe3f7f027735f7 --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/Classes/Deliverer.java @@ -0,0 +1,25 @@ +package com.example.mampfmobil.ui.Classes; + +public class Deliverer { + public String vorname; + public String nachname; + public String adresse; + + public static int idCounter = 1; + public int id; + + + public Deliverer(String vorname,String nachname,String adresse) { + this.vorname = vorname; + this.nachname = nachname; + this.adresse = adresse; + id = idCounter; + idCounter++; + } + public Deliverer(int id,String vorname,String nachname,String adresse) { + this.vorname = vorname; + this.nachname = nachname; + this.adresse = adresse; + this.id = id; + } +} diff --git a/app/src/main/java/com/example/mampfmobil/ui/Classes/Item.java b/app/src/main/java/com/example/mampfmobil/ui/Classes/Item.java new file mode 100644 index 0000000000000000000000000000000000000000..e69f328afbc1d1fb79e8278646d16a1cc662ba4a --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/Classes/Item.java @@ -0,0 +1,27 @@ +package com.example.mampfmobil.ui.Classes; + +import android.util.Log; + +public class Item { + public static int idCounter = 1; + public int id; + public String name; + public double price; + public Supplier supplier; + + + public Item(String name, double price,Supplier supplier){ + this.name = name; + this.price = price; + this.supplier = supplier; + id = idCounter; + idCounter++; + } + public Item(int id,String name, double price,Supplier supplier){ + + this.name = name; + this.price = price; + this.supplier = supplier; + this.id = id; + } +} diff --git a/app/src/main/java/com/example/mampfmobil/ui/Classes/Recyclerviewadapter_Orders.java b/app/src/main/java/com/example/mampfmobil/ui/Classes/Recyclerviewadapter_Orders.java new file mode 100644 index 0000000000000000000000000000000000000000..12eb46c0b8c626d6eb6dc322b7d25ba3be3fc36b --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/Classes/Recyclerviewadapter_Orders.java @@ -0,0 +1,83 @@ +package com.example.mampfmobil.ui.Classes; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import com.example.mampfmobil.R; +import com.example.mampfmobil.ui.MampfMobil; + +import java.util.Vector; + +public class Recyclerviewadapter_Orders extends RecyclerView.Adapter<Recyclerviewadapter_Orders.MyViewHolder>{ + + + Context context; + Vector<Bestellung> bestellungen = new Vector<>(); + + public Recyclerviewadapter_Orders(Context context){ + this.context =context; + this.bestellungen = MampfMobil.currentCustomer.bestellungen; + } + @NonNull + @Override + public Recyclerviewadapter_Orders.MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + LayoutInflater inflator = LayoutInflater.from(context); + View view = inflator.inflate(R.layout.recyclerview_ordersrow,parent,false); + + return new Recyclerviewadapter_Orders.MyViewHolder(view); + } + + @Override + public void onBindViewHolder(@NonNull Recyclerviewadapter_Orders.MyViewHolder holder, int position) { + holder.tvSupplier.setText(bestellungen.get(position).supplier.name); + holder.tvID.setText(String.valueOf("# " + bestellungen.get(position).id)); + holder.tvState.setText(bestellungen.get(position).state); + double temp = 0; + for(BestellungsTeil bt:bestellungen.get(position).bestellungsTeile){ + temp = temp + bt.item.price * bt.quantity; + } + holder.tvTotalCost.setText(String.format("%.2f", temp) + " €"); + + if(bestellungen.get(position).delivery){ + holder.tvDelivery.setText(context.getString(R.string.delivery)); + } + else{ + holder.tvDelivery.setText(context.getString(R.string.pickup)); + } + + // Initialisiere und konfiguriere den Recyclerviewadapter_Orders_Parts + Recyclerviewadapter_Orders_Parts ordersPartsAdapter = new Recyclerviewadapter_Orders_Parts(context, bestellungen.get(position).bestellungsTeile); + LinearLayoutManager layoutManager = new LinearLayoutManager(context); + holder.recyclerViewOrders.setLayoutManager(layoutManager); + holder.recyclerViewOrders.setAdapter(ordersPartsAdapter); + + } + + @Override + public int getItemCount() { + return bestellungen.size(); + } + + public static class MyViewHolder extends RecyclerView.ViewHolder { + + TextView tvID, tvSupplier,tvDelivery,tvState,tvTotalCost; + RecyclerView recyclerViewOrders; + public MyViewHolder(@NonNull View itemView) { + super(itemView); + + tvID = itemView.findViewById(R.id.textViewID); + tvSupplier = itemView.findViewById(R.id.textViewSupplierName); + tvState = itemView.findViewById(R.id.textViewState); + tvDelivery = itemView.findViewById(R.id.textViewDelivery); + recyclerViewOrders =itemView.findViewById(R.id.recyclerViewOrders); + tvTotalCost =itemView.findViewById(R.id.textViewTotalCost); + } + } +} diff --git a/app/src/main/java/com/example/mampfmobil/ui/Classes/Recyclerviewadapter_Orders_Parts.java b/app/src/main/java/com/example/mampfmobil/ui/Classes/Recyclerviewadapter_Orders_Parts.java new file mode 100644 index 0000000000000000000000000000000000000000..c09691b577b513c767677848913a558d4746db4f --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/Classes/Recyclerviewadapter_Orders_Parts.java @@ -0,0 +1,63 @@ +package com.example.mampfmobil.ui.Classes; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.EditText; +import android.widget.ImageButton; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.example.mampfmobil.R; + +import java.util.Vector; + +public class Recyclerviewadapter_Orders_Parts extends RecyclerView.Adapter<Recyclerviewadapter_Orders_Parts.MyViewHolder> { + + Context context; + public Vector<BestellungsTeil> bestellungsTeile; + + public Recyclerviewadapter_Orders_Parts(Context context, Vector<BestellungsTeil> bestellungsTeile){ + this.context = context; + this.bestellungsTeile = bestellungsTeile; + } + + @NonNull + @Override + public Recyclerviewadapter_Orders_Parts.MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + LayoutInflater inflater = LayoutInflater.from(context); + View view = inflater.inflate(R.layout.recyclerview_orders_partrows,parent,false); + return new Recyclerviewadapter_Orders_Parts.MyViewHolder(view); + } + + @Override + public void onBindViewHolder(@NonNull Recyclerviewadapter_Orders_Parts.MyViewHolder holder, int position) { + holder.tvName.setText(bestellungsTeile.get(position).item.name); + holder.tvAmountNr.setText(String.valueOf(bestellungsTeile.get(position).quantity)); + holder.tvPrice.setText(String.format("%.2f", (bestellungsTeile.get(position).item.price)) + " €"); + holder.tvSum.setText(String.valueOf(bestellungsTeile.get(position).item.price*bestellungsTeile.get(position).quantity)); + } + + @Override + public int getItemCount() { + return bestellungsTeile.size(); + } + + public static class MyViewHolder extends RecyclerView.ViewHolder { + + TextView tvName, tvAmountNr, tvPrice, tvSum; + + public MyViewHolder(@NonNull View itemView) { + super(itemView); + tvName = itemView.findViewById(R.id.textViewName); + tvAmountNr = itemView.findViewById(R.id.textView); + tvPrice = itemView.findViewById(R.id.textViewPrice); + tvSum = itemView.findViewById(R.id.textViewSum); + } + } + + +} diff --git a/app/src/main/java/com/example/mampfmobil/ui/Classes/Recyclerviewadapter_Shop.java b/app/src/main/java/com/example/mampfmobil/ui/Classes/Recyclerviewadapter_Shop.java new file mode 100644 index 0000000000000000000000000000000000000000..6c23b77be2b6f135ced720ba3acf026349300943 --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/Classes/Recyclerviewadapter_Shop.java @@ -0,0 +1,161 @@ +package com.example.mampfmobil.ui.Classes; + +import android.content.Context; +import android.graphics.Paint; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.CheckBox; +import android.widget.CompoundButton; +import android.widget.EditText; +import android.widget.TextView; +import android.widget.Toast; + +import androidx.annotation.NonNull; +import androidx.core.content.ContextCompat; +import androidx.recyclerview.widget.RecyclerView; + +import com.example.mampfmobil.R; +import com.example.mampfmobil.ui.CustomerActivity; +import com.example.mampfmobil.ui.MampfMobil; + +import java.util.ArrayList; +import java.util.Vector; + +public class Recyclerviewadapter_Shop extends RecyclerView.Adapter<Recyclerviewadapter_Shop.MyViewHolder> { + static Context context; + ArrayList<ShopItem> shopItemList; + + public static Toast toast; + + public Recyclerviewadapter_Shop(Context context, ArrayList<ShopItem> shopItemList){ + this.context = context; + this.shopItemList = shopItemList; + + } + + @NonNull + @Override + public Recyclerviewadapter_Shop.MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + + LayoutInflater inflater = LayoutInflater.from(context); + View view = inflater.inflate(R.layout.recyclerview_shoprow,parent,false); + return new Recyclerviewadapter_Shop.MyViewHolder(view); + } + + @Override + public void onBindViewHolder(@NonNull Recyclerviewadapter_Shop.MyViewHolder holder, int position) { + holder.tvName.setText(shopItemList.get(position).item.name); + holder.tvSupName.setText(shopItemList.get(position).item.supplier.name); + holder.tvAmountNr.setText(String.valueOf(shopItemList.get(position).quantity)); + holder.tvPrice.setText(String.format("%.2f", shopItemList.get(position).item.price) + " €"); + holder.sI = shopItemList.get(position); + Vector<ShopItem> favs = new Vector<>(); + favs = MampfMobil.currentCustomer.favoriten; + + holder.favBox.setOnCheckedChangeListener(null); + + boolean found = false; + for(ShopItem sI:favs ){ + if(sI.item == shopItemList.get(position).item){ + found = true; + } + } + if(found){ + holder.favBox.setChecked(true); + } + else{ + holder.favBox.setChecked(false); + } + + + holder.favBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + + if (isChecked) { + + MampfMobil.currentCustomer.addToFavourits(holder.sI); + } else { + + MampfMobil.currentCustomer.removeFromFavourits(holder.sI); + } + } + }); + + + holder.tvSupName.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + CustomerActivity.setupShop(holder.sI.item.supplier); + notifyDataSetChanged(); + } + }); + + + } + + + + @Override + public int getItemCount() { + return shopItemList.size(); + } + + public static class MyViewHolder extends RecyclerView.ViewHolder { + + Button buyButton; + CheckBox favBox; + EditText inputAmount; + TextView tvName, tvSupName, tvAmountNr,tvPrice; + + ShopItem sI; + + + public MyViewHolder(@NonNull View itemView) { + super(itemView); + + tvName = itemView.findViewById(R.id.textViewName); + tvSupName = itemView.findViewById(R.id.textViewSupplierName); + tvSupName.setPaintFlags(tvSupName.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); + tvSupName.setTextColor(ContextCompat.getColor(context, android.R.color.holo_blue_dark)); + + tvAmountNr = itemView.findViewById(R.id.textViewAmountNumber); + inputAmount = itemView.findViewById(R.id.editText); + buyButton = itemView.findViewById(R.id.buttonBuy); + favBox = itemView.findViewById(R.id.checkBox1); + tvPrice = itemView.findViewById(R.id.textViewPrice); + buyButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + if (toast != null) { + toast.cancel(); // Vorhandene Toast-Nachricht abbrechen + } + toast = Toast.makeText(v.getContext(), R.string.added_to_shopping_cart, Toast.LENGTH_SHORT); + toast.show(); + MampfMobil.currentCustomer.addToShoppingCart(new BestellungsTeil(sI.item,Integer.parseInt(inputAmount.getText().toString()))); + } + }); + + /*favBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + + if(isChecked) { + + MampfMobil.currentCustomer.addToFavourits(sI); + } + else{ + + MampfMobil.currentCustomer.removeFromFavourits(sI); + } + } + });*/ + + } + } +} diff --git a/app/src/main/java/com/example/mampfmobil/ui/Classes/Recyclerviewadapter_ShoppingCart.java b/app/src/main/java/com/example/mampfmobil/ui/Classes/Recyclerviewadapter_ShoppingCart.java new file mode 100644 index 0000000000000000000000000000000000000000..0fd135f482517650fdaa788d8ac73a97abc040d8 --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/Classes/Recyclerviewadapter_ShoppingCart.java @@ -0,0 +1,115 @@ +package com.example.mampfmobil.ui.Classes; + +import android.content.Context; +import android.text.Editable; +import android.text.TextWatcher; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.CheckBox; +import android.widget.EditText; +import android.widget.ImageButton; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.example.mampfmobil.R; +import com.example.mampfmobil.ui.MampfMobil; +import com.example.mampfmobil.ui.customer.CustomerShoppingCartFragment; + +import java.util.Vector; + +public class Recyclerviewadapter_ShoppingCart extends RecyclerView.Adapter<Recyclerviewadapter_ShoppingCart.MyViewHolder> { + Context context; + Vector<BestellungsTeil> shoppingCart; + + public Recyclerviewadapter_ShoppingCart(Context context){ + this.context = context; + shoppingCart = MampfMobil.currentCustomer.shoppingCart; + } + + @NonNull + @Override + public Recyclerviewadapter_ShoppingCart.MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + LayoutInflater inflater = LayoutInflater.from(context); + View view = inflater.inflate(R.layout.recyclerview_shoppingcartrow, parent, false); + return new Recyclerviewadapter_ShoppingCart.MyViewHolder(view); + } + + @Override + public void onBindViewHolder(@NonNull Recyclerviewadapter_ShoppingCart.MyViewHolder holder, int position) { + holder.tvName.setText(shoppingCart.get(position).item.name); + holder.tvSupName.setText(shoppingCart.get(position).item.supplier.name); + holder.tvAmountNr.setText(String.valueOf(MampfMobil.getItemQuantity(shoppingCart.get(position).item))); + holder.inputAmount.setText(String.valueOf(shoppingCart.get(position).quantity)); + holder.tvPrice.setText(String.format("%.2f", (shoppingCart.get(position).item.price)) + " €"); + holder.tvSum.setText(String.format("%.2f", (shoppingCart.get(position).item.price * shoppingCart.get(position).quantity)) + " €"); + + holder.inputAmount.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence s, int start, int count, int after) { + + } + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + } + + @Override + public void afterTextChanged(Editable s) { + + if(!holder.inputAmount.getText().toString().equals("")){ + + shoppingCart.get(position).quantity = Integer.parseInt(holder.inputAmount.getText().toString()); + holder.tvSum.setText(String.format("%.2f", (shoppingCart.get(position).item.price * shoppingCart.get(position).quantity)) + " €"); + CustomerShoppingCartFragment.setSum(); + } + //shoppingCart.get(position).quantity = Integer.parseInt(holder.inputAmount.getText().toString()); + } + }); + + holder.deleteButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + int adapterPosition = holder.getAdapterPosition(); + if (adapterPosition != RecyclerView.NO_POSITION) { + removeItem(adapterPosition); + } + } + }); + } + + @Override + public int getItemCount() { + return shoppingCart.size(); + } + + public void removeItem(int position) { + shoppingCart.remove(position); + CustomerShoppingCartFragment.setSum(); + notifyItemRemoved(position); + + notifyDataSetChanged(); + } + + public static class MyViewHolder extends RecyclerView.ViewHolder { + ImageButton deleteButton; + EditText inputAmount; + TextView tvName, tvSupName, tvAmountNr, tvPrice, tvSum; + BestellungsTeil bt; + + public MyViewHolder(@NonNull View itemView) { + super(itemView); + tvName = itemView.findViewById(R.id.textViewName); + tvSupName = itemView.findViewById(R.id.textViewSupplierName); + tvAmountNr = itemView.findViewById(R.id.textViewAmountNumber); + inputAmount = itemView.findViewById(R.id.editText); + tvPrice = itemView.findViewById(R.id.textViewPrice); + tvSum = itemView.findViewById(R.id.textViewSum); + deleteButton = itemView.findViewById(R.id.deleteButton); + } + } +} diff --git a/app/src/main/java/com/example/mampfmobil/ui/Classes/Recyclerviewadapter_Supplier_Orders.java b/app/src/main/java/com/example/mampfmobil/ui/Classes/Recyclerviewadapter_Supplier_Orders.java new file mode 100644 index 0000000000000000000000000000000000000000..34f0acf9dd52d92ef029b607ee87525dbf2959ae --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/Classes/Recyclerviewadapter_Supplier_Orders.java @@ -0,0 +1,142 @@ +package com.example.mampfmobil.ui.Classes; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import com.example.mampfmobil.R; +import com.example.mampfmobil.ui.MampfMobil; + +import java.util.Vector; + +public class Recyclerviewadapter_Supplier_Orders extends RecyclerView.Adapter<Recyclerviewadapter_Supplier_Orders.MyViewHolder>{ + + + Context context; + Vector<Bestellung> bestellungen = new Vector<>(); + + public Recyclerviewadapter_Supplier_Orders(Context context){ + this.context =context; + for(Customer c:MampfMobil.customers){ + for(Bestellung b:c.bestellungen){ + if(b.supplier==MampfMobil.currentSupplier&&b.state.equals(context.getString(R.string.ordered))){ + bestellungen.add(b); + } + } + } + for(Customer c:MampfMobil.customers){ + for(Bestellung b:c.bestellungen){ + if(b.supplier==MampfMobil.currentSupplier&&b.state.equals(context.getString(R.string.ready))){ + bestellungen.add(b); + } + } + } + for(Customer c:MampfMobil.customers){ + for(Bestellung b:c.bestellungen){ + if(b.supplier==MampfMobil.currentSupplier&&b.state.equals(context.getString(R.string.picked))){ + bestellungen.add(b); + } + } + } + for(Customer c:MampfMobil.customers){ + for(Bestellung b:c.bestellungen){ + if(b.supplier==MampfMobil.currentSupplier){ + if(!bestellungen.contains(b)){bestellungen.add(b);} + } + } + } + } + @NonNull + @Override + public Recyclerviewadapter_Supplier_Orders.MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + LayoutInflater inflator = LayoutInflater.from(context); + View view = inflator.inflate(R.layout.recyclerview_supplierordersrow,parent,false); + + return new Recyclerviewadapter_Supplier_Orders.MyViewHolder(view); + } + + @Override + public void onBindViewHolder(@NonNull Recyclerviewadapter_Supplier_Orders.MyViewHolder holder, int position) { + holder.tvID.setText(String.valueOf("# " + bestellungen.get(position).id)); + holder.tvState.setText(bestellungen.get(position).state); + if(bestellungen.get(position).state.equals(context.getString(R.string.ordered))){ + holder.readyButton.setText(context.getString(R.string.ready)); + } + else if(bestellungen.get(position).state.equals(context.getString(R.string.readyForPickup))){ + holder.readyButton.setText(context.getString(R.string.picked)); + } + else{ + holder.readyButton.setVisibility(View.INVISIBLE); + } + + double temp = 0; + for(BestellungsTeil bt:bestellungen.get(position).bestellungsTeile){ + temp = temp + bt.item.price * bt.quantity; + } + holder.tvTotalCost.setText(String.format("%.2f", temp) + " €"); + + if(bestellungen.get(position).delivery){ + holder.tvDelivery.setText(context.getString(R.string.delivery)); + } + else{ + holder.tvDelivery.setText(context.getString(R.string.pickup)); + } + + // Initialisiere und konfiguriere den Recyclerviewadapter_Orders_Parts + Recyclerviewadapter_Orders_Parts ordersPartsAdapter = new Recyclerviewadapter_Orders_Parts(context, bestellungen.get(position).bestellungsTeile); + LinearLayoutManager layoutManager = new LinearLayoutManager(context); + holder.recyclerViewOrders.setLayoutManager(layoutManager); + holder.recyclerViewOrders.setAdapter(ordersPartsAdapter); + + + holder.readyButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (bestellungen.get(position).state.equals(context.getString(R.string.readyForPickup))) { + bestellungen.get(position).state = context.getString(R.string.picked); + notifyItemRangeChanged(position, getItemCount()); + } + if (bestellungen.get(position).state.equals(context.getString(R.string.ordered))) { + if(bestellungen.get(position).delivery){ + bestellungen.get(position).state = context.getString(R.string.readyForTransport); + } + else{ + bestellungen.get(position).state = context.getString(R.string.readyForPickup); + } + + notifyItemRangeChanged(position, getItemCount()); + } + } + }); + + } + + @Override + public int getItemCount() { + return bestellungen.size(); + } + + public static class MyViewHolder extends RecyclerView.ViewHolder { + + TextView tvID, tvDelivery,tvState,tvTotalCost; + RecyclerView recyclerViewOrders; + Button readyButton; + public MyViewHolder(@NonNull View itemView) { + super(itemView); + + tvID = itemView.findViewById(R.id.textViewID);; + tvState = itemView.findViewById(R.id.textViewState); + tvDelivery = itemView.findViewById(R.id.textViewDelivery); + recyclerViewOrders =itemView.findViewById(R.id.recyclerViewOrders); + tvTotalCost =itemView.findViewById(R.id.textViewTotalCost); + readyButton = itemView.findViewById(R.id.buttonReady); + } + } +} diff --git a/app/src/main/java/com/example/mampfmobil/ui/Classes/Recyclerviewadapter_deliverer_activeOrders.java b/app/src/main/java/com/example/mampfmobil/ui/Classes/Recyclerviewadapter_deliverer_activeOrders.java new file mode 100644 index 0000000000000000000000000000000000000000..a04daa2224bdde6af23bb91d0a6df5b964bb1c0e --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/Classes/Recyclerviewadapter_deliverer_activeOrders.java @@ -0,0 +1,116 @@ +package com.example.mampfmobil.ui.Classes; + +import android.content.Context; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.example.mampfmobil.R; +import com.example.mampfmobil.ui.MampfMobil; +import com.example.mampfmobil.ui.deliverer.DelivererActiveOrdersFragment; +import com.example.mampfmobil.ui.deliverer.DelivererOpenOrdersFragment; + +import java.util.Vector; + +public class Recyclerviewadapter_deliverer_activeOrders extends RecyclerView.Adapter<Recyclerviewadapter_deliverer_activeOrders.MyViewHolder>{ + + + Context context; + Vector<Bestellung> bestellungen = new Vector<>(); + + public Recyclerviewadapter_deliverer_activeOrders(Context context, Vector<Bestellung> bestellungen ){ + this.context =context; + this.bestellungen = bestellungen; + } + @NonNull + @Override + public Recyclerviewadapter_deliverer_activeOrders.MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + LayoutInflater inflator = LayoutInflater.from(context); + View view = inflator.inflate(R.layout.recyclerview_deliverer_orderrow,parent,false); + + return new Recyclerviewadapter_deliverer_activeOrders.MyViewHolder(view); + } + + @Override + public void onBindViewHolder(@NonNull Recyclerviewadapter_deliverer_activeOrders.MyViewHolder holder, int position) { + holder.tvID.setText(String.valueOf("# " + bestellungen.get(position).id)); + holder.tvState.setText(bestellungen.get(position).state); + + if(bestellungen.get(position).state.equals(context.getString(R.string.inTransportation))){ + holder.readyButton.setText(context.getString(R.string.delivered)); + } + else if(bestellungen.get(position).state.equals(context.getString(R.string.readyForTransportDelivererFound))){ + holder.readyButton.setText(context.getString(R.string.inTransportation)); + } + else if(bestellungen.get(position).state.equals(context.getString(R.string.readyForTransport))){ + holder.readyButton.setText(context.getString(R.string.reserve)); + } + else{ + holder.readyButton.setVisibility(View.INVISIBLE); + } + + + + holder.readyButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + if (bestellungen.get(position).state.equals(context.getString(R.string.inTransportation))) { + + + bestellungen.get(position).state = context.getString(R.string.delivered); + int adapterPosition = holder.getAdapterPosition(); + if (adapterPosition != RecyclerView.NO_POSITION) { + removeItem(adapterPosition); + } + DelivererActiveOrdersFragment.setVec(context); + notifyItemRangeChanged(position, getItemCount()); + return; + } + if (bestellungen.get(position).state.equals(context.getString(R.string.readyForTransportDelivererFound))) { + bestellungen.get(position).state = context.getString(R.string.inTransportation); + DelivererActiveOrdersFragment.setVec(context); + notifyItemRangeChanged(position, getItemCount()); + return; + } + } + }); + + } + + public void removeItem(int position) { + bestellungen.remove(position); + notifyItemRemoved(position); + notifyItemRangeChanged(position, getItemCount()); + } + + @Override + public int getItemCount() { + return bestellungen.size(); + } + + public static class MyViewHolder extends RecyclerView.ViewHolder { + + TextView tvID, tvDelivery,tvState,tvTotalCost,cusAddress,supAddress; + RecyclerView recyclerViewOrders; + Button readyButton; + public MyViewHolder(@NonNull View itemView) { + super(itemView); + + cusAddress = itemView.findViewById(R.id.textView17); + supAddress = itemView.findViewById(R.id.textView14); + tvID = itemView.findViewById(R.id.textViewID);; + tvState = itemView.findViewById(R.id.textViewState); + tvDelivery = itemView.findViewById(R.id.textViewDelivery); + recyclerViewOrders =itemView.findViewById(R.id.recyclerViewOrders); + tvTotalCost =itemView.findViewById(R.id.textViewTotalCost); + readyButton = itemView.findViewById(R.id.buttonReady); + } + } +} diff --git a/app/src/main/java/com/example/mampfmobil/ui/Classes/Recyclerviewadapter_deliverer_closedOrders.java b/app/src/main/java/com/example/mampfmobil/ui/Classes/Recyclerviewadapter_deliverer_closedOrders.java new file mode 100644 index 0000000000000000000000000000000000000000..bc1b793b2d4fd7ba7c8cfaf387058b33e6e93c13 --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/Classes/Recyclerviewadapter_deliverer_closedOrders.java @@ -0,0 +1,112 @@ +package com.example.mampfmobil.ui.Classes; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.example.mampfmobil.R; +import com.example.mampfmobil.ui.MampfMobil; +import com.example.mampfmobil.ui.deliverer.DelivererOpenOrdersFragment; + +import java.util.Vector; + +public class Recyclerviewadapter_deliverer_closedOrders extends RecyclerView.Adapter<Recyclerviewadapter_deliverer_closedOrders.MyViewHolder>{ + + + Context context; + Vector<Bestellung> bestellungen = new Vector<>(); + + public Recyclerviewadapter_deliverer_closedOrders(Context context, Vector<Bestellung> bestellungen ){ + this.context =context; + this.bestellungen = bestellungen; + } + @NonNull + @Override + public Recyclerviewadapter_deliverer_closedOrders.MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + LayoutInflater inflator = LayoutInflater.from(context); + View view = inflator.inflate(R.layout.recyclerview_deliverer_orderrow,parent,false); + + return new Recyclerviewadapter_deliverer_closedOrders.MyViewHolder(view); + } + + @Override + public void onBindViewHolder(@NonNull Recyclerviewadapter_deliverer_closedOrders.MyViewHolder holder, int position) { + holder.tvID.setText(String.valueOf("# " + bestellungen.get(position).id)); + holder.tvState.setText(bestellungen.get(position).state); + + if(bestellungen.get(position).state.equals(context.getString(R.string.inTransportation))){ + holder.readyButton.setText(context.getString(R.string.delivered)); + } + else if(bestellungen.get(position).state.equals(context.getString(R.string.readyForTransportDelivererFound))){ + holder.readyButton.setText(context.getString(R.string.inTransportation)); + } + else if(bestellungen.get(position).state.equals(context.getString(R.string.readyForTransport))){ + holder.readyButton.setText(context.getString(R.string.reserve)); + } + else{ + holder.readyButton.setVisibility(View.INVISIBLE); + } + + + + holder.readyButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + if (bestellungen.get(position).state.equals(context.getString(R.string.inTransportation))) { + + bestellungen.get(position).state = context.getString(R.string.delivered); + int adapterPosition = holder.getAdapterPosition(); + if (adapterPosition != RecyclerView.NO_POSITION) { + removeItem(adapterPosition); + } + DelivererOpenOrdersFragment.setVec(context); + notifyItemRangeChanged(position, getItemCount()); + } + if (bestellungen.get(position).state.equals(context.getString(R.string.readyForTransportDelivererFound))) { + bestellungen.get(position).state = context.getString(R.string.inTransportation); + DelivererOpenOrdersFragment.setVec(context); + notifyItemRangeChanged(position, getItemCount()); + return; + } + } + }); + + } + + public void removeItem(int position) { + bestellungen.remove(position); + notifyItemRemoved(position); + notifyItemRangeChanged(position, getItemCount()); + } + + @Override + public int getItemCount() { + return bestellungen.size(); + } + + public static class MyViewHolder extends RecyclerView.ViewHolder { + + TextView tvID, tvDelivery,tvState,tvTotalCost,supAddress,cusAddress; + RecyclerView recyclerViewOrders; + Button readyButton; + public MyViewHolder(@NonNull View itemView) { + super(itemView); + + cusAddress = itemView.findViewById(R.id.textView17); + supAddress = itemView.findViewById(R.id.textView14); + tvID = itemView.findViewById(R.id.textViewID);; + tvState = itemView.findViewById(R.id.textViewState); + tvDelivery = itemView.findViewById(R.id.textViewDelivery); + recyclerViewOrders =itemView.findViewById(R.id.recyclerViewOrders); + tvTotalCost =itemView.findViewById(R.id.textViewTotalCost); + readyButton = itemView.findViewById(R.id.buttonReady); + } + } +} diff --git a/app/src/main/java/com/example/mampfmobil/ui/Classes/Recyclerviewadapter_deliverer_orders.java b/app/src/main/java/com/example/mampfmobil/ui/Classes/Recyclerviewadapter_deliverer_orders.java new file mode 100644 index 0000000000000000000000000000000000000000..efe46359fa11ecb75e80f6f0c98f137b42b71fef --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/Classes/Recyclerviewadapter_deliverer_orders.java @@ -0,0 +1,127 @@ +package com.example.mampfmobil.ui.Classes; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import com.example.mampfmobil.R; +import com.example.mampfmobil.ui.MampfMobil; +import com.example.mampfmobil.ui.customer.CustomerShoppingCartFragment; +import com.example.mampfmobil.ui.deliverer.DelivererOpenOrdersFragment; + +import java.util.Vector; + +public class Recyclerviewadapter_deliverer_orders extends RecyclerView.Adapter<Recyclerviewadapter_deliverer_orders.MyViewHolder>{ + + + Context context; + Vector<Bestellung> bestellungen = new Vector<>(); + + public Recyclerviewadapter_deliverer_orders(Context context,Vector<Bestellung> bestellungen ){ + this.context =context; + this.bestellungen = bestellungen; + } + @NonNull + @Override + public Recyclerviewadapter_deliverer_orders.MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + LayoutInflater inflator = LayoutInflater.from(context); + View view = inflator.inflate(R.layout.recyclerview_deliverer_orderrow,parent,false); + + return new Recyclerviewadapter_deliverer_orders.MyViewHolder(view); + } + + @Override + public void onBindViewHolder(@NonNull Recyclerviewadapter_deliverer_orders.MyViewHolder holder, int position) { + holder.tvID.setText(String.valueOf("# " + bestellungen.get(position).id)); + holder.tvState.setText(bestellungen.get(position).state); + holder.supAddress.setText(bestellungen.get(position).supplier.address); + holder.cusAddress.setText(bestellungen.get(position).costumer.adresse); + + if(bestellungen.get(position).state.equals(context.getString(R.string.inTransportation))){ + holder.readyButton.setText(context.getString(R.string.delivered)); + } + else if(bestellungen.get(position).state.equals(context.getString(R.string.readyForTransportDelivererFound))){ + holder.readyButton.setText(context.getString(R.string.inTransportation)); + } + else if(bestellungen.get(position).state.equals(context.getString(R.string.readyForTransport))){ + holder.readyButton.setText(context.getString(R.string.reserve)); + } + else{ + holder.readyButton.setVisibility(View.INVISIBLE); + } + + + + holder.readyButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + if (bestellungen.get(position).state.equals(context.getString(R.string.inTransportation))) { + + bestellungen.get(position).state = context.getString(R.string.delivered); + int adapterPosition = holder.getAdapterPosition(); + if (adapterPosition != RecyclerView.NO_POSITION) { + removeItem(adapterPosition); + } + DelivererOpenOrdersFragment.setVec(context); + notifyItemRangeChanged(position, getItemCount()); + } + if (bestellungen.get(position).state.equals(context.getString(R.string.readyForTransportDelivererFound))) { + bestellungen.get(position).state = context.getString(R.string.inTransportation); + DelivererOpenOrdersFragment.setVec(context); + notifyItemRangeChanged(position, getItemCount()); + return; + } + if (bestellungen.get(position).state.equals(context.getString(R.string.readyForTransport))) { + bestellungen.get(position).state = context.getString(R.string.readyForTransportDelivererFound); + bestellungen.get(position).deliverer = MampfMobil.currentDeliverer; + int adapterPosition = holder.getAdapterPosition(); + if (adapterPosition != RecyclerView.NO_POSITION) { + removeItem(adapterPosition); + } + DelivererOpenOrdersFragment.setVec(context); + notifyItemRangeChanged(position, getItemCount()); + return; + } + } + }); + + } + + public void removeItem(int position) { + bestellungen.remove(position); + notifyItemRemoved(position); + notifyItemRangeChanged(position, getItemCount()); + } + + @Override + public int getItemCount() { + return bestellungen.size(); + } + + public static class MyViewHolder extends RecyclerView.ViewHolder { + + TextView tvID, tvDelivery,tvState,tvTotalCost,cusAddress,supAddress; + RecyclerView recyclerViewOrders; + Button readyButton; + public MyViewHolder(@NonNull View itemView) { + super(itemView); + + tvID = itemView.findViewById(R.id.textViewID); + cusAddress = itemView.findViewById(R.id.textView17); + supAddress = itemView.findViewById(R.id.textView14); + tvState = itemView.findViewById(R.id.textViewState); + tvDelivery = itemView.findViewById(R.id.textViewDelivery); + recyclerViewOrders =itemView.findViewById(R.id.recyclerViewOrders); + tvTotalCost =itemView.findViewById(R.id.textViewTotalCost); + readyButton = itemView.findViewById(R.id.buttonReady); + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mampfmobil/ui/Classes/Recyclerviewadapter_editItem.java b/app/src/main/java/com/example/mampfmobil/ui/Classes/Recyclerviewadapter_editItem.java new file mode 100644 index 0000000000000000000000000000000000000000..54e0966d69440ffe2caa99e086b483b52144c34b --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/Classes/Recyclerviewadapter_editItem.java @@ -0,0 +1,92 @@ +package com.example.mampfmobil.ui.Classes; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.CheckBox; +import android.widget.EditText; +import android.widget.ImageButton; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.example.mampfmobil.R; +import com.example.mampfmobil.ui.MampfMobil; +import com.example.mampfmobil.ui.customer.CustomerShoppingCartFragment; + +import java.util.Vector; + +public class Recyclerviewadapter_editItem extends RecyclerView.Adapter<Recyclerviewadapter_editItem.MyViewHolder> { + + Context context; + Vector<ShopItem> shopItems; + + public Recyclerviewadapter_editItem(Context context){ + this.context = context; + this.shopItems = MampfMobil.currentSupplier.shopItems; + } + + @NonNull + @Override + public Recyclerviewadapter_editItem.MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + + LayoutInflater inflater = LayoutInflater.from(context); + View view = inflater.inflate(R.layout.recyclerview_edititemrow,parent,false); + return new Recyclerviewadapter_editItem.MyViewHolder(view); + } + + @Override + public void onBindViewHolder(@NonNull Recyclerviewadapter_editItem.MyViewHolder holder, int position) { + holder.tvName.setText(shopItems.get(position).item.name); + holder.etPrice.setText(String.format("%.2f", (shopItems.get(position).item.price)) + " €"); + holder.etAmount.setText(String.valueOf(shopItems.get(position).quantity)); + + holder.buttonDeleteItem.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + int adapterPosition = holder.getAdapterPosition(); + if (adapterPosition != RecyclerView.NO_POSITION) { + removeItem(adapterPosition); + } + } + }); + + holder.buttonEditItem.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + shopItems.get(position).quantity =Integer.parseInt( holder.etAmount.getText().toString()); + shopItems.get(position).item.price =Double.parseDouble( holder.etAmount.getText().toString()); + } + }); + + } + + public void removeItem(int position) { + shopItems.remove(position); + notifyItemRemoved(position); + notifyItemRangeChanged(position, getItemCount()); + } + @Override + public int getItemCount() { + return shopItems.size(); + } + + public static class MyViewHolder extends RecyclerView.ViewHolder{ + + Button buttonEditItem; + ImageButton buttonDeleteItem; + EditText etAmount, etPrice; + TextView tvName; + public MyViewHolder(@NonNull View itemView) { + super(itemView); + buttonDeleteItem = itemView.findViewById(R.id.deleteButton2); + buttonEditItem = itemView.findViewById(R.id.buttonEdit); + etAmount = itemView.findViewById(R.id.editTextAmount); + etPrice = itemView.findViewById(R.id.editTextPrice); + tvName = itemView.findViewById(R.id.textViewName); + } + } +} diff --git a/app/src/main/java/com/example/mampfmobil/ui/Classes/Recyclerviewadapter_statistic.java b/app/src/main/java/com/example/mampfmobil/ui/Classes/Recyclerviewadapter_statistic.java new file mode 100644 index 0000000000000000000000000000000000000000..90c5dc78cd46df0b790eb9c07a9dc1af4aca68e8 --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/Classes/Recyclerviewadapter_statistic.java @@ -0,0 +1,96 @@ +package com.example.mampfmobil.ui.Classes; + +import android.content.Context; +import android.icu.text.Transliterator; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.example.mampfmobil.R; +import com.example.mampfmobil.ui.MampfMobil; + +import java.util.Vector; + + + +public class Recyclerviewadapter_statistic extends RecyclerView.Adapter<Recyclerviewadapter_statistic.MyViewHolder> { + + Context context; + public Vector<ShopItem> shopItems; + public Vector<Bestellung> bestellungen; + + public Recyclerviewadapter_statistic(Context context){ + this.context = context; + this.shopItems = MampfMobil.currentSupplier.shopItems; + bestellungen = new Vector<>(); + for(Customer c:MampfMobil.customers){ + for(Bestellung b:c.bestellungen){ + if(b.supplier==MampfMobil.currentSupplier){ + bestellungen.add(b); + } + } + } + + } + + @NonNull + @Override + public Recyclerviewadapter_statistic.MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + LayoutInflater inflater = LayoutInflater.from(context); + View view = inflater.inflate(R.layout.recyclerview_statisticrow,parent,false); + return new Recyclerviewadapter_statistic.MyViewHolder(view); + } + + @Override + public void onBindViewHolder(@NonNull Recyclerviewadapter_statistic.MyViewHolder holder, int position) { + holder.tvName.setText(shopItems.get(position).item.name); + holder.tvAmountNr.setText(String.valueOf(getItemsSold(position))); + holder.tvPrice.setText(String.format("%.2f", (shopItems.get(position).item.price)) + " €"); + holder.tvSum.setText(getItemSum(position)); + } + + + @Override + public int getItemCount() { + return shopItems.size(); + } + + public static class MyViewHolder extends RecyclerView.ViewHolder { + + TextView tvName, tvAmountNr, tvPrice, tvSum; + + public MyViewHolder(@NonNull View itemView) { + super(itemView); + tvName = itemView.findViewById(R.id.textViewName); + tvAmountNr = itemView.findViewById(R.id.textViewSoldUnits); + tvPrice = itemView.findViewById(R.id.textViewPrice); + tvSum = itemView.findViewById(R.id.textViewSum); + } + } + + private String getItemSum(int position){ + double temp = 0.0; + temp = shopItems.get(position).item.price * getItemsSold(position); + + return String.valueOf(temp); + } + private int getItemsSold(int position){ + + int temp = 0; + for(Bestellung b:bestellungen){ + for(BestellungsTeil bt:b.bestellungsTeile){ + if(bt.item ==shopItems.get(position).item){ + temp += bt.quantity; + } + } + } + + return temp; + + } + +} diff --git a/app/src/main/java/com/example/mampfmobil/ui/Classes/ShopItem.java b/app/src/main/java/com/example/mampfmobil/ui/Classes/ShopItem.java new file mode 100644 index 0000000000000000000000000000000000000000..6a4cd474b9d6eb52cafe267998808c99ab47ed5f --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/Classes/ShopItem.java @@ -0,0 +1,23 @@ +package com.example.mampfmobil.ui.Classes; + +import android.util.Log; + +public class ShopItem { + public Item item; + public int quantity; + public int id; + + public ShopItem(Item item, int quantity){ + this.item = item; + this.quantity = quantity; + id = item.id; + } + + public ShopItem(int id,Item item, int quantity){ + + this.item = item; + this.quantity = quantity; + this.id = id; + } + +} diff --git a/app/src/main/java/com/example/mampfmobil/ui/Classes/Supplier.java b/app/src/main/java/com/example/mampfmobil/ui/Classes/Supplier.java new file mode 100644 index 0000000000000000000000000000000000000000..d242464b024b0c17829ac2c8c7b23ba7bdb9e791 --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/Classes/Supplier.java @@ -0,0 +1,43 @@ +package com.example.mampfmobil.ui.Classes; + +import android.util.Log; + +import java.util.Vector; + +public class Supplier { + + public String name; + public String address; + + public static int idCounter = 1; + public int id; + + public Vector<ShopItem> shopItems = new Vector<>(); + + public Supplier(String name,String adresse) { + shopItems = new Vector<>(); + this.name = name; + this.address = adresse; + id = idCounter; + idCounter++; + } + + public Supplier(int id, String name,String adresse) { + shopItems = new Vector<>(); + this.name = name; + this.address = adresse; + this.id = id; + } + + public void itemAdd(String name,int quantity, double price){ + shopItems.add(new ShopItem(new Item(name,price,this),quantity)); + } + public void itemAdd(int idItem,String name,int quantity, double price){ + + shopItems.add(idItem,new ShopItem(idItem,new Item(idItem,name,price,this),quantity)); + + } + + + +} diff --git a/app/src/main/java/com/example/mampfmobil/ui/CustomerActivity.java b/app/src/main/java/com/example/mampfmobil/ui/CustomerActivity.java new file mode 100644 index 0000000000000000000000000000000000000000..9ede2334513f438b7e9c09d42ab7b285539db5ed --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/CustomerActivity.java @@ -0,0 +1,161 @@ +package com.example.mampfmobil.ui; + +import android.content.Context; +import android.content.Intent; +import android.os.Bundle; +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; +import androidx.navigation.fragment.NavHostFragment; +import androidx.navigation.ui.AppBarConfiguration; +import androidx.navigation.ui.NavigationUI; +import com.example.mampfmobil.databinding.ActivityCustomerBinding; +import com.example.mampfmobil.databinding.ActivityDelivererBinding; +import com.example.mampfmobil.ui.Classes.ShopItem; +import com.example.mampfmobil.ui.Classes.Supplier; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.Vector; + +public class CustomerActivity extends AppCompatActivity { + +private ActivityCustomerBinding binding; + + public static ArrayList<ShopItem> shopItemList = new ArrayList<>(); + + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + Log.d("myTag", "This is my Costumer"); + + binding = ActivityCustomerBinding.inflate(getLayoutInflater()); + setContentView(binding.getRoot()); + // Enable the back button in the ActionBar + + + AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder( + R.id.navigation_shop, R.id.navigation_shopping_cart, R.id.navigation_orders) + .build(); + 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); + } + + + + } + + @Override + public boolean onSupportNavigateUp() { + Intent intent = new Intent(this, MainActivity.class); + startActivity(intent); + return true; // true zurückgeben, um anzugeben, dass die Aktion behandelt wurde + } + + public static void setupShop(){ + shopItemList.clear(); + Vector<Supplier> suppliers = MampfMobil.suppliers; + for(ShopItem si:MampfMobil.currentCustomer.favoriten){ + shopItemList.add(si); + } + + for(Supplier s: suppliers){ + for(ShopItem si: s.shopItems){ + if(!shopItemList.contains(si)){ + shopItemList.add(si); + } + } + } + + } + public static void setupShop(String inputString){ + shopItemList.clear(); + Vector<Supplier> suppliers = MampfMobil.suppliers; + + for(ShopItem si:MampfMobil.currentCustomer.favoriten){ + if(si.item.name.contains(inputString)){ + shopItemList.add(si); + } + } + + for(Supplier s: suppliers){ + for(ShopItem si: s.shopItems){ + if(si.item.name.contains(inputString) && !shopItemList.contains(si)){ + shopItemList.add(si); + } + } + } + + } + + + public static void setupShop(Supplier supplier){ + shopItemList.clear(); + Vector<Supplier> suppliers = MampfMobil.suppliers; + + for(ShopItem si:MampfMobil.currentCustomer.favoriten){ + if(si.item.supplier == supplier){ + shopItemList.add(si); + } + } + + for(Supplier s: suppliers){ + for(ShopItem si: s.shopItems){ + if(si.item.supplier == supplier && !shopItemList.contains(si)){ + shopItemList.add(si); + } + } + } + + } + + public static void sortShop(String inputString, Context context) { + + if (inputString.equals(context.getString(R.string.price))) { + Collections.sort(shopItemList, new Comparator<ShopItem>() { + @Override + public int compare(ShopItem item1, ShopItem item2) { + return Double.compare(item1.item.price, item2.item.price); + } + }); + } + if (inputString.equals(context.getString(R.string.restamount))) { + Collections.sort(shopItemList, new Comparator<ShopItem>() { + @Override + public int compare(ShopItem item1, ShopItem item2) { + return Double.compare( item2.quantity,item1.quantity); + } + }); + } + if (inputString.equals(context.getString(R.string.name))) { + Collections.sort(shopItemList, new Comparator<ShopItem>() { + @Override + public int compare(ShopItem item1, ShopItem item2) { + return item1.item.name.compareTo(item2.item.name); + } + }); + } + + } + + @Override + protected void onStop() { + Log.d("myTag", "SAVED PERSISTANT"); + MampfMobil.savePersistant(); + super.onStop(); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mampfmobil/ui/DecideFragment.java b/app/src/main/java/com/example/mampfmobil/ui/DecideFragment.java new file mode 100644 index 0000000000000000000000000000000000000000..8f5ac5cb1f3c17f6a14c77d2da33bc44e1a93658 --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/DecideFragment.java @@ -0,0 +1,170 @@ +package com.example.mampfmobil.ui; + +import androidx.appcompat.app.AppCompatDelegate; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentTransaction; +import androidx.lifecycle.ViewModelProvider; + +import android.content.Intent; +import android.content.res.Configuration; +import android.content.res.Resources; +import android.os.Build; +import android.os.Bundle; + +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; + +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.ImageButton; + +import com.example.mampfmobil.R; +import com.example.mampfmobil.ui.customer.CustomerLogonFragment; +import com.example.mampfmobil.ui.customer.CustomerRegisterFragment; +import com.example.mampfmobil.ui.deliverer.DelivererLogonFragment; +import com.example.mampfmobil.ui.deliverer.DelivererRegisterFragment; +import com.example.mampfmobil.ui.supplier.SupplierLogonFragment; +import com.example.mampfmobil.ui.supplier.SupplierRegisterFragment; + +import java.util.Locale; + +public class DecideFragment extends Fragment { + + private DecideViewModel mViewModel; + + public static DecideFragment newInstance() { + return new DecideFragment(); + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + View rootView = inflater.inflate(R.layout.fragment_decide, container, false); + + ImageButton deButton = rootView.findViewById(R.id.imageView); + ImageButton enButton = rootView.findViewById(R.id.imageView2); + ImageButton darkMode = rootView.findViewById(R.id.imageButton); + + darkMode.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + // Den Dark Mode programmgesteuert aktivieren + setDarkMode(true); + } + }); + + ImageButton lightMode = rootView.findViewById(R.id.imageButton2); + + lightMode.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + // Den Dark Mode programmgesteuert aktivieren + setDarkMode(false); + } + }); + + + deButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + setLocale("de"); // Aufruf der Funktion zum Ändern der Sprache auf Deutsch + } + }); + + enButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + setLocale("en"); // Aufruf der Funktion zum Ändern der Sprache auf Englisch + } + }); + + Button button = rootView.findViewById(R.id.CustomerButton); + button.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + FragmentManager fragmentManager = requireActivity().getSupportFragmentManager(); + FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); + fragmentTransaction.replace(R.id.container, new CustomerLogonFragment()); + fragmentTransaction.addToBackStack(null); // Fügt den Fragment-Wechsel zur Back-Stack hinzu + fragmentTransaction.commit(); + } + }); + + Button button2 = rootView.findViewById(R.id.SupplierButton); + button2.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + FragmentManager fragmentManager = requireActivity().getSupportFragmentManager(); + FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); + fragmentTransaction.replace(R.id.container, new SupplierLogonFragment()); + fragmentTransaction.addToBackStack(null); // Fügt den Fragment-Wechsel zur Back-Stack hinzu + fragmentTransaction.commit(); + } + }); + + + Button button3 = rootView.findViewById(R.id.DelivererButton); + button3.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + FragmentManager fragmentManager = requireActivity().getSupportFragmentManager(); + FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); + fragmentTransaction.replace(R.id.container, new DelivererLogonFragment()); + fragmentTransaction.addToBackStack(null); // Fügt den Fragment-Wechsel zur Back-Stack hinzu + fragmentTransaction.commit(); + } + }); + return rootView; + } + + + @Override + public void onActivityCreated(@Nullable Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + mViewModel = new ViewModelProvider(this).get(DecideViewModel.class); + // TODO: Use the ViewModel + } + + private void setLocale(String languageCode) { + Locale locale = new Locale(languageCode); + Resources resources = getResources(); + Configuration configuration = resources.getConfiguration(); + configuration.setLocale(locale); + resources.updateConfiguration(configuration, resources.getDisplayMetrics()); + + recreateActivity(); // Aktivität neu starten, um die Änderungen anzuwenden + } + + private void setDarkMode(boolean enabled) { + + if (enabled) { + + // Dark Mode aktivieren + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); + } else { + // Dark Mode deaktivieren + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); + } + + recreateActivity(); // Aktivität neu starten, um den Dark Mode anzuwenden + + } + + private void recreateActivity() { + // Aktivität neu starten + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { + requireActivity().recreate(); + } else { + Intent intent = requireActivity().getIntent(); + intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); + requireActivity().finish(); + requireActivity().overridePendingTransition(0, 0); + startActivity(intent); + requireActivity().overridePendingTransition(0, 0); + } + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mampfmobil/ui/DecideViewModel.java b/app/src/main/java/com/example/mampfmobil/ui/DecideViewModel.java new file mode 100644 index 0000000000000000000000000000000000000000..410d3d39a881589a80fba36fa29b143aa08b13b3 --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/DecideViewModel.java @@ -0,0 +1,7 @@ +package com.example.mampfmobil.ui; + +import androidx.lifecycle.ViewModel; + +public class DecideViewModel extends ViewModel { + // TODO: Implement the ViewModel +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mampfmobil/ui/DelivererActivity.java b/app/src/main/java/com/example/mampfmobil/ui/DelivererActivity.java new file mode 100644 index 0000000000000000000000000000000000000000..b24cf187f60e16f234acd7a64b3ae2695fb449c7 --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/DelivererActivity.java @@ -0,0 +1,57 @@ +package com.example.mampfmobil.ui; + +import androidx.appcompat.app.ActionBar; +import androidx.appcompat.app.AppCompatActivity; +import androidx.navigation.NavController; +import androidx.navigation.Navigation; +import androidx.navigation.ui.AppBarConfiguration; +import androidx.navigation.ui.NavigationUI; + +import android.content.Intent; +import android.os.Bundle; +import android.util.Log; + +import com.example.mampfmobil.MainActivity; +import com.example.mampfmobil.R; +import com.example.mampfmobil.databinding.ActivityDelivererBinding; + +public class DelivererActivity extends AppCompatActivity { + +private ActivityDelivererBinding binding; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + + binding = ActivityDelivererBinding.inflate(getLayoutInflater()); + setContentView(binding.getRoot()); + + Log.d("myTag", "This is my Deliverer"); + + + + // Fragment "fragment_decide" wird angezeigt + AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder( + R.id.navigation_home, R.id.navigation_dashboard, R.id.navigation_notifications) + .build(); + NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment_activity_deliverer); + NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration); + NavigationUI.setupWithNavController(binding.navView3, navController); + + + } + @Override + public boolean onSupportNavigateUp() { + Intent intent = new Intent(this, MainActivity.class); + startActivity(intent); + return true; // true zurückgeben, um anzugeben, dass die Aktion behandelt wurde + } + + @Override + protected void onStop() { + Log.d("myTag", "SAVED PERSISTANT"); + MampfMobil.savePersistant(); + super.onStop(); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mampfmobil/ui/MampfMobil.java b/app/src/main/java/com/example/mampfmobil/ui/MampfMobil.java new file mode 100644 index 0000000000000000000000000000000000000000..0990102d5b6c7aba5dafc57cd374defc2018a483 --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/MampfMobil.java @@ -0,0 +1,544 @@ +package com.example.mampfmobil.ui; + +import android.content.Context; +import android.util.Log; + +import com.example.mampfmobil.R; +import com.example.mampfmobil.ui.Classes.Bestellung; +import com.example.mampfmobil.ui.Classes.BestellungsTeil; +import com.example.mampfmobil.ui.Classes.Customer; +import com.example.mampfmobil.ui.Classes.Deliverer; +import com.example.mampfmobil.ui.Classes.Item; +import com.example.mampfmobil.ui.Classes.ShopItem; +import com.example.mampfmobil.ui.Classes.Supplier; + +import java.util.Vector; + +public class MampfMobil { + + public static Vector<Customer> customers; + public static Customer currentCustomer; + public static Vector<Deliverer> deliverers; + public static Deliverer currentDeliverer; + public static Vector<Supplier> suppliers; + public static Supplier currentSupplier; + + static Context context; + + + + public static boolean isInitialized = false; + + public MampfMobil(Context context){ + this.context = context; + + if(!isInitialized) { + customers = new Vector<>(); + deliverers = new Vector<>(); + suppliers = new Vector<>(); + takefromPersistance(); + isInitialized = true; + } + + /*if(!isInitialized) { + customers = new Vector<>(); + deliverers = new Vector<>(); + suppliers = new Vector<>(); + + //create Dummys!!! + customers.add(new Customer("Fabio", "Heyming", "Weinbergstr 70, 55299 Nackenheim")); + customers.add(new Customer("Leah", "Iilyav", "Bad Homburg")); + customers.add(new Customer("Max", "Muster", "Musteradresse")); + deliverers.add(new Deliverer("Mr", "Fahrer", "Fahrstr.")); + deliverers.add(new Deliverer("Mrs", "Fahrerin", "Fahrstr.")); + suppliers.add(new Supplier("DummyShop", "Dummystreet")); + suppliers.add(new Supplier("FreeShop", "Freeadress")); + suppliers.add(new Supplier("Rewe", "Rewestr")); + suppliers.get(0).itemAdd("DummyApfel", 10, 0.5); + suppliers.get(0).itemAdd("DummyBanane", 5, 0.8); + suppliers.get(0).itemAdd("DummyBirne", 10, 0.5); + suppliers.get(0).itemAdd("DummyAnanas", 5, 0.8); + suppliers.get(1).itemAdd("DummyApfel", 10, 0.5); + suppliers.get(1).itemAdd("DummyBanane", 5, 0.8); + suppliers.get(2).itemAdd("FreeApfel", 5, 3.4); + suppliers.get(2).itemAdd("FreeBanane", 5, 5.8); + + Bestellung temp = new Bestellung(suppliers.get(0),true,context.getString(R.string.ordered),customers.get(0)); + temp.addBestellungsteil(new BestellungsTeil(suppliers.get(0).shopItems.get(0).item, 5)); + temp.addBestellungsteil(new BestellungsTeil(suppliers.get(0).shopItems.get(1).item, 2)); + temp.addBestellungsteil(new BestellungsTeil(suppliers.get(0).shopItems.get(0).item, 2)); + temp.addBestellungsteil(new BestellungsTeil(suppliers.get(0).shopItems.get(1).item, 7)); + customers.get(0).addBestellung(temp); + + Bestellung temp4 = new Bestellung(suppliers.get(0),true,context.getString(R.string.readyForTransport),customers.get(0)); + temp4.addBestellungsteil(new BestellungsTeil(suppliers.get(0).shopItems.get(0).item, 8)); + temp4.addBestellungsteil(new BestellungsTeil(suppliers.get(0).shopItems.get(1).item, 2)); + temp4.addBestellungsteil(new BestellungsTeil(suppliers.get(0).shopItems.get(2).item, 1)); + customers.get(0).addBestellung(temp4); + + Bestellung temp6 = new Bestellung(suppliers.get(0),true,context.getString(R.string.readyForTransportDelivererFound),customers.get(0)); + temp6.deliverer = deliverers.get(0); + temp6.addBestellungsteil(new BestellungsTeil(suppliers.get(0).shopItems.get(0).item, 8)); + temp6.addBestellungsteil(new BestellungsTeil(suppliers.get(0).shopItems.get(1).item, 2)); + temp6.addBestellungsteil(new BestellungsTeil(suppliers.get(0).shopItems.get(2).item, 1)); + customers.get(0).addBestellung(temp6); + + Bestellung temp5 = new Bestellung(suppliers.get(0),false,context.getString(R.string.readyForPickup),customers.get(0)); + temp5.addBestellungsteil(new BestellungsTeil(suppliers.get(0).shopItems.get(0).item, 8)); + temp5.addBestellungsteil(new BestellungsTeil(suppliers.get(0).shopItems.get(1).item, 2)); + temp5.addBestellungsteil(new BestellungsTeil(suppliers.get(0).shopItems.get(2).item, 1)); + customers.get(0).addBestellung(temp5); + + Bestellung temp2 = new Bestellung(suppliers.get(0),true,context.getString(R.string.inTransportation),customers.get(0)); + temp2.deliverer = deliverers.get(0); + temp2.addBestellungsteil(new BestellungsTeil(suppliers.get(0).shopItems.get(0).item, 5)); + temp2.addBestellungsteil(new BestellungsTeil(suppliers.get(0).shopItems.get(1).item, 10)); + temp2.addBestellungsteil(new BestellungsTeil(suppliers.get(0).shopItems.get(2).item, 5)); + temp2.addBestellungsteil(new BestellungsTeil(suppliers.get(0).shopItems.get(3).item, 10)); + customers.get(0).addBestellung(temp2); + + Bestellung temp7 = new Bestellung(suppliers.get(0),true,context.getString(R.string.delivered),customers.get(0)); + temp7.deliverer = deliverers.get(0); + temp7.addBestellungsteil(new BestellungsTeil(suppliers.get(0).shopItems.get(0).item, 5)); + temp7.addBestellungsteil(new BestellungsTeil(suppliers.get(0).shopItems.get(1).item, 10)); + temp7.addBestellungsteil(new BestellungsTeil(suppliers.get(0).shopItems.get(2).item, 5)); + temp7.addBestellungsteil(new BestellungsTeil(suppliers.get(0).shopItems.get(3).item, 10)); + customers.get(0).addBestellung(temp7); + + Bestellung temp3 = new Bestellung(suppliers.get(1),true,"ordered",customers.get(1)); + temp3.addBestellungsteil(new BestellungsTeil(suppliers.get(1).shopItems.get(1).item, 7)); + temp3.addBestellungsteil(new BestellungsTeil(suppliers.get(1).shopItems.get(0).item, 14)); + customers.get(1).addBestellung(temp3); + + + customers.add(new Customer("", "", "")); + deliverers.add(new Deliverer("", "", "")); + suppliers.add(new Supplier("", "")); + isInitialized = true; + savePersistant(); + }*/ + } + + public static boolean findCustomer(String vorname, String nachname){ + for(Customer c:customers){ + if(c.vorname.equals(vorname) && c.nachname.equals(nachname)){ + MampfMobil.currentCustomer = c; + return true; + } + } + return false; + } + + public static boolean createCustomer(String vorname, String nachname,String adresse){ + for(Customer c:customers){ + if(c.vorname.equals(vorname) && c.nachname.equals(nachname)){ + return false; + } + } + Customer temp = new Customer(vorname,nachname,adresse); + customers.add(temp); + currentCustomer = temp; + return true; + } + + public static boolean findSupplier(String name){ + for(Supplier s:suppliers){ + if(s.name.equals(name)){ + MampfMobil.currentSupplier = s; + return true; + } + } + return false; + } + + public static boolean createSupplier(String name,String address){ + for(Supplier s:suppliers){ + if(s.name.equals(name)){ + return false; + } + } + Supplier temp = new Supplier(name,address); + suppliers.add(temp); + currentSupplier = temp; + return true; + } + public static boolean findDeliverer(String vorname, String nachname){ + for(Deliverer d:deliverers){ + if(d.vorname.equals(vorname) && d.nachname.equals(nachname)){ + MampfMobil.currentDeliverer = d; + return true; + } + } + return false; + } + + public static boolean createDeliverer(String vorname, String nachname,String address){ + for(Deliverer d:deliverers){ + if(d.vorname.equals(vorname) && d.nachname.equals(nachname)){ + return false; + } + } + + Deliverer temp = new Deliverer(vorname,nachname,address); + deliverers.add(temp); + currentDeliverer=temp; + return true; + } + + public static int getItemQuantity(Item item){ + for(Supplier s:suppliers){ + for(ShopItem sI: s.shopItems){ + if(sI.item == item){ + return sI.quantity; + } + } + } + return 0; + } + + + + public static void savePersistant(){ + + //ID,VORNAME,NACHNAME,ADRESSE + String csvDeliverer = ""; + for(Deliverer d:MampfMobil.deliverers){ + csvDeliverer = csvDeliverer + d.id +","+ d.vorname +","+ d.nachname +","+ d.adresse + "\n"; + } + String fileName = "deliverer.csv"; + CSVFileHelper.saveCSVFile(context, fileName, csvDeliverer); + + + //ID,NAME,ADRESSE + String csvSupplier = ""; + for(Supplier s:MampfMobil.suppliers){ + csvSupplier = csvSupplier + s.id +","+ s.name +","+s.address + "\n"; + } + String fileName2 = "supplier.csv"; + CSVFileHelper.saveCSVFile(context, fileName2, csvSupplier); + + + //ID,VORNAME,NACHNAME,ADRESSE + String csvCustomer = ""; + for(Customer c:MampfMobil.customers){ + csvCustomer = csvCustomer + c.id +","+ c.vorname +","+ c.nachname +","+ c.adresse + "\n"; + } + String fileName3 = "customer.csv"; + CSVFileHelper.saveCSVFile(context, fileName3, csvCustomer); + + + + // ID,NAME,PREIS,SUPPLIER-ID + String csvItems = ""; + for(Supplier s:MampfMobil.suppliers){ + for(ShopItem sI: s.shopItems){ + csvItems = csvItems + sI.item.id + "," + sI.item.name + "," + sI.item.price + "," + sI.item.supplier.id + "\n"; + } + } + String fileName4 = "items.csv"; + CSVFileHelper.saveCSVFile(context, fileName4, csvItems); + + + + + // ID/ITEM-ID(immer gleich), AMOUNT + String csvShopItems = ""; + for(Supplier s:MampfMobil.suppliers){ + for(ShopItem sI: s.shopItems){ + csvShopItems = csvShopItems + sI.id + "," + sI.quantity + "\n"; + } + } + String fileName5 = "shopItems.csv"; + CSVFileHelper.saveCSVFile(context, fileName5, csvShopItems); + + + // ID,CUSTOMER_ID, DELIVERY(TRUE/FALSE),STATE,DELIVERER-ID(0 when none),SUPPLIER-ID, + // bestellungsteil besteht aus ITEM-ID1, QUANTITY1, ITEM-ID2, QUANTITY2, ITEM-ID3, QUANTITY3 .... \n + String csvBestellungen = ""; + for(Customer c:MampfMobil.customers){ + for(Bestellung b: c.bestellungen){ + csvBestellungen = csvBestellungen + b.id + ","+ b.costumer.id+ "," + b.delivery + "," + b.state + ","; + if(b.deliverer == null){ + csvBestellungen = csvBestellungen + "0,"; + + } + else{ + csvBestellungen = csvBestellungen + b.deliverer.id + ","; + + } + csvBestellungen = csvBestellungen + b.supplier.id; + + + for (BestellungsTeil bT: b.bestellungsTeile){ + csvBestellungen = csvBestellungen +","+ bT.item.id + "," + bT.quantity ; + + } + csvBestellungen = csvBestellungen + "\n"; + + } + } + String fileName6 = "bestellungen.csv"; + CSVFileHelper.saveCSVFile(context, fileName6, csvBestellungen); + + + + + //Customer-ID, ShopItem-ID + String csvFavoriten = ""; + for(Customer c:MampfMobil.customers){ + for(ShopItem sI: c.favoriten){ + csvFavoriten = csvFavoriten + c.id + ","+ sI.id + "\n"; + } + } + String fileName7 = "favoriten.csv"; + CSVFileHelper.saveCSVFile(context, fileName7, csvFavoriten); + + + //Customer-ID, Item-ID, quantity + String csvShoppingCart = ""; + for(Customer c:MampfMobil.customers){ + for(BestellungsTeil bT: c.shoppingCart){ + csvShoppingCart = csvShoppingCart + c.id + ","+ bT.item.id + "," + bT.quantity +"\n"; + } + } + String fileName8 = "shoppingCart.csv"; + CSVFileHelper.saveCSVFile(context, fileName8, csvShoppingCart); + + } + + public static void takefromPersistance() { + + String fileName = "deliverer.csv"; + String csvData = CSVFileHelper.loadCSVFile(context, fileName); + if (csvData != null) { + String[] lines = csvData.split("\n"); + for (String line : lines) { + String[] data = line.split(","); + + if (data.length >= 4) { + int id = Integer.parseInt(data[0]); + String vorname = data[1]; + String nachname = data[2]; + String adresse = data[3]; + + // Verwende die Daten, um den Deliverer-Objekt zu erstellen oder zu aktualisieren + Deliverer deliverer = new Deliverer(id, vorname, nachname, adresse); + // Füge den Deliverer-Objekt deiner Datenstruktur hinzu + MampfMobil.deliverers.add(deliverer); + } + } + } + + + String fileName2 = "customer.csv"; + String csvData2 = CSVFileHelper.loadCSVFile(context, fileName2); + if (csvData2 != null) { + String[] lines = csvData2.split("\n"); + for (String line : lines) { + String[] data = line.split(","); + + if (data.length >= 4) { + int id = Integer.parseInt(data[0]); + String vorname = data[1]; + String nachname = data[2]; + String adresse = data[3]; + + // Verwende die Daten, um den Deliverer-Objekt zu erstellen oder zu aktualisieren + Customer customer = new Customer(id, vorname, nachname, adresse); + // Füge den Deliverer-Objekt deiner Datenstruktur hinzu + MampfMobil.customers.add(customer); + } + } + } + + + String fileName3 = "supplier.csv"; + String csvData3 = CSVFileHelper.loadCSVFile(context, fileName3); + if (csvData3 != null) { + String[] lines = csvData3.split("\n"); + for (String line : lines) { + String[] data = line.split(","); + + if (data.length >= 3) { + int id = Integer.parseInt(data[0]); + String name = data[1]; + String adresse = data[2]; + + // Verwende die Daten, um den Deliverer-Objekt zu erstellen oder zu aktualisieren + Supplier supplier = new Supplier(id, name, adresse); + // Füge den Deliverer-Objekt deiner Datenstruktur hinzu + MampfMobil.suppliers.add(supplier); + } + } + } + + + String fileName4 = "items.csv"; + String csvData4 = CSVFileHelper.loadCSVFile(context, fileName4); + if (csvData4 != null) { + String[] lines = csvData4.split("\n"); + for (String line : lines) { + String[] data = line.split(","); + + if (data.length >= 4) { + int itemId = Integer.parseInt(data[0]); + String name = data[1]; + double preis = Double.parseDouble(data[2]); + int supplierId = Integer.parseInt(data[3]); + + // Verwende die Daten, um den Deliverer-Objekt zu erstellen oder zu aktualisieren + for (Supplier s : MampfMobil.suppliers) { + if (s.id == supplierId) { + + Item tempItem = new Item(itemId,name,preis,s); + s.shopItems.add(new ShopItem(itemId,tempItem,0)); + //s.itemAdd(itemId, name, 0, preis); + } + } + } + } + } + + + String fileName5 = "shopItems.csv"; + String csvData5 = CSVFileHelper.loadCSVFile(context, fileName5); + if (csvData5 != null) { + String[] lines = csvData5.split("\n"); + for (String line : lines) { + String[] data = line.split(","); + + if (data.length >= 2) { + int itemId = Integer.parseInt(data[0]); + int quantity = Integer.parseInt(data[1]); + + + // Verwende die Daten, um den Deliverer-Objekt zu erstellen oder zu aktualisieren + for (Supplier s : MampfMobil.suppliers) { + for (ShopItem sI : s.shopItems) { + if (sI.id == itemId) { + sI.quantity = quantity; + } + } + } + } + } + + } + + + String fileName6 = "bestellungen.csv"; + String csvData6 = CSVFileHelper.loadCSVFile(context, fileName6); + if (csvData6 != null) { + String[] lines = csvData6.split("\n"); + for (String line : lines) { + String[] data = line.split(","); + + if (data.length >= 6) { + int ID = Integer.parseInt(data[0]); + int customerId = Integer.parseInt(data[1]); + String deliver = data[2]; + boolean delivery = false; + if (deliver.equals("true")) { + delivery = true; + } + String state = data[3]; + int delivererId = Integer.parseInt(data[4]); + int supplierId = Integer.parseInt(data[5]); + + Supplier tempSup = null; + for (Supplier s : MampfMobil.suppliers) { + if (s.id == supplierId) { + tempSup = s; + } + } + Customer tempCus = null; + for (Customer c : MampfMobil.customers) { + if (c.id == customerId) { + tempCus = c; + } + } + + Bestellung temp = new Bestellung(ID, tempSup, delivery, state, tempCus, delivererId); + + + for (int i = 6; i < data.length; i += 2) { + int ItemId = Integer.parseInt(data[i]); + int quantity = Integer.parseInt(data[i + 1]); + + Item tempItem = null; + for (Supplier s : MampfMobil.suppliers) { + for (ShopItem sI : s.shopItems) { + if (sI.id == ItemId) { + tempItem = sI.item; + } + } + } + + temp.addBestellungsteil(new BestellungsTeil(tempItem, quantity)); + } + + tempCus.addBestellung(temp); + } + } + } + + + + String fileName7 = "favoriten.csv"; + String csvData7 = CSVFileHelper.loadCSVFile(context, fileName7); + if (csvData7 != null) { + String[] lines = csvData7.split("\n"); + for (String line : lines) { + String[] data = line.split(","); + Log.d("myTag", "ADDED 1 fav"); + if (data.length >= 2) { + int cusId = Integer.parseInt(data[0]); + int shopItemId = Integer.parseInt(data[1]); + Log.d("myTag", "ADDED 2 fav"); + for (Customer c : MampfMobil.customers) { + if (c.id == cusId) { + Log.d("myTag", "ADDED 3 fav"); + for (Supplier s : MampfMobil.suppliers) { + for (ShopItem sI : s.shopItems) { + Log.d("myTag", sI.id + "" + shopItemId); + if (sI.id == shopItemId) { + c.addToFavourits(sI); + } + } + } + } + } + } + } + } + + + + + String fileName8 = "shoppingCart.csv"; + String csvData8 = CSVFileHelper.loadCSVFile(context, fileName8); + if (csvData8 != null) { + + String[] lines = csvData8.split("\n"); + for (String line : lines) { + String[] data = line.split(","); + if (data.length >= 3) { + int cusId = Integer.parseInt(data[0]); + int itemId = Integer.parseInt(data[1]); + int amount = Integer.parseInt(data[2]); + for (Customer c : MampfMobil.customers) { + if (c.id == cusId) { + for (Supplier s : MampfMobil.suppliers) { + for (ShopItem sI : s.shopItems) { + if (sI.item.id == itemId) { + c.addToShoppingCart(new BestellungsTeil(sI.item,amount)); + } + } + } + } + } + } + } + } + } +} diff --git a/app/src/main/java/com/example/mampfmobil/ui/SupplierActivity.java b/app/src/main/java/com/example/mampfmobil/ui/SupplierActivity.java new file mode 100644 index 0000000000000000000000000000000000000000..e5e10dbe16f20a24caefeaffeb059b455fd0576a --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/SupplierActivity.java @@ -0,0 +1,55 @@ +package com.example.mampfmobil.ui; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.navigation.NavController; +import androidx.navigation.Navigation; +import androidx.navigation.ui.AppBarConfiguration; +import androidx.navigation.ui.NavigationUI; + +import android.content.Intent; +import android.os.Bundle; +import android.util.Log; + +import com.example.mampfmobil.MainActivity; +import com.example.mampfmobil.R; +import com.example.mampfmobil.databinding.ActivityCustomerBinding; +import com.example.mampfmobil.databinding.ActivitySupplierBinding; +import com.google.android.material.bottomnavigation.LabelVisibilityMode; + +public class SupplierActivity extends AppCompatActivity { + + private ActivitySupplierBinding binding; + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + binding = ActivitySupplierBinding.inflate(getLayoutInflater()); + setContentView(binding.getRoot()); + Log.d("myTag", "This is my Supplier"); + + // Fragment "fragment_decide" wird angezeigt + AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder( + R.id.navigation_home, R.id.navigation_dashboard, R.id.navigation_notifications, R.id.navigation_ordersSupplier) + .build(); + NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment_activity_supplier); + NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration); + NavigationUI.setupWithNavController(binding.navView2, navController); + binding.navView2.setLabelVisibilityMode(1); + + } + + @Override + public boolean onSupportNavigateUp() { + Intent intent = new Intent(this, MainActivity.class); + startActivity(intent); + return true; // true zurückgeben, um anzugeben, dass die Aktion behandelt wurde + } + + @Override + protected void onStop() { + Log.d("myTag", "SAVED PERSISTANT"); + MampfMobil.savePersistant(); + super.onStop(); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mampfmobil/ui/customer/CustomerLogonFragment.java b/app/src/main/java/com/example/mampfmobil/ui/customer/CustomerLogonFragment.java new file mode 100644 index 0000000000000000000000000000000000000000..776a39d67ca3075c8d877f160a1829d1801ad261 --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/customer/CustomerLogonFragment.java @@ -0,0 +1,98 @@ +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; + +import android.content.Intent; +import android.os.Bundle; +import android.widget.Toast; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; + +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.EditText; + +import com.example.mampfmobil.R; +import com.example.mampfmobil.ui.CustomerActivity; +import com.example.mampfmobil.ui.MampfMobil; + +public class CustomerLogonFragment extends Fragment { + + private CustomerLogonViewModel mViewModel; + + public static CustomerLogonFragment newInstance() { + return new CustomerLogonFragment(); + } + + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, + @Nullable Bundle savedInstanceState) { + View rootView = inflater.inflate(R.layout.fragment_customer_logon, container, false); + + EditText firstname = rootView.findViewById(R.id.editTextFirstName); + EditText lastname = rootView.findViewById(R.id.editTextLastName); + Button button = rootView.findViewById(R.id.buttonRegister); + + AppCompatActivity activity = (AppCompatActivity) requireActivity(); + // Enable the back button in the ActionBar + ActionBar actionBar = activity.getSupportActionBar(); + if(actionBar != null) { + actionBar.setDisplayHomeAsUpEnabled(true); + } + + button.setOnClickListener(new View.OnClickListener() { + private Toast toast; // + @Override + public void onClick(View v) { + // Wechsel zum anderen Fragment + + if(MampfMobil.findCustomer(firstname.getText().toString(),lastname.getText().toString())){ + Intent intent = new Intent(getActivity(), CustomerActivity.class); + startActivity(intent); + } + else { + if (toast != null) { + toast.cancel(); // Vorhandene Toast-Nachricht abbrechen + } + toast = Toast.makeText(v.getContext(), getString(R.string.personNotFound), Toast.LENGTH_SHORT); + toast.show(); + } + + } + }); + + Button button2 = rootView.findViewById(R.id.buttonRegister4); + + + button2.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + FragmentManager fragmentManager = requireActivity().getSupportFragmentManager(); + FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); + fragmentTransaction.replace(R.id.container, new CustomerRegisterFragment()); + fragmentTransaction.addToBackStack(null); // Fügt den Fragment-Wechsel zur Back-Stack hinzu + fragmentTransaction.commit(); + } + }); + + return rootView; + }; + + + @Override + public void onActivityCreated(@Nullable Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + mViewModel = new ViewModelProvider(this).get(CustomerLogonViewModel.class); + // TODO: Use the ViewModel + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mampfmobil/ui/customer/CustomerLogonViewModel.java b/app/src/main/java/com/example/mampfmobil/ui/customer/CustomerLogonViewModel.java new file mode 100644 index 0000000000000000000000000000000000000000..cdd96058407fad68af08474b4f5b55257cc0334d --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/customer/CustomerLogonViewModel.java @@ -0,0 +1,7 @@ +package com.example.mampfmobil.ui.customer; + +import androidx.lifecycle.ViewModel; + +public class CustomerLogonViewModel extends ViewModel { + // TODO: Implement the ViewModel +} \ 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 new file mode 100644 index 0000000000000000000000000000000000000000..30b51c47096f8220520c739219bdd54a60909554 --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/customer/CustomerOrdersFragment.java @@ -0,0 +1,67 @@ +package com.example.mampfmobil.ui.customer; + +import androidx.appcompat.app.ActionBar; +import androidx.appcompat.app.AppCompatActivity; +import androidx.lifecycle.ViewModelProvider; + +import android.os.Bundle; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import com.example.mampfmobil.R; +import com.example.mampfmobil.ui.Classes.Recyclerviewadapter_Orders; +import com.example.mampfmobil.ui.Classes.Recyclerviewadapter_ShoppingCart; + +public class CustomerOrdersFragment extends Fragment { + + private CustomerOrdersViewModel mViewModel; + + public static CustomerOrdersFragment newInstance() { + return new CustomerOrdersFragment(); + } + + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, + @Nullable Bundle savedInstanceState) { + View rootView = inflater.inflate(R.layout.fragment_customer_orders, container, false); + + RecyclerView recyclerView = rootView.findViewById(R.id.myOrdersRecycler); + + + // Set the layout manager + LinearLayoutManager layoutManager = new LinearLayoutManager(requireActivity()); + recyclerView.setLayoutManager(layoutManager); + Recyclerviewadapter_Orders adapter = new Recyclerviewadapter_Orders(requireContext()); + recyclerView.setAdapter(adapter); + 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; + } + + + @Override + public void onActivityCreated(@Nullable Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + mViewModel = new ViewModelProvider(this).get(CustomerOrdersViewModel.class); + // TODO: Use the ViewModel + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mampfmobil/ui/customer/CustomerOrdersViewModel.java b/app/src/main/java/com/example/mampfmobil/ui/customer/CustomerOrdersViewModel.java new file mode 100644 index 0000000000000000000000000000000000000000..e162ed7734bbe66f7b6c355447b5b89c6fe6b32c --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/customer/CustomerOrdersViewModel.java @@ -0,0 +1,7 @@ +package com.example.mampfmobil.ui.customer; + +import androidx.lifecycle.ViewModel; + +public class CustomerOrdersViewModel extends ViewModel { + // TODO: Implement the ViewModel +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mampfmobil/ui/customer/CustomerRegisterFragment.java b/app/src/main/java/com/example/mampfmobil/ui/customer/CustomerRegisterFragment.java new file mode 100644 index 0000000000000000000000000000000000000000..364653720aba0d2889eccb23163ad0d821bcd45a --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/customer/CustomerRegisterFragment.java @@ -0,0 +1,92 @@ +package com.example.mampfmobil.ui.customer; + +import androidx.appcompat.app.ActionBar; +import androidx.appcompat.app.AppCompatActivity; +import androidx.lifecycle.ViewModelProvider; + +import android.content.Intent; +import android.os.Bundle; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; + +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.EditText; +import android.widget.Toast; + +import com.example.mampfmobil.R; +import com.example.mampfmobil.ui.CustomerActivity; +import com.example.mampfmobil.ui.DelivererActivity; +import com.example.mampfmobil.ui.MampfMobil; + +public class CustomerRegisterFragment extends Fragment { + + private CustomerRegisterViewModel mViewModel; + + public static CustomerRegisterFragment newInstance() { + return new CustomerRegisterFragment(); + } + + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, + @Nullable Bundle savedInstanceState) { + View rootView = inflater.inflate(R.layout.fragment_customer_register, container, false); + Button button = rootView.findViewById(R.id.buttonRegister); + EditText firstname = rootView.findViewById(R.id.editTextFirstName); + EditText lastname = rootView.findViewById(R.id.editTextLastName); + EditText register = rootView.findViewById(R.id.editTextAddress); + + AppCompatActivity activity = (AppCompatActivity) requireActivity(); + // Enable the back button in the ActionBar + ActionBar actionBar = activity.getSupportActionBar(); + if(actionBar != null) { + actionBar.setDisplayHomeAsUpEnabled(true); + } + + + button.setOnClickListener(new View.OnClickListener() { + private Toast toast; // + @Override + public void onClick(View v) { + if(firstname.getText().toString().equals("") || lastname.getText().toString().equals("") || register.getText().toString().equals("")){ + if (toast != null) { + toast.cancel(); // Vorhandene Toast-Nachricht abbrechen + } + toast = Toast.makeText(v.getContext(), getString(R.string.noEmptyIn), Toast.LENGTH_SHORT); + toast.show(); + return; + } + if(MampfMobil.createCustomer(firstname.getText().toString(),lastname.getText().toString(),register.getText().toString())){ + + + Intent intent = new Intent(getActivity(), CustomerActivity.class); + startActivity(intent); + } + else { + if (toast != null) { + toast.cancel(); // Vorhandene Toast-Nachricht abbrechen + } + toast = Toast.makeText(v.getContext(), getString(R.string.personFound), Toast.LENGTH_SHORT); + toast.show(); + } + // Wechsel zum anderen Fragment + } + }); + + + return rootView; + } + + @Override + public void onActivityCreated(@Nullable Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + mViewModel = new ViewModelProvider(this).get(CustomerRegisterViewModel.class); + // TODO: Use the ViewModel + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mampfmobil/ui/customer/CustomerRegisterViewModel.java b/app/src/main/java/com/example/mampfmobil/ui/customer/CustomerRegisterViewModel.java new file mode 100644 index 0000000000000000000000000000000000000000..aed904eeb0af4a865e8eb608cfbf39e93b6bfa49 --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/customer/CustomerRegisterViewModel.java @@ -0,0 +1,7 @@ +package com.example.mampfmobil.ui.customer; + +import androidx.lifecycle.ViewModel; + +public class CustomerRegisterViewModel extends ViewModel { + // TODO: Implement the ViewModel +} \ No newline at end of file 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 new file mode 100644 index 0000000000000000000000000000000000000000..9e6e4c21f718e62ff4b5ce47d18fd1d0b4ad8309 --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/customer/CustomerShopFragment.java @@ -0,0 +1,114 @@ +package com.example.mampfmobil.ui.customer; + +import androidx.appcompat.app.ActionBar; +import androidx.appcompat.app.AppCompatActivity; +import androidx.lifecycle.ViewModelProvider; + +import android.os.Bundle; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.Button; +import android.widget.EditText; +import android.widget.Spinner; + +import com.example.mampfmobil.R; +import com.example.mampfmobil.ui.Classes.Recyclerviewadapter_Shop; +import com.example.mampfmobil.ui.CustomerActivity; + +import java.util.ArrayList; +import java.util.List; + +public class CustomerShopFragment extends Fragment { + + private CustomerShopViewModel mViewModel; + + public static CustomerShopFragment newInstance() { + return new CustomerShopFragment(); + } + + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, + @Nullable Bundle savedInstanceState) { + View rootView = inflater.inflate(R.layout.fragment_customer_shop, container, false); + RecyclerView recyclerView = rootView.findViewById(R.id.myShopRecycler); + Button searchButton = rootView.findViewById(R.id.searchButton); + EditText searchEditText = rootView.findViewById(R.id.editTextSearch); + + List<String> options = new ArrayList<>(); + options.add(getString(R.string.name)); + options.add(getString(R.string.price)); + options.add(getString(R.string.restamount)); + + Spinner spinner = rootView.findViewById(R.id.spinnerOptions); + ArrayAdapter<String> adapter2 = new ArrayAdapter<>(requireContext(), android.R.layout.simple_spinner_item, options); + adapter2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + spinner.setAdapter(adapter2); + + + + // Set the layout manager + LinearLayoutManager layoutManager = new LinearLayoutManager(requireActivity()); + + recyclerView.setLayoutManager(layoutManager); + + CustomerActivity.setupShop(); + + Recyclerviewadapter_Shop adapter = new Recyclerviewadapter_Shop(requireContext(), CustomerActivity.shopItemList); + + recyclerView.setAdapter(adapter); + adapter.notifyDataSetChanged(); + + + + searchButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + CustomerActivity.setupShop(searchEditText.getText().toString()); + adapter.notifyDataSetChanged(); + } + }); + + spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + @Override + public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { + String selectedOption = options.get(position); + CustomerActivity.sortShop(selectedOption,getContext()); + adapter.notifyDataSetChanged(); + } + + @Override + public void onNothingSelected(AdapterView<?> parent) { + // Hier kannst du entsprechend reagieren, wenn nichts ausgewählt ist + } + }); + + 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; + } + + @Override + public void onActivityCreated(@Nullable Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + mViewModel = new ViewModelProvider(this).get(CustomerShopViewModel.class); + // TODO: Use the ViewModel + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mampfmobil/ui/customer/CustomerShopViewModel.java b/app/src/main/java/com/example/mampfmobil/ui/customer/CustomerShopViewModel.java new file mode 100644 index 0000000000000000000000000000000000000000..cab8bc573f709f89d165371852153434ff25db7c --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/customer/CustomerShopViewModel.java @@ -0,0 +1,7 @@ +package com.example.mampfmobil.ui.customer; + +import androidx.lifecycle.ViewModel; + +public class CustomerShopViewModel extends ViewModel { + // TODO: Implement the ViewModel +} \ No newline at end of file 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 new file mode 100644 index 0000000000000000000000000000000000000000..25bff74626c2931c5facefb80995e98e9cf8b506 --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/customer/CustomerShoppingCartFragment.java @@ -0,0 +1,121 @@ +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; + +import android.os.Bundle; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.EditText; +import android.widget.Switch; +import android.widget.TextView; + +import com.example.mampfmobil.R; +import com.example.mampfmobil.ui.Classes.Bestellung; +import com.example.mampfmobil.ui.Classes.BestellungsTeil; +import com.example.mampfmobil.ui.Classes.Recyclerviewadapter_Shop; +import com.example.mampfmobil.ui.Classes.Recyclerviewadapter_ShoppingCart; +import com.example.mampfmobil.ui.CustomerActivity; +import com.example.mampfmobil.ui.MampfMobil; + +public class CustomerShoppingCartFragment extends Fragment { + + private CustomerShoppingCartViewModel mViewModel; + public static TextView sum; + + public static CustomerShoppingCartFragment newInstance() { + return new CustomerShoppingCartFragment(); + } + + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, + @Nullable Bundle savedInstanceState) { + + View rootView = inflater.inflate(R.layout.fragment_customer_shopping_cart, container, false); + EditText addressEditText = rootView.findViewById(R.id.editTextAddress); + sum = rootView.findViewById(R.id.textViewSumComplete); + addressEditText.setText(MampfMobil.currentCustomer.adresse); + RecyclerView recyclerView = rootView.findViewById(R.id.recyclerViewShoppingCart); + Button buyButton = rootView.findViewById(R.id.buttonBuyAll); + Switch switchDelivery = rootView.findViewById(R.id.switchDelivery); + setSum(); + + // Set the layout manager + LinearLayoutManager layoutManager = new LinearLayoutManager(requireActivity()); + recyclerView.setLayoutManager(layoutManager); + Recyclerviewadapter_ShoppingCart adapter = new Recyclerviewadapter_ShoppingCart(requireContext()); + recyclerView.setAdapter(adapter); + adapter.notifyDataSetChanged(); + + buyButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + for(BestellungsTeil bT: MampfMobil.currentCustomer.shoppingCart){ + boolean exist = false; + for(Bestellung b:MampfMobil.currentCustomer.bestellungen){ + if(b.supplier == bT.item.supplier && b.state.equals(v.getContext().getString(R.string.ordered)) && !switchDelivery.isChecked() == b.delivery){ + b.addBestellungsteil(bT); + exist = true; + } + } + if(!exist){ + MampfMobil.currentCustomer.addBestellung(new Bestellung(bT.item.supplier,!switchDelivery.isChecked(), rootView.getContext())); + for(Bestellung b:MampfMobil.currentCustomer.bestellungen){ + if(b.supplier == bT.item.supplier && b.state.equals(v.getContext().getString(R.string.ordered))){ + b.addBestellungsteil(bT); + + } + } + } + } + + + + + MampfMobil.currentCustomer.shoppingCart.clear(); + adapter.notifyDataSetChanged(); + setSum(); + } + }); + + AppCompatActivity activity = (AppCompatActivity) requireActivity(); + // Enable the back button in the ActionBar + ActionBar actionBar = activity.getSupportActionBar(); + if (actionBar != null) { + actionBar.setDisplayHomeAsUpEnabled(true); + } + + + return rootView; + } + + @Override + public void onActivityCreated(@Nullable Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + mViewModel = new ViewModelProvider(this).get(CustomerShoppingCartViewModel.class); + // TODO: Use the ViewModel + } + + public static void setSum(){ + double temp = 0; + for(BestellungsTeil bT: MampfMobil.currentCustomer.shoppingCart){ + temp = temp + bT.item.price* bT.quantity; + } + sum.setText(String.format("%.2f", temp) + " €"); + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mampfmobil/ui/customer/CustomerShoppingCartViewModel.java b/app/src/main/java/com/example/mampfmobil/ui/customer/CustomerShoppingCartViewModel.java new file mode 100644 index 0000000000000000000000000000000000000000..136c1eba1120cdcd8e75293e01158e0ddc408d39 --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/customer/CustomerShoppingCartViewModel.java @@ -0,0 +1,7 @@ +package com.example.mampfmobil.ui.customer; + +import androidx.lifecycle.ViewModel; + +public class CustomerShoppingCartViewModel extends ViewModel { + // TODO: Implement the ViewModel +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mampfmobil/ui/deliverer/DelivererActiveOrdersFragment.java b/app/src/main/java/com/example/mampfmobil/ui/deliverer/DelivererActiveOrdersFragment.java new file mode 100644 index 0000000000000000000000000000000000000000..dd09ca536e3b7ea602152f634addbd647d182931 --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/deliverer/DelivererActiveOrdersFragment.java @@ -0,0 +1,79 @@ +package com.example.mampfmobil.ui.deliverer; + +import androidx.appcompat.app.ActionBar; +import androidx.appcompat.app.AppCompatActivity; +import androidx.lifecycle.ViewModelProvider; + +import android.content.Context; +import android.os.Bundle; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import com.example.mampfmobil.R; +import com.example.mampfmobil.ui.Classes.Bestellung; +import com.example.mampfmobil.ui.Classes.Customer; +import com.example.mampfmobil.ui.Classes.Recyclerviewadapter_deliverer_activeOrders; +import com.example.mampfmobil.ui.Classes.Recyclerviewadapter_deliverer_closedOrders; +import com.example.mampfmobil.ui.MampfMobil; + +import java.util.Vector; + +public class DelivererActiveOrdersFragment extends Fragment { + + private DelivererActiveOrdersViewModel mViewModel; + static Vector<Bestellung> activeOrders = new Vector<>(); + + public static DelivererActiveOrdersFragment newInstance() { + return new DelivererActiveOrdersFragment(); + } + + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, + @Nullable Bundle savedInstanceState) { + View rootView = inflater.inflate(R.layout.fragment_deliverer_active_orders, container, false); + + RecyclerView recyclerView = rootView.findViewById(R.id.mySupplierOrdersRecycler); + + AppCompatActivity activity = (AppCompatActivity) requireActivity(); + // Enable the back button in the ActionBar + ActionBar actionBar = activity.getSupportActionBar(); + if (actionBar != null) { + actionBar.setDisplayHomeAsUpEnabled(true); + } + LinearLayoutManager layoutManager = new LinearLayoutManager(requireActivity()); + recyclerView.setLayoutManager(layoutManager); + Context context = rootView.getContext(); + setVec(context); + Recyclerviewadapter_deliverer_activeOrders adapter = new Recyclerviewadapter_deliverer_activeOrders(requireContext(),activeOrders); + recyclerView.setAdapter(adapter); + adapter.notifyDataSetChanged(); + return rootView; + } + + public static void setVec(Context context){ + activeOrders = new Vector<>(); + for(Customer c: MampfMobil.customers){ + for(Bestellung b:c.bestellungen){ + if((b.state.equals(context.getString(R.string.readyForTransportDelivererFound)) || b.state.equals(context.getString(R.string.inTransportation))) && b.delivery){ + activeOrders.add(b); + } + } + } + } + + @Override + public void onActivityCreated(@Nullable Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + mViewModel = new ViewModelProvider(this).get(DelivererActiveOrdersViewModel.class); + // TODO: Use the ViewModel + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mampfmobil/ui/deliverer/DelivererActiveOrdersViewModel.java b/app/src/main/java/com/example/mampfmobil/ui/deliverer/DelivererActiveOrdersViewModel.java new file mode 100644 index 0000000000000000000000000000000000000000..547d66c44b4eed4d4e93f244f829355870089833 --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/deliverer/DelivererActiveOrdersViewModel.java @@ -0,0 +1,7 @@ +package com.example.mampfmobil.ui.deliverer; + +import androidx.lifecycle.ViewModel; + +public class DelivererActiveOrdersViewModel extends ViewModel { + // TODO: Implement the ViewModel +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mampfmobil/ui/deliverer/DelivererClosedOrdersFragment.java b/app/src/main/java/com/example/mampfmobil/ui/deliverer/DelivererClosedOrdersFragment.java new file mode 100644 index 0000000000000000000000000000000000000000..9b9962ca6b722ef87bb423ecee3a7009e7d3aadf --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/deliverer/DelivererClosedOrdersFragment.java @@ -0,0 +1,80 @@ +package com.example.mampfmobil.ui.deliverer; + +import androidx.appcompat.app.ActionBar; +import androidx.appcompat.app.AppCompatActivity; +import androidx.lifecycle.ViewModelProvider; + +import android.content.Context; +import android.os.Bundle; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import com.example.mampfmobil.R; +import com.example.mampfmobil.ui.Classes.Bestellung; +import com.example.mampfmobil.ui.Classes.Customer; +import com.example.mampfmobil.ui.Classes.Recyclerviewadapter_deliverer_orders; +import com.example.mampfmobil.ui.MampfMobil; + +import java.util.Vector; + +public class DelivererClosedOrdersFragment extends Fragment { + + private DelivererClosedOrdersViewModel mViewModel; + + static Vector<Bestellung> closedOrders = new Vector<>(); + + public static DelivererClosedOrdersFragment newInstance() { + return new DelivererClosedOrdersFragment(); + } + + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, + @Nullable Bundle savedInstanceState) { + View rootView = inflater.inflate(R.layout.fragment_deliverer_closed_orders, container, false); + + RecyclerView recyclerView = rootView.findViewById(R.id.mySupplierOrdersRecycler); + + AppCompatActivity activity = (AppCompatActivity) requireActivity(); + // Enable the back button in the ActionBar + ActionBar actionBar = activity.getSupportActionBar(); + if (actionBar != null) { + actionBar.setDisplayHomeAsUpEnabled(true); + } + + LinearLayoutManager layoutManager = new LinearLayoutManager(requireActivity()); + recyclerView.setLayoutManager(layoutManager); + Context context = rootView.getContext(); + setVec(context); + Recyclerviewadapter_deliverer_orders adapter = new Recyclerviewadapter_deliverer_orders(requireContext(),closedOrders); + recyclerView.setAdapter(adapter); + adapter.notifyDataSetChanged(); + return rootView; + } + + public static void setVec(Context context){ + closedOrders = new Vector<>(); + for(Customer c: MampfMobil.customers){ + for(Bestellung b:c.bestellungen){ + if(b.state.equals(context.getString(R.string.delivered)) && b.deliverer == MampfMobil.currentDeliverer){ + closedOrders.add(b); + } + } + } + } + + @Override + public void onActivityCreated(@Nullable Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + mViewModel = new ViewModelProvider(this).get(DelivererClosedOrdersViewModel.class); + // TODO: Use the ViewModel + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mampfmobil/ui/deliverer/DelivererClosedOrdersViewModel.java b/app/src/main/java/com/example/mampfmobil/ui/deliverer/DelivererClosedOrdersViewModel.java new file mode 100644 index 0000000000000000000000000000000000000000..348b9db1e8003896b042ce87c115dee9c96850f2 --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/deliverer/DelivererClosedOrdersViewModel.java @@ -0,0 +1,7 @@ +package com.example.mampfmobil.ui.deliverer; + +import androidx.lifecycle.ViewModel; + +public class DelivererClosedOrdersViewModel extends ViewModel { + // TODO: Implement the ViewModel +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mampfmobil/ui/deliverer/DelivererLogonFragment.java b/app/src/main/java/com/example/mampfmobil/ui/deliverer/DelivererLogonFragment.java new file mode 100644 index 0000000000000000000000000000000000000000..30989ced0a94074933824687604702b14aacdef5 --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/deliverer/DelivererLogonFragment.java @@ -0,0 +1,99 @@ +package com.example.mampfmobil.ui.deliverer; + +import androidx.appcompat.app.ActionBar; +import androidx.appcompat.app.AppCompatActivity; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentTransaction; +import androidx.lifecycle.ViewModelProvider; + +import android.content.Intent; +import android.os.Bundle; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; + +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.EditText; +import android.widget.Toast; + +import com.example.mampfmobil.R; +import com.example.mampfmobil.ui.CustomerActivity; +import com.example.mampfmobil.ui.DelivererActivity; +import com.example.mampfmobil.ui.MampfMobil; +import com.example.mampfmobil.ui.supplier.SupplierRegisterFragment; + +public class DelivererLogonFragment extends Fragment { + + private DelivererLogonViewModel mViewModel; + + public static DelivererLogonFragment newInstance() { + return new DelivererLogonFragment(); + } + + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, + @Nullable Bundle savedInstanceState) { + View rootView = inflater.inflate(R.layout.fragment_deliverer_logon, container, false); + Button button = rootView.findViewById(R.id.buttonRegister); + + EditText firstname = rootView.findViewById(R.id.editTextFirstName); + EditText lastname = rootView.findViewById(R.id.editTextLastName); + + AppCompatActivity activity = (AppCompatActivity) requireActivity(); + // Enable the back button in the ActionBar + ActionBar actionBar = activity.getSupportActionBar(); + if(actionBar != null) { + actionBar.setDisplayHomeAsUpEnabled(true); + } + + button.setOnClickListener(new View.OnClickListener() { + private Toast toast; // + @Override + public void onClick(View v) { + // Wechsel zum anderen Fragment + + if(MampfMobil.findDeliverer(firstname.getText().toString(),lastname.getText().toString())){ + Intent intent = new Intent(getActivity(), DelivererActivity.class); + startActivity(intent); + } + else { + if (toast != null) { + toast.cancel(); // Vorhandene Toast-Nachricht abbrechen + } + toast = Toast.makeText(v.getContext(), getString(R.string.personNotFound), Toast.LENGTH_SHORT); + toast.show(); + } + } + }); + + Button button2 = rootView.findViewById(R.id.buttonRegister3); + + + button2.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + FragmentManager fragmentManager = requireActivity().getSupportFragmentManager(); + FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); + fragmentTransaction.replace(R.id.container, new DelivererRegisterFragment()); + fragmentTransaction.addToBackStack(null); // Fügt den Fragment-Wechsel zur Back-Stack hinzu + fragmentTransaction.commit(); + } + }); + + return rootView; + } + + + @Override + public void onActivityCreated(@Nullable Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + mViewModel = new ViewModelProvider(this).get(DelivererLogonViewModel.class); + // TODO: Use the ViewModel + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mampfmobil/ui/deliverer/DelivererLogonViewModel.java b/app/src/main/java/com/example/mampfmobil/ui/deliverer/DelivererLogonViewModel.java new file mode 100644 index 0000000000000000000000000000000000000000..c365126af8f30e549436779f773c5a1261f71c2e --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/deliverer/DelivererLogonViewModel.java @@ -0,0 +1,7 @@ +package com.example.mampfmobil.ui.deliverer; + +import androidx.lifecycle.ViewModel; + +public class DelivererLogonViewModel extends ViewModel { + // TODO: Implement the ViewModel +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mampfmobil/ui/deliverer/DelivererOpenOrdersFragment.java b/app/src/main/java/com/example/mampfmobil/ui/deliverer/DelivererOpenOrdersFragment.java new file mode 100644 index 0000000000000000000000000000000000000000..99e9da696f2b93c674307a7be1c3c3c7526bb26c --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/deliverer/DelivererOpenOrdersFragment.java @@ -0,0 +1,82 @@ +package com.example.mampfmobil.ui.deliverer; + +import androidx.appcompat.app.ActionBar; +import androidx.appcompat.app.AppCompatActivity; +import androidx.lifecycle.ViewModelProvider; + +import android.content.Context; +import android.os.Bundle; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import com.example.mampfmobil.R; +import com.example.mampfmobil.ui.Classes.Bestellung; +import com.example.mampfmobil.ui.Classes.Customer; +import com.example.mampfmobil.ui.Classes.Recyclerviewadapter_Supplier_Orders; +import com.example.mampfmobil.ui.Classes.Recyclerviewadapter_deliverer_orders; +import com.example.mampfmobil.ui.MampfMobil; + +import java.util.Vector; + +public class DelivererOpenOrdersFragment extends Fragment { + + private DelivererOpenOrdersViewModel mViewModel; + + static Vector<Bestellung> openOrders = new Vector<>(); + + public static DelivererOpenOrdersFragment newInstance() { + return new DelivererOpenOrdersFragment(); + } + + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, + @Nullable Bundle savedInstanceState) { + + View rootView = inflater.inflate(R.layout.fragment_deliverer_open_orders, container, false); + + RecyclerView recyclerView = rootView.findViewById(R.id.mySupplierOrdersRecycler); + + AppCompatActivity activity = (AppCompatActivity) requireActivity(); + // Enable the back button in the ActionBar + ActionBar actionBar = activity.getSupportActionBar(); + if (actionBar != null) { + actionBar.setDisplayHomeAsUpEnabled(true); + } + + LinearLayoutManager layoutManager = new LinearLayoutManager(requireActivity()); + recyclerView.setLayoutManager(layoutManager); + Context context = rootView.getContext(); + setVec(context); + Recyclerviewadapter_deliverer_orders adapter = new Recyclerviewadapter_deliverer_orders(requireContext(),openOrders); + recyclerView.setAdapter(adapter); + adapter.notifyDataSetChanged(); + return rootView; + } + + @Override + public void onActivityCreated(@Nullable Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + mViewModel = new ViewModelProvider(this).get(DelivererOpenOrdersViewModel.class); + // TODO: Use the ViewModel + } + + public static void setVec(Context context){ + openOrders = new Vector<>(); + for(Customer c: MampfMobil.customers){ + for(Bestellung b:c.bestellungen){ + if(b.state.equals(context.getString(R.string.readyForTransport)) && b.delivery){ + openOrders.add(b); + } + } + } + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mampfmobil/ui/deliverer/DelivererOpenOrdersViewModel.java b/app/src/main/java/com/example/mampfmobil/ui/deliverer/DelivererOpenOrdersViewModel.java new file mode 100644 index 0000000000000000000000000000000000000000..9db5c4b6b4ca8533b7467f54c2d4c7e42050a6d4 --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/deliverer/DelivererOpenOrdersViewModel.java @@ -0,0 +1,7 @@ +package com.example.mampfmobil.ui.deliverer; + +import androidx.lifecycle.ViewModel; + +public class DelivererOpenOrdersViewModel extends ViewModel { + // TODO: Implement the ViewModel +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mampfmobil/ui/deliverer/DelivererRegisterFragment.java b/app/src/main/java/com/example/mampfmobil/ui/deliverer/DelivererRegisterFragment.java new file mode 100644 index 0000000000000000000000000000000000000000..efd5f6e33ffbbf8a023e0af59a2c0b68db5bf093 --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/deliverer/DelivererRegisterFragment.java @@ -0,0 +1,87 @@ +package com.example.mampfmobil.ui.deliverer; + +import androidx.appcompat.app.ActionBar; +import androidx.appcompat.app.AppCompatActivity; +import androidx.lifecycle.ViewModelProvider; + +import android.content.Intent; +import android.os.Bundle; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; + +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.EditText; +import android.widget.Toast; + +import com.example.mampfmobil.R; +import com.example.mampfmobil.ui.DelivererActivity; +import com.example.mampfmobil.ui.MampfMobil; + +public class DelivererRegisterFragment extends Fragment { + + private DelivererRegisterViewModel mViewModel; + + public static DelivererRegisterFragment newInstance() { + return new DelivererRegisterFragment(); + } + + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, + @Nullable Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_deliverer_register, container, false); + Button button = rootView.findViewById(R.id.buttonRegister); + + EditText firstname = rootView.findViewById(R.id.editTextFirstName); + EditText lastname = rootView.findViewById(R.id.editTextLastName); + EditText register = rootView.findViewById(R.id.editTextAddress); + + AppCompatActivity activity = (AppCompatActivity) requireActivity(); + // Enable the back button in the ActionBar + ActionBar actionBar = activity.getSupportActionBar(); + if(actionBar != null) { + actionBar.setDisplayHomeAsUpEnabled(true); + } + + button.setOnClickListener(new View.OnClickListener() { + private Toast toast; // + @Override + public void onClick(View v) { + if(firstname.getText().toString().equals("") || lastname.getText().toString().equals("") || register.getText().toString().equals("")){ + if (toast != null) { + toast.cancel(); // Vorhandene Toast-Nachricht abbrechen + } + toast = Toast.makeText(v.getContext(), getString(R.string.noEmptyIn), Toast.LENGTH_SHORT); + toast.show(); + return; + } + if(MampfMobil.createDeliverer(firstname.getText().toString(),lastname.getText().toString(),register.getText().toString())){ + Intent intent = new Intent(getActivity(), DelivererActivity.class); + startActivity(intent); + } + else { + if (toast != null) { + toast.cancel(); // Vorhandene Toast-Nachricht abbrechen + } + toast = Toast.makeText(v.getContext(), getString(R.string.personFound), Toast.LENGTH_SHORT); + toast.show(); + } + // Wechsel zum anderen Fragment + } + }); + + return rootView; + } + + @Override + public void onActivityCreated(@Nullable Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + mViewModel = new ViewModelProvider(this).get(DelivererRegisterViewModel.class); + // TODO: Use the ViewModel + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mampfmobil/ui/deliverer/DelivererRegisterViewModel.java b/app/src/main/java/com/example/mampfmobil/ui/deliverer/DelivererRegisterViewModel.java new file mode 100644 index 0000000000000000000000000000000000000000..fac4ced197eac45a8b341f0954fef4c0e79e2918 --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/deliverer/DelivererRegisterViewModel.java @@ -0,0 +1,7 @@ +package com.example.mampfmobil.ui.deliverer; + +import androidx.lifecycle.ViewModel; + +public class DelivererRegisterViewModel extends ViewModel { + // TODO: Implement the ViewModel +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mampfmobil/ui/supplier/SupplierAddItemFragment.java b/app/src/main/java/com/example/mampfmobil/ui/supplier/SupplierAddItemFragment.java new file mode 100644 index 0000000000000000000000000000000000000000..e8bab5a64c13fcee5aae9893d4d4c6e847accf87 --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/supplier/SupplierAddItemFragment.java @@ -0,0 +1,89 @@ +package com.example.mampfmobil.ui.supplier; + +import androidx.lifecycle.ViewModelProvider; + +import android.os.Bundle; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; + +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.EditText; +import android.widget.Toast; + +import com.example.mampfmobil.R; +import com.example.mampfmobil.ui.Classes.ShopItem; +import com.example.mampfmobil.ui.MampfMobil; + +public class SupplierAddItemFragment extends Fragment { + + private SupplierAddItemViewModel mViewModel; + private Toast toast; + private boolean exists = false; + + public static SupplierAddItemFragment newInstance() { + return new SupplierAddItemFragment(); + } + + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, + @Nullable Bundle savedInstanceState) { + View rootView = inflater.inflate(R.layout.fragment_supplier_add_item, container, false); + + Button button = rootView.findViewById(R.id.buttonAddnewitem); + EditText etName = rootView.findViewById(R.id.editTextItemName); + EditText etAmount = rootView.findViewById(R.id.editTextItemAmount); + EditText etPrice = rootView.findViewById(R.id.editTextTextItemPrice); + + + button.setOnClickListener(new View.OnClickListener() { + + @Override + public void onClick(View view) { + + if(etName.getText().toString().equals("") || etPrice.getText().toString().equals("") || etAmount.getText().toString().equals("")){ + if (toast != null) { + toast.cancel(); // Vorhandene Toast-Nachricht abbrechen + } + toast = Toast.makeText(rootView.getContext(), R.string.noemptyinput, Toast.LENGTH_SHORT); + toast.show(); + return; + } + exists = false; + for(ShopItem sI: MampfMobil.currentSupplier.shopItems){ + + if(sI.item.name.equals(etName.getText().toString())){ + exists = true; + } + } + if(exists){ + if (toast != null) { + toast.cancel(); // Vorhandene Toast-Nachricht abbrechen + } + toast = Toast.makeText(rootView.getContext(), R.string.item_already_exists, Toast.LENGTH_SHORT); + toast.show(); + } + else{ + MampfMobil.currentSupplier.itemAdd(etName.getText().toString(), Integer.parseInt(etAmount.getText().toString()),Double.parseDouble(etPrice.getText().toString())); + } + + } + }); + + + + return rootView; + } + + @Override + public void onActivityCreated(@Nullable Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + mViewModel = new ViewModelProvider(this).get(SupplierAddItemViewModel.class); + // TODO: Use the ViewModel + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mampfmobil/ui/supplier/SupplierAddItemViewModel.java b/app/src/main/java/com/example/mampfmobil/ui/supplier/SupplierAddItemViewModel.java new file mode 100644 index 0000000000000000000000000000000000000000..fcb81f3ee19321b4bb025b4fb9a1a83dee4abd62 --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/supplier/SupplierAddItemViewModel.java @@ -0,0 +1,7 @@ +package com.example.mampfmobil.ui.supplier; + +import androidx.lifecycle.ViewModel; + +public class SupplierAddItemViewModel extends ViewModel { + // TODO: Implement the ViewModel +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mampfmobil/ui/supplier/SupplierEditItemFragment.java b/app/src/main/java/com/example/mampfmobil/ui/supplier/SupplierEditItemFragment.java new file mode 100644 index 0000000000000000000000000000000000000000..0b335e921ebc4b1a5ca41b4b42a3ee40cc29128a --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/supplier/SupplierEditItemFragment.java @@ -0,0 +1,53 @@ +package com.example.mampfmobil.ui.supplier; + +import androidx.lifecycle.ViewModelProvider; + +import android.os.Bundle; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import com.example.mampfmobil.R; +import com.example.mampfmobil.ui.Classes.Recyclerviewadapter_ShoppingCart; +import com.example.mampfmobil.ui.Classes.Recyclerviewadapter_editItem; + +public class SupplierEditItemFragment extends Fragment { + + private SupplierEditItemViewModel mViewModel; + + public static SupplierEditItemFragment newInstance() { + return new SupplierEditItemFragment(); + } + + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, + @Nullable Bundle savedInstanceState) { + View rootView = inflater.inflate(R.layout.fragment_supplier_edit_item, container, false); + RecyclerView recyclerView = rootView.findViewById(R.id.myShopitemsRecycler); + + // Set the layout manager + LinearLayoutManager layoutManager = new LinearLayoutManager(requireActivity()); + recyclerView.setLayoutManager(layoutManager); + Recyclerviewadapter_editItem adapter = new Recyclerviewadapter_editItem(requireContext()); + recyclerView.setAdapter(adapter); + adapter.notifyDataSetChanged(); + + + return rootView; + } + + @Override + public void onActivityCreated(@Nullable Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + mViewModel = new ViewModelProvider(this).get(SupplierEditItemViewModel.class); + // TODO: Use the ViewModel + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mampfmobil/ui/supplier/SupplierEditItemViewModel.java b/app/src/main/java/com/example/mampfmobil/ui/supplier/SupplierEditItemViewModel.java new file mode 100644 index 0000000000000000000000000000000000000000..dd29d45ab69f92a841dd82634e4449f5e81bf885 --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/supplier/SupplierEditItemViewModel.java @@ -0,0 +1,7 @@ +package com.example.mampfmobil.ui.supplier; + +import androidx.lifecycle.ViewModel; + +public class SupplierEditItemViewModel extends ViewModel { + // TODO: Implement the ViewModel +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mampfmobil/ui/supplier/SupplierLogonFragment.java b/app/src/main/java/com/example/mampfmobil/ui/supplier/SupplierLogonFragment.java new file mode 100644 index 0000000000000000000000000000000000000000..cd907150b1c69524421373cdfca163e1888d4486 --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/supplier/SupplierLogonFragment.java @@ -0,0 +1,100 @@ +package com.example.mampfmobil.ui.supplier; + +import androidx.appcompat.app.ActionBar; +import androidx.appcompat.app.AppCompatActivity; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentTransaction; +import androidx.lifecycle.ViewModelProvider; + +import android.content.Intent; +import android.os.Bundle; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; + +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.EditText; +import android.widget.Toast; + +import com.example.mampfmobil.R; +import com.example.mampfmobil.ui.CustomerActivity; +import com.example.mampfmobil.ui.DelivererActivity; +import com.example.mampfmobil.ui.MampfMobil; +import com.example.mampfmobil.ui.SupplierActivity; +import com.example.mampfmobil.ui.deliverer.DelivererLogonFragment; + +public class SupplierLogonFragment extends Fragment { + + private SupplierLogonViewModel mViewModel; + + public static SupplierLogonFragment newInstance() { + return new SupplierLogonFragment(); + } + + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, + @Nullable Bundle savedInstanceState) { + View rootView = inflater.inflate(R.layout.fragment_supplier_logon, container, false); + Button button = rootView.findViewById(R.id.buttonRegister); + EditText firstname = rootView.findViewById(R.id.editTextFirstName); + + AppCompatActivity activity = (AppCompatActivity) requireActivity(); + // Enable the back button in the ActionBar + ActionBar actionBar = activity.getSupportActionBar(); + if(actionBar != null) { + actionBar.setDisplayHomeAsUpEnabled(true); + } + + + button.setOnClickListener(new View.OnClickListener() { + private Toast toast; // + @Override + public void onClick(View v) { + + + if(MampfMobil.findSupplier(firstname.getText().toString())){ + Intent intent = new Intent(getActivity(), SupplierActivity.class); + startActivity(intent); + } + else { + if (toast != null) { + toast.cancel(); // Vorhandene Toast-Nachricht abbrechen + } + toast = Toast.makeText(v.getContext(), getString(R.string.supplierNotFound), Toast.LENGTH_SHORT); + toast.show(); + } + + } + }); + + Button button2 = rootView.findViewById(R.id.buttonRegister2); + + button2.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + FragmentManager fragmentManager = requireActivity().getSupportFragmentManager(); + FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); + fragmentTransaction.replace(R.id.container, new SupplierRegisterFragment()); + fragmentTransaction.addToBackStack(null); // Fügt den Fragment-Wechsel zur Back-Stack hinzu + fragmentTransaction.commit(); + } + }); + + + return rootView; + } + + + @Override + public void onActivityCreated(@Nullable Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + mViewModel = new ViewModelProvider(this).get(SupplierLogonViewModel.class); + // TODO: Use the ViewModel + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mampfmobil/ui/supplier/SupplierLogonViewModel.java b/app/src/main/java/com/example/mampfmobil/ui/supplier/SupplierLogonViewModel.java new file mode 100644 index 0000000000000000000000000000000000000000..74624de76c6095197fbd4c50baf388c5541212c0 --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/supplier/SupplierLogonViewModel.java @@ -0,0 +1,7 @@ +package com.example.mampfmobil.ui.supplier; + +import androidx.lifecycle.ViewModel; + +public class SupplierLogonViewModel extends ViewModel { + // TODO: Implement the ViewModel +} \ No newline at end of file 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 new file mode 100644 index 0000000000000000000000000000000000000000..3493a1a90ac9580c5fbe5faa7c462bf06d900fad --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/supplier/SupplierOrdersFragment.java @@ -0,0 +1,62 @@ +package com.example.mampfmobil.ui.supplier; + +import androidx.appcompat.app.ActionBar; +import androidx.appcompat.app.AppCompatActivity; +import androidx.lifecycle.ViewModelProvider; + +import android.os.Bundle; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import com.example.mampfmobil.R; +import com.example.mampfmobil.ui.Classes.Recyclerviewadapter_Orders; +import com.example.mampfmobil.ui.Classes.Recyclerviewadapter_Supplier_Orders; + +public class SupplierOrdersFragment extends Fragment { + + private SupplierOrdersViewModel mViewModel; + + public static SupplierOrdersFragment newInstance() { + return new SupplierOrdersFragment(); + } + + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, + @Nullable Bundle savedInstanceState) { + + View rootView = inflater.inflate(R.layout.fragment_supplier_orders, container, false); + + RecyclerView recyclerView = rootView.findViewById(R.id.mySupplierOrdersRecycler); + + AppCompatActivity activity = (AppCompatActivity) requireActivity(); + // Enable the back button in the ActionBar + ActionBar actionBar = activity.getSupportActionBar(); + if (actionBar != null) { + actionBar.setDisplayHomeAsUpEnabled(true); + } + + LinearLayoutManager layoutManager = new LinearLayoutManager(requireActivity()); + recyclerView.setLayoutManager(layoutManager); + Recyclerviewadapter_Supplier_Orders adapter = new Recyclerviewadapter_Supplier_Orders(requireContext()); + recyclerView.setAdapter(adapter); + adapter.notifyDataSetChanged(); + + return rootView; + } + + @Override + public void onActivityCreated(@Nullable Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + mViewModel = new ViewModelProvider(this).get(SupplierOrdersViewModel.class); + // TODO: Use the ViewModel + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mampfmobil/ui/supplier/SupplierOrdersViewModel.java b/app/src/main/java/com/example/mampfmobil/ui/supplier/SupplierOrdersViewModel.java new file mode 100644 index 0000000000000000000000000000000000000000..ca7944a71bcc3840e1a21ee92d57756a86f27af9 --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/supplier/SupplierOrdersViewModel.java @@ -0,0 +1,7 @@ +package com.example.mampfmobil.ui.supplier; + +import androidx.lifecycle.ViewModel; + +public class SupplierOrdersViewModel extends ViewModel { + // TODO: Implement the ViewModel +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mampfmobil/ui/supplier/SupplierRegisterFragment.java b/app/src/main/java/com/example/mampfmobil/ui/supplier/SupplierRegisterFragment.java new file mode 100644 index 0000000000000000000000000000000000000000..6bd6d744eade9f08572a018c2fb12cf6c918085c --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/supplier/SupplierRegisterFragment.java @@ -0,0 +1,92 @@ +package com.example.mampfmobil.ui.supplier; + +import androidx.appcompat.app.ActionBar; +import androidx.appcompat.app.AppCompatActivity; +import androidx.lifecycle.ViewModelProvider; + +import android.content.Intent; +import android.os.Bundle; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; + +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.EditText; +import android.widget.Toast; + +import com.example.mampfmobil.R; +import com.example.mampfmobil.ui.CustomerActivity; +import com.example.mampfmobil.ui.DelivererActivity; +import com.example.mampfmobil.ui.MampfMobil; +import com.example.mampfmobil.ui.SupplierActivity; + +public class SupplierRegisterFragment extends Fragment { + + private SupplierRegisterViewModel mViewModel; + + public static SupplierRegisterFragment newInstance() { + return new SupplierRegisterFragment(); + } + + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, + @Nullable Bundle savedInstanceState) { + View rootView = inflater.inflate(R.layout.fragment_supplier_register, container, false); + Button button = rootView.findViewById(R.id.buttonRegister); + EditText name = rootView.findViewById(R.id.editTextFirstName); + EditText register = rootView.findViewById(R.id.editTextAddress); + + AppCompatActivity activity = (AppCompatActivity) requireActivity(); + // Enable the back button in the ActionBar + ActionBar actionBar = activity.getSupportActionBar(); + if(actionBar != null) { + actionBar.setDisplayHomeAsUpEnabled(true); + } + + button.setOnClickListener(new View.OnClickListener() { + private Toast toast; // + @Override + public void onClick(View v) { + if(name.getText().toString().equals("") || register.getText().toString().equals("")){ + if (toast != null) { + toast.cancel(); // Vorhandene Toast-Nachricht abbrechen + } + toast = Toast.makeText(v.getContext(), getString(R.string.noEmptyIn), Toast.LENGTH_SHORT); + toast.show(); + return; + } + if(MampfMobil.createSupplier(name.getText().toString(),register.getText().toString())){ + + Intent intent = new Intent(getActivity(), SupplierActivity.class); + startActivity(intent); + } + else { + if (toast != null) { + toast.cancel(); // Vorhandene Toast-Nachricht abbrechen + } + toast = Toast.makeText(v.getContext(), getString(R.string.supplierFound), Toast.LENGTH_SHORT); + toast.show(); + } + // Wechsel zum anderen Fragment + + } + }); + + return rootView; + } + + + + @Override + public void onActivityCreated(@Nullable Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + mViewModel = new ViewModelProvider(this).get(SupplierRegisterViewModel.class); + // TODO: Use the ViewModel + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mampfmobil/ui/supplier/SupplierRegisterViewModel.java b/app/src/main/java/com/example/mampfmobil/ui/supplier/SupplierRegisterViewModel.java new file mode 100644 index 0000000000000000000000000000000000000000..e1c700847ab96ec3b0cf24e28af2a006e8654c96 --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/supplier/SupplierRegisterViewModel.java @@ -0,0 +1,7 @@ +package com.example.mampfmobil.ui.supplier; + +import androidx.lifecycle.ViewModel; + +public class SupplierRegisterViewModel extends ViewModel { + // TODO: Implement the ViewModel +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mampfmobil/ui/supplier/SupplierStatisticsFragment.java b/app/src/main/java/com/example/mampfmobil/ui/supplier/SupplierStatisticsFragment.java new file mode 100644 index 0000000000000000000000000000000000000000..8ba53136b3710fcf5c11b88c0b0f77e691360394 --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/supplier/SupplierStatisticsFragment.java @@ -0,0 +1,89 @@ +package com.example.mampfmobil.ui.supplier; + +import androidx.appcompat.app.ActionBar; +import androidx.appcompat.app.AppCompatActivity; +import androidx.lifecycle.ViewModelProvider; + +import android.os.Bundle; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import com.example.mampfmobil.R; +import com.example.mampfmobil.ui.Classes.Bestellung; +import com.example.mampfmobil.ui.Classes.BestellungsTeil; +import com.example.mampfmobil.ui.Classes.Customer; +import com.example.mampfmobil.ui.Classes.Recyclerviewadapter_Supplier_Orders; +import com.example.mampfmobil.ui.Classes.Recyclerviewadapter_statistic; +import com.example.mampfmobil.ui.MampfMobil; + +import java.util.Vector; + +public class SupplierStatisticsFragment extends Fragment { + + private SupplierStatisticsViewModel mViewModel; + public Vector<Bestellung> bestellungen; + public static SupplierStatisticsFragment newInstance() { + return new SupplierStatisticsFragment(); + } + + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, + @Nullable Bundle savedInstanceState) { + View rootView = inflater.inflate(R.layout.fragment_supplier_statistics, container, false); + + RecyclerView recyclerView = rootView.findViewById(R.id.mySupplierOrdersRecycler); + TextView tvSalesVolume = rootView.findViewById(R.id.textViewSalesVolume); + TextView tvOrders = rootView.findViewById(R.id.textViewOrderAmount); + TextView tvItemsSold = rootView.findViewById(R.id.textViewItemsSold); + + AppCompatActivity activity = (AppCompatActivity) requireActivity(); + + + LinearLayoutManager layoutManager = new LinearLayoutManager(requireActivity()); + recyclerView.setLayoutManager(layoutManager); + Recyclerviewadapter_statistic adapter = new Recyclerviewadapter_statistic(requireContext()); + recyclerView.setAdapter(adapter); + adapter.notifyDataSetChanged(); + + bestellungen= new Vector<>(); + for(Customer c: MampfMobil.customers){ + for(Bestellung b:c.bestellungen){ + if(b.supplier==MampfMobil.currentSupplier){ + bestellungen.add(b); + } + } + } + + tvOrders.setText(String.valueOf(bestellungen.size())); + int temp = 0; + double temp2 = 0; + for(Bestellung b:bestellungen){ + for(BestellungsTeil bT:b.bestellungsTeile){ + temp += bT.quantity; + temp2 += bT.quantity * bT.item.price; + } + } + tvItemsSold.setText(String.valueOf(temp)); + tvSalesVolume.setText(String.valueOf(temp2)); + + + return rootView; + } + + @Override + public void onActivityCreated(@Nullable Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + mViewModel = new ViewModelProvider(this).get(SupplierStatisticsViewModel.class); + // TODO: Use the ViewModel + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mampfmobil/ui/supplier/SupplierStatisticsViewModel.java b/app/src/main/java/com/example/mampfmobil/ui/supplier/SupplierStatisticsViewModel.java new file mode 100644 index 0000000000000000000000000000000000000000..a3567b644e06e557f7d42684624e998f334f2e04 --- /dev/null +++ b/app/src/main/java/com/example/mampfmobil/ui/supplier/SupplierStatisticsViewModel.java @@ -0,0 +1,7 @@ +package com.example.mampfmobil.ui.supplier; + +import androidx.lifecycle.ViewModel; + +public class SupplierStatisticsViewModel extends ViewModel { + // TODO: Implement the ViewModel +} \ No newline at end of file diff --git a/app/src/main/res/drawable/darkmode.png b/app/src/main/res/drawable/darkmode.png new file mode 100644 index 0000000000000000000000000000000000000000..7e8436a0bd8ebb2007731c46e352e36c546e587a Binary files /dev/null and b/app/src/main/res/drawable/darkmode.png differ diff --git a/app/src/main/res/drawable/de_flagge.JPG b/app/src/main/res/drawable/de_flagge.JPG new file mode 100644 index 0000000000000000000000000000000000000000..950a0911f2180a17cc8361085ec1b969ef00db1a Binary files /dev/null and b/app/src/main/res/drawable/de_flagge.JPG differ diff --git a/app/src/main/res/drawable/en_flagge.jpg b/app/src/main/res/drawable/en_flagge.jpg new file mode 100644 index 0000000000000000000000000000000000000000..b8ffd77155a5df8cf2b99eb03ed06ce58ab8f7d7 Binary files /dev/null and b/app/src/main/res/drawable/en_flagge.jpg differ diff --git a/app/src/main/res/drawable/lightmode.png b/app/src/main/res/drawable/lightmode.png new file mode 100644 index 0000000000000000000000000000000000000000..a810a1c35d5888c1a3fe734cc8f79c0986cc2b09 Binary files /dev/null and b/app/src/main/res/drawable/lightmode.png differ diff --git a/app/src/main/res/drawable/mampfmobil_logo.png b/app/src/main/res/drawable/mampfmobil_logo.png new file mode 100644 index 0000000000000000000000000000000000000000..5f39046a92a1d793d8f85ee9121e78d6f922d3f2 Binary files /dev/null and b/app/src/main/res/drawable/mampfmobil_logo.png differ diff --git a/app/src/main/res/layout/activity_customer.xml b/app/src/main/res/layout/activity_customer.xml new file mode 100644 index 0000000000000000000000000000000000000000..17b6001d09376249cc714650caf735ecabf2027f --- /dev/null +++ b/app/src/main/res/layout/activity_customer.xml @@ -0,0 +1,35 @@ +<?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" + android:id="@+id/container" + android:layout_width="match_parent" + android:layout_height="match_parent" + > + + <com.google.android.material.bottomnavigation.BottomNavigationView + android:id="@+id/nav_view1" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginStart="0dp" + android:layout_marginEnd="0dp" + android:background="?android:attr/windowBackground" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:menu="@menu/bottom_nav_menu_customer"/> + + <fragment + android:id="@+id/nav_host_fragment_activity_customer" + android:name="androidx.navigation.fragment.NavHostFragment" + android:layout_width="match_parent" + android:layout_height="match_parent" + app:defaultNavHost="true" + app:layout_constraintBottom_toTopOf="@id/nav_view1" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:navGraph="@navigation/mobile_navigation_cus" + /> + +</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/activity_deliverer.xml b/app/src/main/res/layout/activity_deliverer.xml new file mode 100644 index 0000000000000000000000000000000000000000..2045db1472ca05e7ed88e134cb274619bd6c460a --- /dev/null +++ b/app/src/main/res/layout/activity_deliverer.xml @@ -0,0 +1,35 @@ +<?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" + android:id="@+id/container" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:paddingTop="?attr/actionBarSize" > + + <com.google.android.material.bottomnavigation.BottomNavigationView + android:id="@+id/nav_view3" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginStart="0dp" + android:layout_marginEnd="0dp" + android:background="?android:attr/windowBackground" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:menu="@menu/bottom_nav_menu_deliverer"/> + + <fragment + android:id="@+id/nav_host_fragment_activity_deliverer" + android:name="androidx.navigation.fragment.NavHostFragment" + android:layout_width="match_parent" + android:layout_height="match_parent" + app:defaultNavHost="true" + app:layout_constraintBottom_toTopOf="@id/nav_view3" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:navGraph="@navigation/mobile_navigation_del" + /> + +</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 06ea6cae22113f243efe317f984f7742418737e8..bad97d63dc8bac143e499f7ff3a349305c72700f 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -3,8 +3,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_view" diff --git a/app/src/main/res/layout/activity_supplier.xml b/app/src/main/res/layout/activity_supplier.xml new file mode 100644 index 0000000000000000000000000000000000000000..ddacef9369981acbc1cff117403b19839895d229 --- /dev/null +++ b/app/src/main/res/layout/activity_supplier.xml @@ -0,0 +1,34 @@ +<?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" + android:id="@+id/container" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <com.google.android.material.bottomnavigation.BottomNavigationView + android:id="@+id/nav_view2" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginStart="0dp" + android:layout_marginEnd="0dp" + android:background="?android:attr/windowBackground" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:menu="@menu/bottom_nav_menu_supplier"/> + + <fragment + android:id="@+id/nav_host_fragment_activity_supplier" + android:name="androidx.navigation.fragment.NavHostFragment" + android:layout_width="match_parent" + android:layout_height="match_parent" + app:defaultNavHost="true" + app:layout_constraintBottom_toTopOf="@id/nav_view2" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:navGraph="@navigation/mobile_navigation_sup" + /> + +</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_customer_logon.xml b/app/src/main/res/layout/fragment_customer_logon.xml new file mode 100644 index 0000000000000000000000000000000000000000..3b59fbcfd9a6748469096f42f307ecf558f9b41d --- /dev/null +++ b/app/src/main/res/layout/fragment_customer_logon.xml @@ -0,0 +1,56 @@ +<?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.customer.CustomerLogonFragment"> + + <Button + android:id="@+id/buttonRegister4" + android:layout_width="141dp" + android:layout_height="52dp" + android:layout_marginEnd="20dp" + android:layout_marginBottom="20dp" + android:text="@string/register" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" /> + + <EditText + android:id="@+id/editTextFirstName" + android:layout_width="300dp" + android:layout_height="70dp" + android:hint="@string/first_name" + android:inputType="textPersonName" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.495" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="0.193" /> + +<EditText + android:id="@+id/editTextLastName" + android:layout_width="300dp" + android:layout_height="70dp" + android:hint="@string/last_name" + android:inputType="textPersonName" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.504" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/editTextFirstName" + app:layout_constraintVertical_bias="0.118" /> + + <Button + android:id="@+id/buttonRegister" + android:layout_width="213dp" + android:layout_height="63dp" + android:text="@string/logon" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/editTextLastName" + app:layout_constraintVertical_bias="0.208" /> + +</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_customer_orders.xml b/app/src/main/res/layout/fragment_customer_orders.xml new file mode 100644 index 0000000000000000000000000000000000000000..ba7cc3cf29833e4a5104be0ae429fb7ab4012006 --- /dev/null +++ b/app/src/main/res/layout/fragment_customer_orders.xml @@ -0,0 +1,23 @@ +<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" + android:paddingBottom="?attr/actionBarSize" + tools:context=".ui.customer.CustomerOrdersFragment"> + + + <androidx.recyclerview.widget.RecyclerView + android:id="@+id/myOrdersRecycler" + android:layout_width="match_parent" + android:layout_height="match_parent" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="0.0"> + + </androidx.recyclerview.widget.RecyclerView> + +</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_customer_register.xml b/app/src/main/res/layout/fragment_customer_register.xml new file mode 100644 index 0000000000000000000000000000000000000000..ef1cc2efbde1c121e46e0c12f5c091530979bd7a --- /dev/null +++ b/app/src/main/res/layout/fragment_customer_register.xml @@ -0,0 +1,59 @@ +<?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.customer.CustomerRegisterFragment"> + + <EditText + android:id="@+id/editTextFirstName" + android:layout_width="300dp" + android:layout_height="70dp" + android:hint="@string/first_name" + android:inputType="textPersonName" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.495" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="0.193" /> + + <EditText + android:id="@+id/editTextLastName" + android:layout_width="300dp" + android:layout_height="70dp" + android:hint="@string/last_name" + android:inputType="textPersonName" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.504" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/editTextFirstName" + app:layout_constraintVertical_bias="0.118" /> + + <EditText + android:id="@+id/editTextAddress" + android:layout_width="300dp" + android:layout_height="70dp" + android:hint="@string/address" + android:inputType="textMultiLine" + app:layout_constraintBottom_toTopOf="@+id/buttonRegister" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.504" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/editTextLastName" + app:layout_constraintVertical_bias="0.371" /> + + <Button + android:id="@+id/buttonRegister" + android:layout_width="213dp" + android:layout_height="63dp" + android:text="@string/register" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="0.821" /> + +</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_customer_shop.xml b/app/src/main/res/layout/fragment_customer_shop.xml new file mode 100644 index 0000000000000000000000000000000000000000..16c7978d0c90752a23d4762c3d780cbfce45e718 --- /dev/null +++ b/app/src/main/res/layout/fragment_customer_shop.xml @@ -0,0 +1,70 @@ +<?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" + android:paddingBottom="?attr/actionBarSize" + tools:context=".ui.customer.CustomerShopFragment"> + + + <EditText + android:id="@+id/editTextSearch" + android:layout_width="231dp" + android:layout_height="45dp" + android:layout_marginTop="8dp" + android:hint="@android:string/search_go" + android:inputType="textPersonName" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.207" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="0.0" /> + + <androidx.recyclerview.widget.RecyclerView + android:id="@+id/myShopRecycler" + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_marginTop="8dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/spinnerOptions" + app:layout_constraintVertical_bias="0.0"> + + </androidx.recyclerview.widget.RecyclerView> + + <Button + android:id="@+id/searchButton" + android:layout_width="109dp" + android:layout_height="39dp" + android:layout_marginTop="4dp" + android:layout_marginEnd="4dp" + android:text="@android:string/search_go" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toEndOf="@+id/editTextSearch" + app:layout_constraintTop_toTopOf="parent" /> + + <Spinner + android:id="@+id/spinnerOptions" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="8dp" + app:layout_constraintEnd_toEndOf="@+id/searchButton" + app:layout_constraintTop_toBottomOf="@+id/searchButton" /> + + <TextView + android:id="@+id/textView19" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="2dp" + android:layout_marginEnd="16dp" + android:text="Sort By:" + android:textSize="16sp" + app:layout_constraintEnd_toStartOf="@+id/spinnerOptions" + app:layout_constraintTop_toTopOf="@+id/spinnerOptions" /> + + +</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_customer_shopping_cart.xml b/app/src/main/res/layout/fragment_customer_shopping_cart.xml new file mode 100644 index 0000000000000000000000000000000000000000..e9dd5cd02af90aa81789e287a1badc73321750f3 --- /dev/null +++ b/app/src/main/res/layout/fragment_customer_shopping_cart.xml @@ -0,0 +1,102 @@ +<?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" + android:paddingBottom="?attr/actionBarSize" + tools:context=".ui.customer.CustomerShoppingCartFragment"> + + <androidx.recyclerview.widget.RecyclerView + android:id="@+id/recyclerViewShoppingCart" + android:layout_width="match_parent" + android:layout_height="match_parent" + tools:layout_editor_absoluteX="0dp" + tools:layout_editor_absoluteY="0dp" /> + + <Button + android:id="@+id/buttonBuyAll" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginEnd="24dp" + android:layout_marginBottom="24dp" + android:text="@string/buy" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" /> + + <TextView + android:id="@+id/textView2" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="16dp" + android:layout_marginBottom="44dp" + android:text="@string/address_dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="parent" /> + + <EditText + android:id="@+id/editTextAddress" + android:layout_width="203dp" + android:layout_height="57dp" + android:ems="10" + android:inputType="textMultiLine" + android:singleLine="false" + android:text="Weinbergstr 70, 55299 Nackenheim" + android:textSize="14sp" + app:layout_constraintStart_toEndOf="@+id/textView2" + app:layout_constraintTop_toTopOf="@+id/textView2" /> + + <TextView + android:id="@+id/textView3" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginBottom="8dp" + android:text="@string/delivery" + app:layout_constraintBottom_toTopOf="@+id/textView2" + app:layout_constraintStart_toStartOf="@+id/textView2" /> + + <TextView + android:id="@+id/textView4" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="12dp" + android:text="@string/storepickup" + app:layout_constraintBottom_toBottomOf="@+id/textView3" + app:layout_constraintStart_toEndOf="@+id/switchDelivery" + app:layout_constraintTop_toTopOf="@+id/textView3" + app:layout_constraintVertical_bias="0.0" /> + + <Switch + android:id="@+id/switchDelivery" + android:layout_width="51dp" + android:layout_height="18dp" + android:layout_marginStart="12dp" + app:layout_constraintBottom_toBottomOf="@+id/textView3" + app:layout_constraintStart_toEndOf="@+id/textView3" + app:layout_constraintTop_toTopOf="@+id/textView3" + app:layout_constraintVertical_bias="0.5"/> + + <TextView + android:id="@+id/textView5" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:text="@string/price_dp" + app:layout_constraintBottom_toBottomOf="@+id/textView4" + app:layout_constraintStart_toEndOf="@+id/textView4" + app:layout_constraintTop_toTopOf="@+id/textView4" + app:layout_constraintVertical_bias="0.0" /> + + <TextView + android:id="@+id/textViewSumComplete" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:text="10" + app:layout_constraintBottom_toBottomOf="@+id/textView5" + app:layout_constraintStart_toEndOf="@+id/textView5" + app:layout_constraintTop_toTopOf="@+id/textView5" + app:layout_constraintVertical_bias="1.0" /> + + +</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_decide.xml b/app/src/main/res/layout/fragment_decide.xml new file mode 100644 index 0000000000000000000000000000000000000000..8fda7891c84f99a87c2adad79054e3d376b2205f --- /dev/null +++ b/app/src/main/res/layout/fragment_decide.xml @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="utf-8"?> +<FrameLayout 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.DecideFragment"> + + <androidx.constraintlayout.widget.ConstraintLayout + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <Button + android:id="@+id/CustomerButton" + android:layout_width="200dp" + android:layout_height="70dp" + android:text="@string/title_customer" + app:layout_constraintBottom_toTopOf="@+id/SupplierButton" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.497" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="0.914" /> + + <Button + android:id="@+id/SupplierButton" + android:layout_width="200dp" + android:layout_height="70dp" + android:text="@string/title_supplier" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.497" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="0.44" /> + + <Button + android:id="@+id/DelivererButton" + android:layout_width="200dp" + android:layout_height="70dp" + android:text="@string/title_deliverer" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.498" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/SupplierButton" + app:layout_constraintVertical_bias="0.051" /> + + <ImageButton + android:id="@+id/imageView" + android:layout_width="100dp" + android:layout_height="60dp" + android:layout_marginTop="32dp" + android:layout_marginEnd="-80dp" + android:src="@drawable/de_flagge" + android:scaleType="fitCenter" + app:layout_constraintEnd_toStartOf="@+id/DelivererButton" + app:layout_constraintTop_toBottomOf="@+id/DelivererButton" /> + + <ImageButton + android:id="@+id/imageView2" + android:layout_width="100dp" + android:layout_height="60dp" + android:layout_marginStart="-80dp" + android:layout_marginTop="32dp" + android:src="@drawable/en_flagge" + android:scaleType="fitCenter" + app:layout_constraintStart_toEndOf="@+id/DelivererButton" + app:layout_constraintTop_toBottomOf="@+id/DelivererButton" /> + + <ImageButton + android:id="@+id/imageButton" + android:layout_width="87dp" + android:layout_height="83dp" + android:layout_marginTop="16dp" + android:layout_marginEnd="16dp" + android:scaleType="fitCenter" + android:src="@drawable/darkmode" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <ImageButton + android:id="@+id/imageButton2" + android:layout_width="87dp" + android:layout_height="83dp" + android:layout_marginTop="16dp" + android:scaleType="fitCenter" + android:src="@drawable/lightmode" + app:layout_constraintEnd_toStartOf="@+id/imageButton" + app:layout_constraintTop_toTopOf="parent" /> + + </androidx.constraintlayout.widget.ConstraintLayout> +</FrameLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_deliverer_active_orders.xml b/app/src/main/res/layout/fragment_deliverer_active_orders.xml new file mode 100644 index 0000000000000000000000000000000000000000..156867a9a877cfa68e15d8818e7d8e5209fbaf48 --- /dev/null +++ b/app/src/main/res/layout/fragment_deliverer_active_orders.xml @@ -0,0 +1,24 @@ + + <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" + android:paddingBottom="?attr/actionBarSize" + tools:context=".ui.deliverer.DelivererActiveOrdersFragment"> + + + <androidx.recyclerview.widget.RecyclerView + android:id="@+id/mySupplierOrdersRecycler" + android:layout_width="match_parent" + android:layout_height="match_parent" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="0.0"> + + </androidx.recyclerview.widget.RecyclerView> + + </androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_deliverer_closed_orders.xml b/app/src/main/res/layout/fragment_deliverer_closed_orders.xml new file mode 100644 index 0000000000000000000000000000000000000000..dc7f45249a417a74a72bf81915a13a0d3e48bdc7 --- /dev/null +++ b/app/src/main/res/layout/fragment_deliverer_closed_orders.xml @@ -0,0 +1,24 @@ + + <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" + android:paddingBottom="?attr/actionBarSize" + tools:context=".ui.deliverer.DelivererClosedOrdersFragment"> + + + <androidx.recyclerview.widget.RecyclerView + android:id="@+id/mySupplierOrdersRecycler" + android:layout_width="match_parent" + android:layout_height="match_parent" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="0.0"> + + </androidx.recyclerview.widget.RecyclerView> + + </androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_deliverer_logon.xml b/app/src/main/res/layout/fragment_deliverer_logon.xml new file mode 100644 index 0000000000000000000000000000000000000000..2302d6e929fe274b4b3bfb938dfe784c01014f9e --- /dev/null +++ b/app/src/main/res/layout/fragment_deliverer_logon.xml @@ -0,0 +1,56 @@ +<?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.deliverer.DelivererLogonFragment"> + + <Button + android:id="@+id/buttonRegister3" + android:layout_width="141dp" + android:layout_height="52dp" + android:layout_marginEnd="20dp" + android:layout_marginBottom="20dp" + android:text="@string/register" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" /> + + <EditText + android:id="@+id/editTextFirstName" + android:layout_width="300dp" + android:layout_height="70dp" + android:hint="@string/first_name" + android:inputType="textPersonName" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.495" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="0.193" /> + + <EditText + android:id="@+id/editTextLastName" + android:layout_width="300dp" + android:layout_height="70dp" + android:hint="@string/last_name" + android:inputType="textPersonName" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.504" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/editTextFirstName" + app:layout_constraintVertical_bias="0.118" /> + + <Button + android:id="@+id/buttonRegister" + android:layout_width="213dp" + android:layout_height="63dp" + android:text="@string/logon" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/editTextLastName" + app:layout_constraintVertical_bias="0.269" /> + +</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_deliverer_open_orders.xml b/app/src/main/res/layout/fragment_deliverer_open_orders.xml new file mode 100644 index 0000000000000000000000000000000000000000..6b9d1fa05ecb8873fa74fca175ea2008b61b174c --- /dev/null +++ b/app/src/main/res/layout/fragment_deliverer_open_orders.xml @@ -0,0 +1,24 @@ + +<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" + android:paddingBottom="?attr/actionBarSize" + tools:context=".ui.deliverer.DelivererOpenOrdersFragment"> + + + <androidx.recyclerview.widget.RecyclerView + android:id="@+id/mySupplierOrdersRecycler" + android:layout_width="match_parent" + android:layout_height="match_parent" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="0.0"> + + </androidx.recyclerview.widget.RecyclerView> + +</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_deliverer_register.xml b/app/src/main/res/layout/fragment_deliverer_register.xml new file mode 100644 index 0000000000000000000000000000000000000000..ba329baf1fb5c004afd5633f38a9c0d38f20ad26 --- /dev/null +++ b/app/src/main/res/layout/fragment_deliverer_register.xml @@ -0,0 +1,59 @@ +<?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.deliverer.DelivererRegisterFragment"> + + <EditText + android:id="@+id/editTextFirstName" + android:layout_width="300dp" + android:layout_height="70dp" + android:hint="@string/first_name" + android:inputType="textPersonName" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.495" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="0.193" /> + + <EditText + android:id="@+id/editTextLastName" + android:layout_width="300dp" + android:layout_height="70dp" + android:hint="@string/last_name" + android:inputType="textPersonName" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.504" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/editTextFirstName" + app:layout_constraintVertical_bias="0.118" /> + + <EditText + android:id="@+id/editTextAddress" + android:layout_width="300dp" + android:layout_height="70dp" + android:hint="@string/address" + android:inputType="textMultiLine" + app:layout_constraintBottom_toTopOf="@+id/buttonRegister" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.504" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/editTextLastName" + app:layout_constraintVertical_bias="0.371" /> + + <Button + android:id="@+id/buttonRegister" + android:layout_width="213dp" + android:layout_height="63dp" + android:text="@string/register" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="0.821" /> + + </androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_supplier_add_item.xml b/app/src/main/res/layout/fragment_supplier_add_item.xml new file mode 100644 index 0000000000000000000000000000000000000000..4eabf1f095bdcd4e62fccb0b03bba2fe85845221 --- /dev/null +++ b/app/src/main/res/layout/fragment_supplier_add_item.xml @@ -0,0 +1,85 @@ +<?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.supplier.SupplierAddItemFragment"> + + <EditText + android:id="@+id/editTextItemName" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="30dp" + android:ems="10" + android:inputType="text" + android:hint="Name" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/textView9" /> + + <EditText + android:id="@+id/editTextTextItemPrice" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="30dp" + android:ems="10" + android:inputType="numberDecimal" + android:hint="@string/price" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.497" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/textView12" /> + + <EditText + android:id="@+id/editTextItemAmount" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="30dp" + android:ems="10" + android:inputType="number" + android:hint="@string/amount" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/textView13" /> + + <TextView + android:id="@+id/textView9" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="64dp" + android:text="@string/itemname" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/textView12" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="60dp" + android:text="@string/price_dp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/editTextItemName" /> + + <TextView + android:id="@+id/textView13" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="60dp" + android:text="@string/amount_dp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/editTextTextItemPrice" /> + + <Button + android:id="@+id/buttonAddnewitem" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="50dp" + android:text="@string/add" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/editTextItemAmount" /> +</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_supplier_edit_item.xml b/app/src/main/res/layout/fragment_supplier_edit_item.xml new file mode 100644 index 0000000000000000000000000000000000000000..ba428082db6b33a68257bc831a06d0b692b20961 --- /dev/null +++ b/app/src/main/res/layout/fragment_supplier_edit_item.xml @@ -0,0 +1,23 @@ +<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" +android:paddingBottom="?attr/actionBarSize" +tools:context=".ui.supplier.SupplierEditItemFragment"> + + +<androidx.recyclerview.widget.RecyclerView + android:id="@+id/myShopitemsRecycler" + android:layout_width="match_parent" + android:layout_height="match_parent" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="0.0"> + +</androidx.recyclerview.widget.RecyclerView> + +</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_supplier_logon.xml b/app/src/main/res/layout/fragment_supplier_logon.xml new file mode 100644 index 0000000000000000000000000000000000000000..f72561c9ab3a1a91b39b2df71d365bfc10bcb8e6 --- /dev/null +++ b/app/src/main/res/layout/fragment_supplier_logon.xml @@ -0,0 +1,43 @@ +<?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.supplier.SupplierLogonFragment"> + + <Button + android:id="@+id/buttonRegister2" + android:layout_width="141dp" + android:layout_height="52dp" + android:layout_marginEnd="20dp" + android:layout_marginBottom="20dp" + android:text="@string/register" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" /> + + <EditText + android:id="@+id/editTextFirstName" + android:layout_width="300dp" + android:layout_height="70dp" + android:hint="@string/company_name" + android:inputType="textPersonName" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.495" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="0.301" /> + + <Button + android:id="@+id/buttonRegister" + android:layout_width="213dp" + android:layout_height="63dp" + android:text="@string/logon" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/editTextFirstName" + app:layout_constraintVertical_bias="0.326" /> + +</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_supplier_orders.xml b/app/src/main/res/layout/fragment_supplier_orders.xml new file mode 100644 index 0000000000000000000000000000000000000000..681772b37077878c8a854f3e70813916ece40402 --- /dev/null +++ b/app/src/main/res/layout/fragment_supplier_orders.xml @@ -0,0 +1,23 @@ +<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" +android:paddingBottom="?attr/actionBarSize" +tools:context=".ui.supplier.SupplierOrdersFragment"> + + +<androidx.recyclerview.widget.RecyclerView + android:id="@+id/mySupplierOrdersRecycler" + android:layout_width="match_parent" + android:layout_height="match_parent" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="0.0"> + +</androidx.recyclerview.widget.RecyclerView> + +</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_supplier_register.xml b/app/src/main/res/layout/fragment_supplier_register.xml new file mode 100644 index 0000000000000000000000000000000000000000..0e6ec52619865087dee56d08a7929a2240044855 --- /dev/null +++ b/app/src/main/res/layout/fragment_supplier_register.xml @@ -0,0 +1,46 @@ +<?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.supplier.SupplierRegisterFragment"> + + <EditText + android:id="@+id/editTextFirstName" + android:layout_width="300dp" + android:layout_height="70dp" + android:hint="@string/company_name" + android:inputType="textPersonName" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.495" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="0.193" /> + + <EditText + android:id="@+id/editTextAddress" + android:layout_width="300dp" + android:layout_height="70dp" + android:hint="@string/address" + android:inputType="textMultiLine" + app:layout_constraintBottom_toTopOf="@+id/buttonRegister" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.495" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/editTextFirstName" + app:layout_constraintVertical_bias="0.302" /> + + <Button + android:id="@+id/buttonRegister" + android:layout_width="213dp" + android:layout_height="63dp" + android:text="@string/register" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="0.594" /> + +</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_supplier_statistics.xml b/app/src/main/res/layout/fragment_supplier_statistics.xml new file mode 100644 index 0000000000000000000000000000000000000000..17bc1aa104d9f9930df5e6789d6681cf3e2c3bdf --- /dev/null +++ b/app/src/main/res/layout/fragment_supplier_statistics.xml @@ -0,0 +1,84 @@ + <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" + android:paddingBottom="?attr/actionBarSize" + tools:context=".ui.supplier.SupplierStatisticsFragment"> + + + <androidx.recyclerview.widget.RecyclerView + android:id="@+id/mySupplierOrdersRecycler" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_marginTop="70dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="0.0"> + + </androidx.recyclerview.widget.RecyclerView> + + <TextView + android:id="@+id/textViewIS" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="16dp" + android:layout_marginTop="8dp" + android:text="@string/items_sold_dp" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/textViewSV" /> + + <TextView + android:id="@+id/textViewSV" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="16dp" + android:layout_marginTop="16dp" + android:text="@string/sales_volume_dp" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/textViewSalesVolume" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:layout_marginTop="16dp" + android:text="TextView" + app:layout_constraintStart_toEndOf="@+id/textViewSV" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/textViewItemsSold" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:layout_marginTop="8dp" + android:text="TextView" + app:layout_constraintStart_toEndOf="@+id/textViewIS" + app:layout_constraintTop_toBottomOf="@+id/textViewSalesVolume" /> + + <TextView + android:id="@+id/textView18" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:layout_marginTop="16dp" + android:text="@string/orders_dp" + app:layout_constraintStart_toEndOf="@+id/textViewSalesVolume" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/textViewOrderAmount" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:layout_marginTop="16dp" + android:text="TextView" + app:layout_constraintStart_toEndOf="@+id/textView18" + app:layout_constraintTop_toTopOf="parent" /> + + </androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/recyclerview_deliverer_orderrow.xml b/app/src/main/res/layout/recyclerview_deliverer_orderrow.xml new file mode 100644 index 0000000000000000000000000000000000000000..36b652a4ad608ed23a246b1ea93b6a2f98b3c834 --- /dev/null +++ b/app/src/main/res/layout/recyclerview_deliverer_orderrow.xml @@ -0,0 +1,103 @@ +<?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="wrap_content"> + + <androidx.cardview.widget.CardView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="5dp" + android:layout_marginTop="5dp" + android:layout_marginStart="5dp" + android:layout_marginEnd="5dp" + app:cardBackgroundColor="?attr/boxColor" + app:cardCornerRadius="20dp" + app:cardElevation="5dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" > + + <androidx.constraintlayout.widget.ConstraintLayout + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <TextView + android:id="@+id/textViewID" + android:layout_width="107dp" + android:layout_height="27dp" + android:layout_marginStart="10dp" + android:text="1" + android:textSize="20sp" + android:textStyle="bold" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/textView7" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/state_dp" + app:layout_constraintStart_toStartOf="@+id/textViewID" + app:layout_constraintTop_toBottomOf="@+id/buttonReady" /> + + <TextView + android:id="@+id/textViewState" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:text="Der aktuelle Status oder so" + android:textStyle="bold" + app:layout_constraintStart_toEndOf="@+id/textView7" + app:layout_constraintTop_toBottomOf="@+id/buttonReady" /> + + <Button + android:id="@+id/buttonReady" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginEnd="8dp" + android:text="@string/ready" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/textView14" + android:layout_width="180dp" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:text="Gumkmistraße 10" + app:layout_constraintStart_toEndOf="@+id/textView15" + app:layout_constraintTop_toBottomOf="@+id/textViewState" /> + + <TextView + android:id="@+id/textView15" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/supplieraddress_dp" + app:layout_constraintStart_toStartOf="@+id/textView7" + app:layout_constraintTop_toBottomOf="@+id/textView7" /> + + <TextView + android:id="@+id/textView16" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/costumerAddress" + app:layout_constraintStart_toStartOf="@+id/textView15" + app:layout_constraintTop_toBottomOf="@+id/textView14" /> + + <TextView + android:id="@+id/textView17" + android:layout_width="180dp" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:text="Adresse baum ioch komme" + app:layout_constraintStart_toEndOf="@+id/textView16" + app:layout_constraintTop_toBottomOf="@+id/textView14" /> + + + </androidx.constraintlayout.widget.ConstraintLayout> + </androidx.cardview.widget.CardView> + +</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/recyclerview_edititemrow.xml b/app/src/main/res/layout/recyclerview_edititemrow.xml new file mode 100644 index 0000000000000000000000000000000000000000..12a8112eea58d98d0e83a18e87c2fa5ceb3769ef --- /dev/null +++ b/app/src/main/res/layout/recyclerview_edititemrow.xml @@ -0,0 +1,107 @@ +<?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="wrap_content"> + + <androidx.cardview.widget.CardView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="5dp" + android:layout_marginTop="5dp" + android:layout_marginStart="5dp" + android:layout_marginEnd="5dp" + app:cardBackgroundColor="?attr/boxColor" + app:cardCornerRadius="20dp" + app:cardElevation="5dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" > + + <androidx.constraintlayout.widget.ConstraintLayout + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <TextView + android:id="@+id/textViewName" + android:layout_width="155dp" + android:layout_height="34dp" + android:layout_marginStart="10dp" + android:text="Name" + android:textSize="20sp" + android:textStyle="bold" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/textViewAmountNumber" + android:layout_width="wrap_content" + android:layout_height="25dp" + app:layout_constraintStart_toEndOf="@+id/textViewAmount" + app:layout_constraintTop_toTopOf="@+id/textViewAmount" /> + + <TextView + android:id="@+id/textViewAmount" + android:layout_width="wrap_content" + android:layout_height="25dp" + android:text="@string/restamount_dp" + app:layout_constraintStart_toEndOf="@+id/editTextPrice" + app:layout_constraintTop_toTopOf="@+id/textView8" /> + + <Button + android:id="@+id/buttonEdit" + android:layout_width="93dp" + android:layout_height="41dp" + android:layout_marginEnd="16dp" + android:text="@string/edit" + android:textSize="14sp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toStartOf="@+id/deleteButton2" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/textView8" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/price_dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="@+id/textViewName" + app:layout_constraintTop_toBottomOf="@+id/textViewName" /> + + <EditText + android:id="@+id/editTextPrice" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:inputType="number" + android:text="1" + android:textSize="16sp" + app:layout_constraintStart_toEndOf="@+id/textView8" + app:layout_constraintTop_toBottomOf="@+id/textViewName" /> + + <EditText + android:id="@+id/editTextAmount" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:inputType="number" + android:text="1" + android:textSize="16sp" + app:layout_constraintStart_toEndOf="@+id/textViewAmount" + app:layout_constraintTop_toTopOf="@+id/editTextPrice" /> + + <ImageButton + android:id="@+id/deleteButton2" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginEnd="16dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:srcCompat="@android:drawable/ic_menu_delete" /> + + + </androidx.constraintlayout.widget.ConstraintLayout> + </androidx.cardview.widget.CardView> + +</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/recyclerview_orders_partrows.xml b/app/src/main/res/layout/recyclerview_orders_partrows.xml new file mode 100644 index 0000000000000000000000000000000000000000..51d8bd5be7a5e7dba6002fcbcbdeac37af1e9704 --- /dev/null +++ b/app/src/main/res/layout/recyclerview_orders_partrows.xml @@ -0,0 +1,95 @@ +<?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="wrap_content"> + + <androidx.cardview.widget.CardView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="5dp" + android:layout_marginTop="5dp" + android:layout_marginStart="5dp" + android:layout_marginEnd="5dp" + + app:cardCornerRadius="20dp" + app:cardElevation="5dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" > + + <androidx.constraintlayout.widget.ConstraintLayout + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <TextView + android:id="@+id/textViewName" + android:layout_width="80dp" + android:layout_height="19dp" + android:layout_marginStart="10dp" + android:textSize="14sp" + android:textStyle="bold" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/textViewBuyAmount" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:text="@string/buyamount_dp" + app:layout_constraintStart_toEndOf="@+id/textViewName" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/textView6" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:text="@string/price_dp" + app:layout_constraintStart_toEndOf="@+id/textView" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/textViewPrice" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:text="10" + app:layout_constraintStart_toEndOf="@+id/textView6" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/textView10" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="16dp" + android:text="@string/sum_dp" + app:layout_constraintStart_toEndOf="@+id/textViewPrice" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/textViewSum" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:text="14.5" + app:layout_constraintStart_toEndOf="@+id/textView10" + app:layout_constraintTop_toTopOf="@+id/textView10" /> + + <TextView + android:id="@+id/textView" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:text="12" + app:layout_constraintStart_toEndOf="@+id/textViewBuyAmount" + app:layout_constraintTop_toTopOf="parent" /> + + + </androidx.constraintlayout.widget.ConstraintLayout> + </androidx.cardview.widget.CardView> + +</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/recyclerview_ordersrow.xml b/app/src/main/res/layout/recyclerview_ordersrow.xml new file mode 100644 index 0000000000000000000000000000000000000000..6c4a6ca25c5afb1ad0793d247784f796c9470e33 --- /dev/null +++ b/app/src/main/res/layout/recyclerview_ordersrow.xml @@ -0,0 +1,112 @@ +<?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="wrap_content"> + + <androidx.cardview.widget.CardView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="5dp" + android:layout_marginTop="5dp" + android:layout_marginStart="5dp" + android:layout_marginEnd="5dp" + app:cardBackgroundColor="?attr/boxColor" + app:cardCornerRadius="20dp" + app:cardElevation="5dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" > + + <androidx.constraintlayout.widget.ConstraintLayout + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <TextView + android:id="@+id/textViewID" + android:layout_width="107dp" + android:layout_height="27dp" + android:layout_marginStart="10dp" + android:text="1" + android:textSize="20sp" + android:textStyle="bold" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/textViewSupplier" + android:layout_width="wrap_content" + android:layout_height="25dp" + android:text="@string/supplier_dp" + app:layout_constraintStart_toEndOf="@+id/textViewID" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/textViewSupplierName" + android:layout_width="wrap_content" + android:layout_height="25dp" + android:layout_marginStart="8dp" + android:text="Rewe" + app:layout_constraintStart_toEndOf="@+id/textViewSupplier" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/textViewDelivery" + android:layout_width="wrap_content" + android:layout_height="25dp" + android:layout_marginStart="8dp" + android:text="delivery/pickup" + app:layout_constraintStart_toEndOf="@+id/textViewSupplierName" + app:layout_constraintTop_toTopOf="@+id/textViewSupplierName" /> + + <androidx.recyclerview.widget.RecyclerView + android:id="@+id/recyclerViewOrders" + android:layout_width="match_parent" + android:layout_height="match_parent" + app:layout_constraintTop_toBottomOf="@+id/textView7" /> + + <TextView + android:id="@+id/textView7" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/state_dp" + app:layout_constraintStart_toStartOf="@+id/textViewID" + app:layout_constraintTop_toBottomOf="@+id/textViewID" /> + + <TextView + android:id="@+id/textViewState" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:text="Der aktuelle Status oder so" + android:textStyle="bold" + app:layout_constraintStart_toEndOf="@+id/textView7" + app:layout_constraintTop_toBottomOf="@+id/textViewID" /> + + <TextView + android:id="@+id/textViewTotalCost" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginEnd="16dp" + android:text="13" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toBottomOf="@+id/recyclerViewOrders" + app:layout_constraintVertical_bias="0.0" /> + + <TextView + android:id="@+id/textView11" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginEnd="24dp" + android:text="@string/total" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toStartOf="@+id/textViewTotalCost" /> + + + </androidx.constraintlayout.widget.ConstraintLayout> + </androidx.cardview.widget.CardView> + +</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/recyclerview_shoppingcartrow.xml b/app/src/main/res/layout/recyclerview_shoppingcartrow.xml new file mode 100644 index 0000000000000000000000000000000000000000..8db922711e47b3555b1e1d34dbf869c964686b8e --- /dev/null +++ b/app/src/main/res/layout/recyclerview_shoppingcartrow.xml @@ -0,0 +1,135 @@ +<?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="wrap_content"> + + <androidx.cardview.widget.CardView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="5dp" + android:layout_marginTop="5dp" + android:layout_marginStart="5dp" + android:layout_marginEnd="5dp" + app:cardBackgroundColor="?attr/boxColor" + app:cardCornerRadius="20dp" + app:cardElevation="5dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" > + + <androidx.constraintlayout.widget.ConstraintLayout + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <TextView + android:id="@+id/textViewName" + android:layout_width="157dp" + android:layout_height="58dp" + android:layout_marginStart="10dp" + android:textSize="20sp" + android:textStyle="bold" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/textViewAmountNumber" + android:layout_width="wrap_content" + android:layout_height="25dp" + android:text="10" + app:layout_constraintStart_toEndOf="@+id/textViewAmount" + app:layout_constraintTop_toTopOf="@+id/textViewAmount" /> + + <TextView + android:id="@+id/textViewAmount" + android:layout_width="wrap_content" + android:layout_height="25dp" + android:text="@string/restamount_dp" + app:layout_constraintStart_toEndOf="@+id/textViewName" + app:layout_constraintTop_toBottomOf="@+id/textViewSupplier" /> + + <TextView + android:id="@+id/textViewSupplier" + android:layout_width="wrap_content" + android:layout_height="25dp" + android:text="@string/supplier_dp" + app:layout_constraintStart_toEndOf="@+id/textViewName" + app:layout_constraintTop_toTopOf="parent" /> + + <EditText + android:id="@+id/editText" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:inputType="number" + android:text="1" + android:textSize="14sp" + app:layout_constraintBottom_toBottomOf="@+id/textViewBuyAmount" + app:layout_constraintStart_toEndOf="@+id/textViewBuyAmount" + app:layout_constraintTop_toTopOf="@+id/textViewBuyAmount" /> + + <TextView + android:id="@+id/textViewSupplierName" + android:layout_width="wrap_content" + android:layout_height="25dp" + android:text="Rewe" + app:layout_constraintStart_toEndOf="@+id/textViewSupplier" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/textViewBuyAmount" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/buyamount_dp" + app:layout_constraintStart_toEndOf="@+id/textViewName" + app:layout_constraintTop_toBottomOf="@+id/textViewAmount" /> + + <ImageButton + android:id="@+id/deleteButton" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginEnd="28dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="0.13999999" + app:srcCompat="@android:drawable/ic_menu_delete" /> + + <TextView + android:id="@+id/textView6" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/price_dp" + app:layout_constraintStart_toStartOf="@+id/textViewName" + app:layout_constraintTop_toBottomOf="@+id/textViewName" /> + + <TextView + android:id="@+id/textViewPrice" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="10" + app:layout_constraintStart_toEndOf="@+id/textView6" + app:layout_constraintTop_toBottomOf="@+id/textViewName" /> + + <TextView + android:id="@+id/textView10" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/sum_dp" + app:layout_constraintStart_toEndOf="@+id/editText" + app:layout_constraintTop_toBottomOf="@+id/textViewAmount" /> + + <TextView + android:id="@+id/textViewSum" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="14.5" + app:layout_constraintStart_toEndOf="@+id/textView10" + app:layout_constraintTop_toTopOf="@+id/textView10" /> + + + </androidx.constraintlayout.widget.ConstraintLayout> + </androidx.cardview.widget.CardView> + +</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/recyclerview_shoprow.xml b/app/src/main/res/layout/recyclerview_shoprow.xml new file mode 100644 index 0000000000000000000000000000000000000000..a2421acb02d7c8432396de8a4e8d56154575cf89 --- /dev/null +++ b/app/src/main/res/layout/recyclerview_shoprow.xml @@ -0,0 +1,132 @@ +<?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="wrap_content"> + + <androidx.cardview.widget.CardView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="5dp" + android:layout_marginTop="5dp" + android:layout_marginStart="5dp" + android:layout_marginEnd="5dp" + app:cardBackgroundColor="?attr/boxColor" + app:cardCornerRadius="20dp" + app:cardElevation="5dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" > + + <androidx.constraintlayout.widget.ConstraintLayout + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <TextView + android:id="@+id/textViewName" + android:layout_width="157dp" + android:layout_height="58dp" + android:layout_marginStart="10dp" + android:textSize="20sp" + android:textStyle="bold" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/textViewAmountNumber" + android:layout_width="wrap_content" + android:layout_height="25dp" + android:layout_marginStart="8dp" + app:layout_constraintStart_toEndOf="@+id/textViewAmount" + app:layout_constraintTop_toTopOf="@+id/textViewAmount" /> + + <TextView + android:id="@+id/textViewAmount" + android:layout_width="wrap_content" + android:layout_height="25dp" + android:text="@string/restamount_dp" + app:layout_constraintStart_toEndOf="@+id/textViewName" + app:layout_constraintTop_toBottomOf="@+id/textViewSupplier" /> + + <TextView + android:id="@+id/textViewSupplier" + android:layout_width="wrap_content" + android:layout_height="25dp" + android:text="@string/supplier_dp" + app:layout_constraintStart_toEndOf="@+id/textViewName" + app:layout_constraintTop_toTopOf="parent" /> + + <CheckBox + android:id="@+id/checkBox1" + style="?android:attr/starStyle" + android:layout_width="33dp" + android:layout_height="28dp" + android:visibility="visible" + app:layout_constraintBottom_toTopOf="@+id/buttonBuy" + app:layout_constraintEnd_toEndOf="@+id/buttonBuy" + app:layout_constraintHorizontal_bias="0.533" + app:layout_constraintStart_toStartOf="@+id/buttonBuy" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="0.5" /> + + <EditText + android:id="@+id/editText" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:inputType="number" + android:text="1" + android:textSize="14sp" + app:layout_constraintBottom_toBottomOf="@+id/textViewBuyAmount" + app:layout_constraintStart_toEndOf="@+id/textViewBuyAmount" + app:layout_constraintTop_toTopOf="@+id/textViewBuyAmount" /> + + <TextView + android:id="@+id/textViewSupplierName" + android:layout_width="wrap_content" + android:layout_height="25dp" + android:layout_marginStart="8dp" + android:text="Rewe" + app:layout_constraintStart_toEndOf="@+id/textViewSupplier" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/textViewBuyAmount" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/buyamount_dp" + app:layout_constraintStart_toEndOf="@+id/textViewName" + app:layout_constraintTop_toBottomOf="@+id/textViewAmount" /> + + <Button + android:id="@+id/buttonBuy" + android:layout_width="93dp" + android:layout_height="41dp" + android:layout_marginEnd="5dp" + android:text="@string/add" + android:textSize="8sp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" /> + + <TextView + android:id="@+id/textView8" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/price_dp" + app:layout_constraintStart_toStartOf="@+id/textViewName" + app:layout_constraintTop_toBottomOf="@+id/textViewName" /> + + <TextView + android:id="@+id/textViewPrice" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="10" + app:layout_constraintStart_toEndOf="@+id/textView8" + app:layout_constraintTop_toBottomOf="@+id/textViewName" /> + + + </androidx.constraintlayout.widget.ConstraintLayout> + </androidx.cardview.widget.CardView> + +</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/recyclerview_statisticrow.xml b/app/src/main/res/layout/recyclerview_statisticrow.xml new file mode 100644 index 0000000000000000000000000000000000000000..d23deaddaa6d21c8711d63b6f83f006b7def6cd6 --- /dev/null +++ b/app/src/main/res/layout/recyclerview_statisticrow.xml @@ -0,0 +1,95 @@ +<?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="wrap_content"> + + <androidx.cardview.widget.CardView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="5dp" + android:layout_marginTop="5dp" + android:layout_marginStart="5dp" + android:layout_marginEnd="5dp" + + app:cardCornerRadius="20dp" + app:cardElevation="5dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" > + + <androidx.constraintlayout.widget.ConstraintLayout + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <TextView + android:id="@+id/textViewName" + android:layout_width="105dp" + android:layout_height="19dp" + android:layout_marginStart="10dp" + android:textSize="14sp" + android:textStyle="bold" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/textViewBuyAmount" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:text="@string/sold_units_dp" + app:layout_constraintStart_toEndOf="@+id/textViewName" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/textView6" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:text="@string/price_dp" + app:layout_constraintStart_toEndOf="@+id/textViewSoldUnits" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/textViewPrice" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:text="10" + app:layout_constraintStart_toEndOf="@+id/textView6" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/textView10" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="16dp" + android:text="@string/sum_dp" + app:layout_constraintStart_toEndOf="@+id/textViewPrice" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/textViewSum" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:text="14.5" + app:layout_constraintStart_toEndOf="@+id/textView10" + app:layout_constraintTop_toTopOf="@+id/textView10" /> + + <TextView + android:id="@+id/textViewSoldUnits" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:text="12" + app:layout_constraintStart_toEndOf="@+id/textViewBuyAmount" + app:layout_constraintTop_toTopOf="parent" /> + + + </androidx.constraintlayout.widget.ConstraintLayout> + </androidx.cardview.widget.CardView> + +</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/recyclerview_supplierordersrow.xml b/app/src/main/res/layout/recyclerview_supplierordersrow.xml new file mode 100644 index 0000000000000000000000000000000000000000..f5d077ee9116fea3bf3c7307346241bee631dcda --- /dev/null +++ b/app/src/main/res/layout/recyclerview_supplierordersrow.xml @@ -0,0 +1,103 @@ +<?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="wrap_content"> + + <androidx.cardview.widget.CardView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="5dp" + android:layout_marginTop="5dp" + android:layout_marginStart="5dp" + android:layout_marginEnd="5dp" + app:cardBackgroundColor="?attr/boxColor" + app:cardCornerRadius="20dp" + app:cardElevation="5dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" > + + <androidx.constraintlayout.widget.ConstraintLayout + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <TextView + android:id="@+id/textViewID" + android:layout_width="107dp" + android:layout_height="27dp" + android:layout_marginStart="10dp" + android:text="1" + android:textSize="20sp" + android:textStyle="bold" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/textViewDelivery" + android:layout_width="wrap_content" + android:layout_height="25dp" + android:layout_marginStart="16dp" + android:text="delivery/pickup" + app:layout_constraintStart_toEndOf="@+id/textViewID" /> + + <androidx.recyclerview.widget.RecyclerView + android:id="@+id/recyclerViewOrders" + android:layout_width="match_parent" + android:layout_height="match_parent" + app:layout_constraintTop_toBottomOf="@+id/textView7" /> + + <TextView + android:id="@+id/textView7" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/state_dp" + app:layout_constraintStart_toStartOf="@+id/textViewID" + app:layout_constraintTop_toBottomOf="@+id/textViewID" /> + + <TextView + android:id="@+id/textViewState" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:text="Der aktuelle Status oder so" + android:textStyle="bold" + app:layout_constraintStart_toEndOf="@+id/textView7" + app:layout_constraintTop_toBottomOf="@+id/textViewID" /> + + <TextView + android:id="@+id/textViewTotalCost" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginEnd="16dp" + android:text="13" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toBottomOf="@+id/recyclerViewOrders" + app:layout_constraintVertical_bias="0.0" /> + + <TextView + android:id="@+id/textView11" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginEnd="24dp" + android:text="@string/total" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toStartOf="@+id/textViewTotalCost" /> + + <Button + android:id="@+id/buttonReady" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginEnd="8dp" + android:text="@string/ready" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + + </androidx.constraintlayout.widget.ConstraintLayout> + </androidx.cardview.widget.CardView> + +</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file diff --git a/app/src/main/res/menu/bottom_nav_menu_customer.xml b/app/src/main/res/menu/bottom_nav_menu_customer.xml new file mode 100644 index 0000000000000000000000000000000000000000..a8cd9f925d3a2c5506849638746a555aac233bee --- /dev/null +++ b/app/src/main/res/menu/bottom_nav_menu_customer.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<menu xmlns:android="http://schemas.android.com/apk/res/android"> + + <item + android:id="@+id/navigation_shop" + android:title="@string/shop" /> + + <item + android:id="@+id/navigation_shopping_cart" + android:title="@string/shopping_cart" /> + + <item + android:id="@+id/navigation_orders" + android:title="@string/orders" /> + +</menu> \ No newline at end of file diff --git a/app/src/main/res/menu/bottom_nav_menu_deliverer.xml b/app/src/main/res/menu/bottom_nav_menu_deliverer.xml new file mode 100644 index 0000000000000000000000000000000000000000..a251b65ebecf1f1f3780146d1cd66ff582cb8c9b --- /dev/null +++ b/app/src/main/res/menu/bottom_nav_menu_deliverer.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<menu xmlns:android="http://schemas.android.com/apk/res/android"> + + <item + android:id="@+id/navigation_open_orders" + android:title="@string/open_orders" /> + + <item + android:id="@+id/navigation_actice_orders" + android:title="@string/active_orders" /> + + <item + android:id="@+id/navigation_closed_orders" + android:title="@string/closed_orders" /> + +</menu> \ No newline at end of file diff --git a/app/src/main/res/menu/bottom_nav_menu_supplier.xml b/app/src/main/res/menu/bottom_nav_menu_supplier.xml new file mode 100644 index 0000000000000000000000000000000000000000..0a59a2d47164515b9a293261c97ecfd173fd139b --- /dev/null +++ b/app/src/main/res/menu/bottom_nav_menu_supplier.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<menu xmlns:android="http://schemas.android.com/apk/res/android"> + + <item + android:id="@+id/navigation_add_item" + android:title="@string/add_Item" /> + + <item + android:id="@+id/navigation_edit_item" + android:title="@string/edit_Item" /> + + <item + android:id="@+id/navigation_statistics" + android:title="@string/statistics" /> + <item + android:id="@+id/navigation_ordersSupplier" + android:title="@string/orders" /> + +</menu> \ No newline at end of file diff --git a/app/src/main/res/navigation/mobile_navigation.xml b/app/src/main/res/navigation/mobile_navigation.xml index 907b3632f2a1890dafc14505c679468340b68611..63cff446ad7b2ad5f1800cfd0559d8aacc761237 100644 --- a/app/src/main/res/navigation/mobile_navigation.xml +++ b/app/src/main/res/navigation/mobile_navigation.xml @@ -3,7 +3,7 @@ xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/mobile_navigation" - app:startDestination="@+id/navigation_home"> + app:startDestination="@id/decideFragment"> <fragment android:id="@+id/navigation_home" @@ -22,4 +22,9 @@ android:name="com.example.mampfmobil.ui.notifications.NotificationsFragment" android:label="@string/title_notifications" tools:layout="@layout/fragment_notifications" /> + <fragment + android:id="@+id/decideFragment" + android:name="com.example.mampfmobil.ui.DecideFragment" + android:label="fragment_decide" + tools:layout="@layout/fragment_decide" /> </navigation> \ No newline at end of file diff --git a/app/src/main/res/navigation/mobile_navigation_cus.xml b/app/src/main/res/navigation/mobile_navigation_cus.xml new file mode 100644 index 0000000000000000000000000000000000000000..51c3fe1707e21ea2218c102f1922f6f11e2b277b --- /dev/null +++ b/app/src/main/res/navigation/mobile_navigation_cus.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<navigation 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:id="@+id/mobile_navigation_cus" + app:startDestination="@+id/navigation_shop" + app:defaultNavHost="true"> + + <fragment + android:id="@+id/navigation_shop" + android:name="com.example.mampfmobil.ui.customer.CustomerShopFragment" + android:label="@string/shop" + tools:layout="@layout/fragment_customer_shop" /> + + <fragment + android:id="@+id/navigation_shopping_cart" + android:name="com.example.mampfmobil.ui.customer.CustomerShoppingCartFragment" + android:label="@string/shopping_cart" + tools:layout="@layout/fragment_customer_shopping_cart" /> + + <fragment + android:id="@+id/navigation_orders" + android:name="com.example.mampfmobil.ui.customer.CustomerOrdersFragment" + android:label="@string/orders" + tools:layout="@layout/fragment_customer_orders" /> +</navigation> \ No newline at end of file diff --git a/app/src/main/res/navigation/mobile_navigation_del.xml b/app/src/main/res/navigation/mobile_navigation_del.xml new file mode 100644 index 0000000000000000000000000000000000000000..18692b6b965e2743742e3091b8ab7fe64e81cc20 --- /dev/null +++ b/app/src/main/res/navigation/mobile_navigation_del.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<navigation 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:id="@+id/mobile_navigation_del" + app:startDestination="@+id/navigation_open_orders" + app:defaultNavHost="true"> + + <fragment + android:id="@+id/navigation_open_orders" + android:name="com.example.mampfmobil.ui.deliverer.DelivererOpenOrdersFragment" + android:label="@string/open_orders" + tools:layout="@layout/fragment_deliverer_open_orders" /> + + <fragment + android:id="@+id/navigation_actice_orders" + android:name="com.example.mampfmobil.ui.deliverer.DelivererActiveOrdersFragment" + android:label="@string/active_orders" + tools:layout="@layout/fragment_deliverer_active_orders" /> + + <fragment + android:id="@+id/navigation_closed_orders" + android:name="com.example.mampfmobil.ui.deliverer.DelivererClosedOrdersFragment" + android:label="@string/closed_orders" + tools:layout="@layout/fragment_deliverer_closed_orders" /> +</navigation> \ No newline at end of file diff --git a/app/src/main/res/navigation/mobile_navigation_sup.xml b/app/src/main/res/navigation/mobile_navigation_sup.xml new file mode 100644 index 0000000000000000000000000000000000000000..3a6698792c19552a35c6e59362b7c6f659fdc9da --- /dev/null +++ b/app/src/main/res/navigation/mobile_navigation_sup.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="utf-8"?> +<navigation 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:id="@+id/mobile_navigation_sup" + app:startDestination="@+id/navigation_edit_item" + app:defaultNavHost="true"> + + <fragment + android:id="@+id/navigation_add_item" + android:name="com.example.mampfmobil.ui.supplier.SupplierAddItemFragment" + android:label="@string/add_Item" + tools:layout="@layout/fragment_supplier_add_item" /> + + <fragment + android:id="@+id/navigation_edit_item" + android:name="com.example.mampfmobil.ui.supplier.SupplierEditItemFragment" + android:label="@string/edit_Item" + tools:layout="@layout/fragment_supplier_edit_item" /> + + <fragment + android:id="@+id/navigation_statistics" + android:name="com.example.mampfmobil.ui.supplier.SupplierStatisticsFragment" + android:label="@string/statistics" + tools:layout="@layout/fragment_supplier_statistics" /> + + <fragment + android:id="@+id/navigation_ordersSupplier" + android:name="com.example.mampfmobil.ui.supplier.SupplierOrdersFragment" + android:label="Orders" + tools:layout="@layout/fragment_supplier_orders" /> + +</navigation> \ No newline at end of file diff --git a/app/src/main/res/values-de-rDE/strings.xml b/app/src/main/res/values-de-rDE/strings.xml new file mode 100644 index 0000000000000000000000000000000000000000..150d37c278078f395edb4814e23f5c2f81a5875e --- /dev/null +++ b/app/src/main/res/values-de-rDE/strings.xml @@ -0,0 +1,69 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <string name="app_name">Mampf Mobil</string> + <string name="title_home">Zuhause</string> + <string name="title_dashboard">Dash</string> + <string name="title_notifications">Nachrichten</string> + <string name="title_customer">Kunde</string> + <string name="title_supplier">Lieferant</string> + <string name="title_deliverer">Zusteller</string> + <string name="title_activity_customer">CustomerActivity</string> + <string name="shopping_cart">Einkaufswagen</string> + <string name="orders">Bestellungen</string> + <string name="shop">Laden</string> + <string name="statistics">Statistiken</string> + <string name="add_Item">Hinzufügen"</string> + <string name="edit_Item">Übersicht/Bearbeiten"</string> + <string name="open_orders">offene Bestellungen</string> + <string name="active_orders">aktive Bestellungen</string> + <string name="closed_orders">Geschlossene Bestellungen</string> + <string name="first_name">Vorname</string> + <string name="last_name">Nachname</string> + <string name="address">Adresse</string> + <string name="register">Registrieren</string> + <string name="company_name">Firmenname</string> + <string name="logon">einloggen</string> + <string name="noEmptyIn">Bitte keine leere eingaben</string> + <string name="personNotFound">Person nicht gefunden! Bitte registrieren sie sich zuerst!</string> + <string name="supplierNotFound">Lieferant nicht gefunden! Bitte registrieren sie sich zuerst!</string> + <string name="personFound">Person existiert schon! Bitte loggen sie sich ein!</string> + <string name="supplierFound">Zusteller existiert schon! Bitte loggen sie sich ein!</string> + <string name="add">Hinzufügen</string> + <string name="restamount_dp">Restmenge: </string> + <string name="restamount">Restmenge</string> + <string name="supplier_dp">Lieferant: </string> + <string name="buyamount_dp">Kaufmenge:</string> + <string name="price_dp">Preis: </string> + <string name="state_dp">"Status: "</string> + <string name="readyForTransport">Bereit für Transport</string> + <string name="readyForTransportDelivererFound">Bereit für Transport/Zusteller gefunden</string> + <string name="delivered">Zugestellt</string> + <string name="inTransportation">Im Transport</string> + <string name="readyForPickup">Bereit zur Abholung</string> + <string name="delivery">Lieferung</string> + <string name="pickup">Abholung</string> + <string name="picked">Abgeholt</string> + <string name="costumerAddress">Kundenadresse:</string> + <string name="buy">Kaufen</string> + <string name="address_dp">Adresse:</string> + <string name="storepickup">Abholung</string> + <string name="amount">Menge</string> + <string name="ready">Bereit</string> + <string name="sum_dp">Ges:</string> + <string name="reserve">reservieren</string> + <string name="ordered">bestellt</string> + <string name="price">Preis</string> + <string name="itemname">Itemname:</string> + <string name="amount_dp">Menge:</string> + <string name="items_sold_dp">Teile verkauft:</string> + <string name="sales_volume_dp">Umsatz:</string> + <string name="orders_dp">Bestellungen:</string> + <string name="supplieraddress_dp">Lieferantenadresse:</string> + <string name="edit">edit</string> + <string name="total">Gesamt</string> + <string name="sold_units_dp">Verkaufte Items:</string> + <string name="noemptyinput">Keine leere eingaben</string> + <string name="item_already_exists">Item existiert bereits</string> + <string name="added_to_shopping_cart">Zum Einkaufswagen hinzugefügt</string> + <string name="name">name</string> +</resources> \ No newline at end of file diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml index 8abf818a2f1a1c6507dc6c611b49b43ed3583fb9..1553a5c4b7728498c70c8a4b72b041cefe79e99d 100644 --- a/app/src/main/res/values-night/themes.xml +++ b/app/src/main/res/values-night/themes.xml @@ -12,5 +12,6 @@ <!-- Status bar color. --> <item name="android:statusBarColor">?attr/colorPrimaryVariant</item> <!-- Customize your theme here. --> + <item name="boxColor">@color/dark_purple</item> </style> </resources> \ No newline at end of file diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml new file mode 100644 index 0000000000000000000000000000000000000000..ad204f89578800608bb2e382215b8b06e6130598 --- /dev/null +++ b/app/src/main/res/values/attrs.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <attr name="boxColor" format="color" /> +</resources> \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index f8c6127d327620c93d2b2d00342a68e97b98a48d..546bdcd7f839b2c426c8e464cf8d7dc3791fa46f 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -7,4 +7,8 @@ <color name="teal_700">#FF018786</color> <color name="black">#FF000000</color> <color name="white">#FFFFFFFF</color> + <color name="dark_grey">#5A5A5A</color> + <color name="light_grey">#D3D3D3</color> + <color name="light_purple">#D8BFD8</color> + <color name="dark_purple">#301934</color> </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 879129796c4c30fe3f5e1993e2f7230b58e8f1c0..082d0ec0292cd03fb1a266562ead30ab23a84a82 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -3,4 +3,66 @@ <string name="title_home">Home</string> <string name="title_dashboard">Dashboard</string> <string name="title_notifications">Notifications</string> + <string name="title_activity_customer">CustomerActivity</string> + <string name="title_customer">Customer</string> + <string name="title_supplier">Supplier</string> + <string name="title_deliverer">Deliverer</string> + <string name="shopping_cart">Shopping Cart</string> + <string name="orders">Orders</string> + <string name="shop">Shop</string> + <string name="statistics">Statistics</string> + <string name="add_Item">Add Item</string> + <string name="edit_Item">Overview/Edit</string> + <string name="open_orders">Open Orders</string> + <string name="active_orders">Active Orders</string> + <string name="closed_orders">Closed Orders</string> + <string name="first_name">first name</string> + <string name="last_name">last name</string> + <string name="address">address</string> + <string name="register">register</string> + <string name="company_name">company name</string> + <string name="logon">login</string> + <string name="noEmptyIn">Please no empty inputs</string> + <string name="personNotFound">Person not found! Please register first!</string> + <string name="supplierNotFound">Supplier not found! Please register first!</string> + <string name="personFound">Person already exist! Please login!</string> + <string name="supplierFound">Person not found! Please login!</string> + <string name="add">add</string> + <string name="restamount_dp">Restamount: </string> + <string name="restamount">Restamount</string> + <string name="supplier_dp">Supplier: </string> + <string name="buyamount_dp">Buyamount:</string> + <string name="price_dp">Price: </string> + <string name="state_dp">State: </string> + <string name="readyForTransport">ready for transportation</string> + <string name="readyForTransportDelivererFound">ready for transportation/deliverer found</string> + <string name="delivered">delivered</string> + <string name="inTransportation">In transportation</string> + <string name="readyForPickup">ready for pickup</string> + <string name="delivery">delivery</string> + <string name="pickup">pickup</string> + <string name="picked">picked</string> + <string name="costumerAddress">Costumeraddress:</string> + <string name="buy">buy</string> + <string name="address_dp">Address:</string> + <string name="storepickup">StorePickup</string> + <string name="price">Price</string> + <string name="amount">Amount</string> + <string name="itemname">Itemname:</string> + <string name="amount_dp">Amount:</string> + <string name="items_sold_dp">Items sold:</string> + <string name="sales_volume_dp">Sales volume:</string> + <string name="orders_dp">Orders:</string> + <string name="ready">Ready</string> + <string name="supplieraddress_dp">Supplieraddress:</string> + <string name="edit">EDIT</string> + <string name="sum_dp">Sum:</string> + <string name="total">Total</string> + <string name="sold_units_dp">Sold Units:</string> + <string name="reserve">reserve</string> + <string name="ordered">ordered</string> + <string name="noemptyinput">noEmptyInput</string> + <string name="item_already_exists">Item already exists</string> + <string name="added_to_shopping_cart">Added to Shopping Cart</string> + <string name="name">Name</string> </resources> \ No newline at end of file diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index e6d0eed14c71f7ed6149c0a30780f1e7c7f582a4..5cc402a11792bb9c4e291d87c8b024cfd76b5b8a 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -5,6 +5,7 @@ <item name="colorPrimary">@color/purple_500</item> <item name="colorPrimaryVariant">@color/purple_700</item> <item name="colorOnPrimary">@color/white</item> + <!-- Secondary brand color. --> <item name="colorSecondary">@color/teal_200</item> <item name="colorSecondaryVariant">@color/teal_700</item> @@ -12,5 +13,7 @@ <!-- Status bar color. --> <item name="android:statusBarColor">?attr/colorPrimaryVariant</item> <!-- Customize your theme here. --> + <item name="boxColor">@color/light_grey</item> + </style> </resources> \ No newline at end of file