Skip to content
Snippets Groups Projects
Commit 74943f7f authored by fheyming's avatar fheyming
Browse files

Added Dummys

parent bb1eba79
No related branches found
No related tags found
1 merge request!1Mal aufn Master megren
......@@ -16,11 +16,11 @@ public class MainActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
MampfMobil meinMampf = new MampfMobil();
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);
......
......@@ -30,6 +30,27 @@ public class Bestellung {
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 void addBestellungsteil(BestellungsTeil bt){
Boolean notFound = true;
......
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;
......@@ -21,20 +23,20 @@ public class MampfMobil {
public static Vector<Supplier> suppliers;
public static Supplier currentSupplier;
Context context;
public static boolean isInitialized = false;
public MampfMobil(){
public MampfMobil(Context context){
this.context = context;
if(!isInitialized) {
customers = new Vector<>();
deliverers = new Vector<>();
suppliers = new Vector<>();
//create Dummys!!!
customers.add(new Customer("", "", ""));
deliverers.add(new Deliverer("", "", ""));
suppliers.add(new Supplier("", ""));
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"));
......@@ -51,14 +53,58 @@ public class MampfMobil {
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();
temp.addBestellungsteil(new BestellungsTeil(suppliers.get(1).shopItems.get(0).item, 5));
temp.addBestellungsteil(new BestellungsTeil(suppliers.get(2).shopItems.get(1).item, 10));
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 temp2 = new Bestellung();
temp.addBestellungsteil(new BestellungsTeil(suppliers.get(1).shopItems.get(1).item, 7));
temp.addBestellungsteil(new BestellungsTeil(suppliers.get(2).shopItems.get(0).item, 14));
customers.get(1).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;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment