diff --git a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/AndroidManifest.xml b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/AndroidManifest.xml
index 7fd9929..83ac49f 100644
--- a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/AndroidManifest.xml
+++ b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/AndroidManifest.xml
@@ -51,6 +51,7 @@
+
\ No newline at end of file
diff --git a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/AddItemActivity.java b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/AddItemActivity.java
new file mode 100644
index 0000000..2e92354
--- /dev/null
+++ b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/AddItemActivity.java
@@ -0,0 +1,134 @@
+package gr.auth.databases.flavours.activities;
+
+import android.annotation.SuppressLint;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.KeyEvent;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.inputmethod.EditorInfo;
+import android.widget.EditText;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import java.util.ArrayList;
+
+import androidx.appcompat.app.ActionBar;
+import androidx.appcompat.widget.AppCompatButton;
+import androidx.appcompat.widget.AppCompatImageButton;
+import androidx.appcompat.widget.Toolbar;
+import gr.auth.databases.flavours.R;
+import gr.auth.databases.flavours.base.BaseActivity;
+import gr.auth.databases.flavours.model.IngredientSummary;
+import gr.auth.databases.flavours.model.ItemSummary;
+
+public class AddItemActivity extends BaseActivity {
+ public static final String ITEM_TYPE = "ITEM_TYPE";
+
+ private ArrayList ingredients = new ArrayList<>();
+ private ItemSummary.ItemType itemType;
+ private EditText itemNameInput, itemDescriptionInput;
+
+ @SuppressLint("ClickableViewAccessibility")
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_add_item);
+
+ Bundle extras = getIntent().getExtras();
+ if (extras != null) {
+ itemType = (ItemSummary.ItemType) extras.getSerializable(ITEM_TYPE);
+ }
+
+ Toolbar toolbar = findViewById(R.id.add_item_toolbar);
+ if (itemType == ItemSummary.ItemType.FOOD) {
+ toolbar.setTitle(getString(R.string.add_item_toolbar_title_food));
+ } else if (itemType == ItemSummary.ItemType.DRINK) {
+ toolbar.setTitle(getString(R.string.add_item_toolbar_title_drink));
+ }
+
+ setSupportActionBar(toolbar);
+ ActionBar actionbar = getSupportActionBar();
+ if (actionbar != null) {
+ actionbar.setDisplayHomeAsUpEnabled(true);
+ actionbar.setHomeAsUpIndicator(R.drawable.ic_menu_black_24dp);
+ }
+
+ itemNameInput = findViewById(R.id.add_item_name);
+ AppCompatButton addItemButton = findViewById(R.id.add_item_add_btn);
+ final TextView ingredientsTitle = findViewById(R.id.add_item_add_ingredient_title);
+ final EditText addIngredientInput = findViewById(R.id.add_item_add_ingredient);
+ final LinearLayout ingredientsList = findViewById(R.id.add_item_ingredients_list);
+
+ if (itemType == ItemSummary.ItemType.FOOD) {
+ itemNameInput.setHint(R.string.add_food_hint_name);
+ addItemButton.setText(R.string.add_food_add_btn);
+ } else if (itemType == ItemSummary.ItemType.DRINK) {
+ itemNameInput.setHint(R.string.add_drink_hint_name);
+ addItemButton.setText(R.string.add_drink_add_btn);
+ }
+
+ addIngredientInput.setOnEditorActionListener(new TextView.OnEditorActionListener() {
+ @Override
+ public boolean onEditorAction(TextView textView, int actionId, KeyEvent keyEvent) {
+ if (actionId == EditorInfo.IME_ACTION_DONE) {
+ ingredients.add(new IngredientSummary(
+ addIngredientInput.getText().toString(), false));
+
+ View ingredientRow = getLayoutInflater().inflate(R.layout.add_item_ingredient_row, ingredientsList, false);
+ TextView ingredientName = ingredientRow.findViewById(R.id.add_item_ingredient_name);
+ ingredientName.setText(ingredients.get(ingredients.size() - 1).getName());
+
+ AppCompatImageButton removeIngredientBtn = ingredientRow.findViewById(R.id.add_item_remove_ingredient);
+ removeIngredientBtn.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ int index = ingredientsList.indexOfChild((View) view.getParent());
+ ingredients.remove(index);
+ ingredientsList.removeViewAt(index);
+ }
+ });
+
+ ingredientsList.addView(ingredientRow);
+ ingredientsTitle.setVisibility(View.VISIBLE);
+ ingredientsList.setVisibility(View.VISIBLE);
+
+ addIngredientInput.setText("");
+ return true;
+ }
+ return false;
+ }
+ });
+
+ addItemButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ //TODO
+ }
+ });
+
+ createDrawer();
+ drawer.setSelection(-1);
+ }
+
+ @Override
+ public void onBackPressed() {
+ if (drawer.isDrawerOpen()) {
+ drawer.closeDrawer();
+ } else {
+ super.onBackPressed();
+ }
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ int id = item.getItemId();
+
+ if (id == android.R.id.home) {
+ drawer.openDrawer();
+ return true;
+ }
+
+ return super.onOptionsItemSelected(item);
+ }
+}
\ No newline at end of file
diff --git a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/restaurant/RestaurantActivity.java b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/restaurant/RestaurantActivity.java
index 6bdb6b1..fe4ad0c 100644
--- a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/restaurant/RestaurantActivity.java
+++ b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/restaurant/RestaurantActivity.java
@@ -8,6 +8,7 @@ import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import androidx.viewpager.widget.ViewPager;
import gr.auth.databases.flavours.R;
+import gr.auth.databases.flavours.activities.AddItemActivity;
import gr.auth.databases.flavours.activities.drink.DrinkActivity;
import gr.auth.databases.flavours.activities.food.FoodActivity;
import gr.auth.databases.flavours.activities.restaurant.fragments.RestaurantDrinksFragment;
@@ -19,7 +20,6 @@ import gr.auth.databases.flavours.model.ItemSummary;
import android.content.Intent;
import android.os.Bundle;
-import android.util.Log;
import android.view.MenuItem;
import android.view.View;
@@ -29,6 +29,8 @@ import com.google.android.material.tabs.TabLayout;
import java.util.ArrayList;
import java.util.List;
+import static gr.auth.databases.flavours.activities.AddItemActivity.ITEM_TYPE;
+
public class RestaurantActivity extends BaseActivity
implements RestaurantFoodsFragment.RestaurantFoodsFragmentInteractionListener,
RestaurantDrinksFragment.RestaurantDrinksFragmentInteractionListener {
@@ -58,8 +60,15 @@ public class RestaurantActivity extends BaseActivity
FAB.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
- /*Intent intent = new Intent(view.getContext(), AddRestaurantActivity.class);
- startActivity(intent);*/
+ if (viewPager.getCurrentItem() == 1) {
+ Intent intent = new Intent(view.getContext(), AddItemActivity.class);
+ intent.putExtra(ITEM_TYPE, ItemSummary.ItemType.FOOD);
+ startActivity(intent);
+ } else if (viewPager.getCurrentItem() == 2) {
+ Intent intent = new Intent(view.getContext(), AddItemActivity.class);
+ intent.putExtra(ITEM_TYPE, ItemSummary.ItemType.DRINK);
+ startActivity(intent);
+ }
}
});
diff --git a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/drawable-hdpi/ic_delete_black_18dp.png b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/drawable-hdpi/ic_delete_black_18dp.png
new file mode 100644
index 0000000..a77602a
Binary files /dev/null and b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/drawable-hdpi/ic_delete_black_18dp.png differ
diff --git a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/drawable-mdpi/ic_delete_black_18dp.png b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/drawable-mdpi/ic_delete_black_18dp.png
new file mode 100644
index 0000000..db8f6c1
Binary files /dev/null and b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/drawable-mdpi/ic_delete_black_18dp.png differ
diff --git a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/drawable-xhdpi/ic_delete_black_18dp.png b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/drawable-xhdpi/ic_delete_black_18dp.png
new file mode 100644
index 0000000..735bd46
Binary files /dev/null and b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/drawable-xhdpi/ic_delete_black_18dp.png differ
diff --git a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/drawable-xxhdpi/ic_delete_black_18dp.png b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/drawable-xxhdpi/ic_delete_black_18dp.png
new file mode 100644
index 0000000..80bbc8b
Binary files /dev/null and b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/drawable-xxhdpi/ic_delete_black_18dp.png differ
diff --git a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/drawable-xxxhdpi/ic_delete_black_18dp.png b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/drawable-xxxhdpi/ic_delete_black_18dp.png
new file mode 100644
index 0000000..19654ac
Binary files /dev/null and b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/drawable-xxxhdpi/ic_delete_black_18dp.png differ
diff --git a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/activity_add_item.xml b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/activity_add_item.xml
new file mode 100644
index 0000000..18328a0
--- /dev/null
+++ b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/activity_add_item.xml
@@ -0,0 +1,113 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/add_item_ingredient_row.xml b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/add_item_ingredient_row.xml
new file mode 100644
index 0000000..3d33a13
--- /dev/null
+++ b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/add_item_ingredient_row.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/values/activity_rate_item_spinner_grade.xml b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/values/activity_rate_item_spinner_grade.xml
new file mode 100644
index 0000000..f17f5fc
--- /dev/null
+++ b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/values/activity_rate_item_spinner_grade.xml
@@ -0,0 +1,10 @@
+
+
+
+ - 1
+ - 2
+ - 3
+ - 4
+ - 5
+
+
\ No newline at end of file
diff --git a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/values/strings.xml b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/values/strings.xml
index 3895af9..b1edbea 100644
--- a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/values/strings.xml
+++ b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/values/strings.xml
@@ -78,4 +78,18 @@
Working hours
%1$s:%2$s - %3$s:%4$s
ADD RESTAURANT
+
+
+ Add Item
+ Add Food
+ Add Drink
+ Item\'s title
+ Food\'s title
+ Drink\'s title
+ Description
+ Ingredients:
+ Add ingredient
+ ADD ITEM
+ ADD FOOD
+ ADD DRINK