diff --git a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/AndroidManifest.xml b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/AndroidManifest.xml
index 3872bf6..9840a27 100644
--- a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/AndroidManifest.xml
+++ b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/AndroidManifest.xml
@@ -53,6 +53,8 @@
+
+
\ 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
index 2e92354..da86375 100644
--- 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
@@ -2,7 +2,6 @@ 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;
@@ -23,7 +22,7 @@ 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";
+ public static final String BUNDLE_ADD_ITEM_ITEM_TYPE = "BUNDLE_ADD_ITEM_ITEM_TYPE";
private ArrayList ingredients = new ArrayList<>();
private ItemSummary.ItemType itemType;
@@ -37,7 +36,7 @@ public class AddItemActivity extends BaseActivity {
Bundle extras = getIntent().getExtras();
if (extras != null) {
- itemType = (ItemSummary.ItemType) extras.getSerializable(ITEM_TYPE);
+ itemType = (ItemSummary.ItemType) extras.getSerializable(BUNDLE_ADD_ITEM_ITEM_TYPE);
}
Toolbar toolbar = findViewById(R.id.add_item_toolbar);
diff --git a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/RateItemActivity.java b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/RateItemActivity.java
new file mode 100644
index 0000000..b1face4
--- /dev/null
+++ b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/RateItemActivity.java
@@ -0,0 +1,105 @@
+package gr.auth.databases.flavours.activities;
+
+import android.os.Bundle;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.EditText;
+import android.widget.Spinner;
+
+import androidx.appcompat.app.ActionBar;
+import androidx.appcompat.widget.AppCompatButton;
+import androidx.appcompat.widget.Toolbar;
+import gr.auth.databases.flavours.R;
+import gr.auth.databases.flavours.base.BaseActivity;
+import gr.auth.databases.flavours.model.ItemRating;
+import gr.auth.databases.flavours.model.ItemSummary;
+
+public class RateItemActivity extends BaseActivity implements AdapterView.OnItemSelectedListener {
+ public static final String BUNDLE_RATE_ITEM_TYPE = "BUNDLE_RATE_ITEM_TYPE";
+
+ private ItemSummary.ItemType itemType;
+ private EditText ratingText;
+ private int ratingGrade;
+ private ItemRating.PortionSize ratingPortionSize;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_rate_item);
+
+ Bundle extras = getIntent().getExtras();
+ if (extras != null) {
+ itemType = (ItemSummary.ItemType) extras.getSerializable(BUNDLE_RATE_ITEM_TYPE);
+ }
+
+ Toolbar toolbar = findViewById(R.id.rate_item_toolbar);
+ setSupportActionBar(toolbar);
+ ActionBar actionbar = getSupportActionBar();
+ if (actionbar != null) {
+ actionbar.setDisplayHomeAsUpEnabled(true);
+ actionbar.setHomeAsUpIndicator(R.drawable.ic_menu_black_24dp);
+ }
+
+ Spinner gradeSpinner = findViewById(R.id.rate_item_grade);
+ ArrayAdapter gradeAdapter = ArrayAdapter.createFromResource(this,
+ R.array.rating_grade, android.R.layout.simple_spinner_item);
+ gradeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+ gradeSpinner.setAdapter(gradeAdapter);
+ gradeSpinner.setOnItemSelectedListener(this);
+
+ Spinner portionSizeSpinner = findViewById(R.id.rate_item_portion_size);
+ ArrayAdapter portionSizeAdapter = ArrayAdapter.createFromResource(this,
+ R.array.rating_portion_size, android.R.layout.simple_spinner_item);
+ portionSizeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+ portionSizeSpinner.setAdapter(portionSizeAdapter);
+ portionSizeSpinner.setOnItemSelectedListener(this);
+
+ ratingText = findViewById(R.id.rate_item_text);
+
+ AppCompatButton rateButton = findViewById(R.id.rate_item_rate_btn);
+ rateButton.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);
+ }
+
+ public void onItemSelected(AdapterView> parent, View view, int pos, long id) {
+ if (parent.getId() == R.id.rate_item_grade) {
+ ratingGrade = pos + 1;
+ } else if (parent.getId() == R.id.rate_item_portion_size) {
+ ratingPortionSize = ItemRating.PortionSize.getEnumTypeFromId(pos);
+ }
+ }
+
+ @Override
+ public void onNothingSelected(AdapterView> adapterView) {
+ }
+}
diff --git a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/RateRestaurantActivity.java b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/RateRestaurantActivity.java
new file mode 100644
index 0000000..d616a24
--- /dev/null
+++ b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/RateRestaurantActivity.java
@@ -0,0 +1,120 @@
+package gr.auth.databases.flavours.activities;
+
+import android.os.Bundle;
+import android.util.Log;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.EditText;
+import android.widget.Spinner;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import androidx.appcompat.app.ActionBar;
+import androidx.appcompat.widget.AppCompatButton;
+import androidx.appcompat.widget.Toolbar;
+import gr.auth.databases.flavours.R;
+import gr.auth.databases.flavours.base.BaseActivity;
+import gr.auth.databases.flavours.model.RestaurantRating;
+
+public class RateRestaurantActivity extends BaseActivity implements AdapterView.OnItemSelectedListener {
+ public static final String BUNDLE_RATE_RESTAURANT_NAME = "BUNDLE_RATE_RESTAURANT_NAME";
+
+ private EditText ratingText;
+ private int ratingGrade;
+ private RestaurantRating.Accessibility ratingAccessibility;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_rate_restaurant);
+
+ Bundle extras = getIntent().getExtras();
+ if (extras != null) {
+ //itemType = (ItemSummary.ItemType) extras.getSerializable(BUNDLE_ADD_ITEM_ITEM_TYPE);
+ }
+
+ Toolbar toolbar = findViewById(R.id.rate_restaurant_toolbar);
+ setSupportActionBar(toolbar);
+ ActionBar actionbar = getSupportActionBar();
+ if (actionbar != null) {
+ actionbar.setDisplayHomeAsUpEnabled(true);
+ actionbar.setHomeAsUpIndicator(R.drawable.ic_menu_black_24dp);
+ }
+
+ Spinner gradeSpinner = findViewById(R.id.rate_restaurant_grade);
+ ArrayAdapter gradeAdapter = ArrayAdapter.createFromResource(this,
+ R.array.rating_grade, android.R.layout.simple_spinner_item);
+ gradeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+ gradeSpinner.setAdapter(gradeAdapter);
+ gradeSpinner.setOnItemSelectedListener(this);
+
+ Spinner accessibilitySpinner = findViewById(R.id.rate_restaurant_accessibility);
+ ArrayAdapter accessibilityAdapter = ArrayAdapter.createFromResource(this,
+ R.array.rating_accessibility, android.R.layout.simple_spinner_item);
+ accessibilityAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+ accessibilitySpinner.setAdapter(accessibilityAdapter);
+ accessibilitySpinner.setOnItemSelectedListener(this);
+
+ List spinnerArray = new ArrayList();
+ spinnerArray.add("Όγκος");
+ spinnerArray.add("Πολύ όγκος");
+
+ Spinner dietSpinner = findViewById(R.id.rate_restaurant_diet);
+ ArrayAdapter dietAdapter = new ArrayAdapter<>(this,
+ android.R.layout.simple_spinner_item, spinnerArray);
+ dietAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+ dietSpinner.setAdapter(dietAdapter);
+ dietSpinner.setOnItemSelectedListener(this);
+ dietSpinner.setVisibility(View.VISIBLE);
+
+ ratingText = findViewById(R.id.rate_restaurant_text);
+
+ AppCompatButton rateButton = findViewById(R.id.rate_restaurant_rate_btn);
+ rateButton.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);
+ }
+
+ public void onItemSelected(AdapterView> parent, View view, int pos, long id) {
+ if (parent.getId() == R.id.rate_restaurant_grade) {
+ ratingGrade = pos + 1;
+ } else if (parent.getId() == R.id.rate_restaurant_accessibility) {
+ ratingAccessibility = RestaurantRating.Accessibility.getEnumTypeFromId(pos);
+ } else if (parent.getId() == R.id.rate_restaurant_diet) {
+ }
+ }
+
+ @Override
+ public void onNothingSelected(AdapterView> adapterView) {
+ }
+}
diff --git a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/drink/DrinkActivity.java b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/drink/DrinkActivity.java
index 96404f6..8c1f12f 100644
--- a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/drink/DrinkActivity.java
+++ b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/drink/DrinkActivity.java
@@ -1,5 +1,16 @@
package gr.auth.databases.flavours.activities.drink;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.MenuItem;
+import android.view.View;
+
+import com.google.android.material.floatingactionbutton.FloatingActionButton;
+import com.google.android.material.tabs.TabLayout;
+
+import java.util.ArrayList;
+import java.util.List;
+
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.Toolbar;
@@ -8,20 +19,14 @@ 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.RateItemActivity;
import gr.auth.databases.flavours.activities.drink.fragments.DrinkInfoFragment;
import gr.auth.databases.flavours.activities.drink.fragments.DrinkIngredientsFragment;
import gr.auth.databases.flavours.activities.drink.fragments.DrinkRatingsFragment;
import gr.auth.databases.flavours.base.BaseActivity;
+import gr.auth.databases.flavours.model.ItemSummary;
-import android.os.Bundle;
-import android.view.MenuItem;
-import android.view.View;
-
-import com.google.android.material.floatingactionbutton.FloatingActionButton;
-import com.google.android.material.tabs.TabLayout;
-
-import java.util.ArrayList;
-import java.util.List;
+import static gr.auth.databases.flavours.activities.RateItemActivity.BUNDLE_RATE_ITEM_TYPE;
public class DrinkActivity extends BaseActivity {
@@ -45,16 +50,6 @@ public class DrinkActivity extends BaseActivity {
createDrawer();
drawer.setSelection(-1);
- FAB = findViewById(R.id.drink_fab);
- FAB.hide();
- FAB.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- /*Intent intent = new Intent(view.getContext(), AddRestaurantActivity.class);
- startActivity(intent);*/
- }
- });
-
viewPager = findViewById(R.id.drink_pager);
viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
public void onPageScrollStateChanged(int state) {
@@ -72,6 +67,23 @@ public class DrinkActivity extends BaseActivity {
}
});
+ FAB = findViewById(R.id.drink_fab);
+ FAB.hide();
+ FAB.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ if (viewPager.getCurrentItem() == 1) {
+ /*Intent intent = new Intent(view.getContext(), AddItemActivity.class);
+ intent.putExtra(BUNDLE_ADD_ITEM_ITEM_TYPE, ItemSummary.ItemType.DRINK);
+ startActivity(intent);*/
+ } else if (viewPager.getCurrentItem() == 2) {
+ Intent intent = new Intent(view.getContext(), RateItemActivity.class);
+ intent.putExtra(BUNDLE_RATE_ITEM_TYPE, ItemSummary.ItemType.DRINK);
+ startActivity(intent);
+ }
+ }
+ });
+
setupViewPager(viewPager);
TabLayout tabLayout = findViewById(R.id.drink_tabs);
tabLayout.setupWithViewPager(viewPager);
diff --git a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/food/FoodActivity.java b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/food/FoodActivity.java
index 03c3558..d160955 100644
--- a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/food/FoodActivity.java
+++ b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/food/FoodActivity.java
@@ -1,5 +1,16 @@
package gr.auth.databases.flavours.activities.food;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.MenuItem;
+import android.view.View;
+
+import com.google.android.material.floatingactionbutton.FloatingActionButton;
+import com.google.android.material.tabs.TabLayout;
+
+import java.util.ArrayList;
+import java.util.List;
+
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.Toolbar;
@@ -8,20 +19,17 @@ 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.RateItemActivity;
import gr.auth.databases.flavours.activities.food.fragments.FoodInfoFragment;
import gr.auth.databases.flavours.activities.food.fragments.FoodIngredientsFragment;
import gr.auth.databases.flavours.activities.food.fragments.FoodRatingsFragment;
+import gr.auth.databases.flavours.activities.profile.ProfileActivity;
import gr.auth.databases.flavours.base.BaseActivity;
+import gr.auth.databases.flavours.model.ItemSummary;
-import android.os.Bundle;
-import android.view.MenuItem;
-import android.view.View;
-
-import com.google.android.material.floatingactionbutton.FloatingActionButton;
-import com.google.android.material.tabs.TabLayout;
-
-import java.util.ArrayList;
-import java.util.List;
+import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
+import static gr.auth.databases.flavours.activities.RateItemActivity.BUNDLE_RATE_ITEM_TYPE;
+import static gr.auth.databases.flavours.activities.profile.ProfileActivity.BUNDLE_USER_ID;
public class FoodActivity extends BaseActivity {
@@ -45,16 +53,6 @@ public class FoodActivity extends BaseActivity {
createDrawer();
drawer.setSelection(-1);
- FAB = findViewById(R.id.food_fab);
- FAB.hide();
- FAB.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- /*Intent intent = new Intent(view.getContext(), AddRestaurantActivity.class);
- startActivity(intent);*/
- }
- });
-
viewPager = findViewById(R.id.food_pager);
viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
public void onPageScrollStateChanged(int state) {
@@ -72,6 +70,23 @@ public class FoodActivity extends BaseActivity {
}
});
+ FAB = findViewById(R.id.food_fab);
+ FAB.hide();
+ FAB.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ if (viewPager.getCurrentItem() == 1) {
+ /*Intent intent = new Intent(view.getContext(), AddItemActivity.class);
+ intent.putExtra(BUNDLE_ADD_ITEM_ITEM_TYPE, ItemSummary.ItemType.DRINK);
+ startActivity(intent);*/
+ } else if (viewPager.getCurrentItem() == 2) {
+ Intent intent = new Intent(view.getContext(), RateItemActivity.class);
+ intent.putExtra(BUNDLE_RATE_ITEM_TYPE, ItemSummary.ItemType.FOOD);
+ startActivity(intent);
+ }
+ }
+ });
+
setupViewPager(viewPager);
TabLayout tabLayout = findViewById(R.id.food_tabs);
tabLayout.setupWithViewPager(viewPager);
diff --git a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/main/MainActivity.java b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/main/MainActivity.java
index 0af5997..60cf9cb 100644
--- a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/main/MainActivity.java
+++ b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/main/MainActivity.java
@@ -1,7 +1,6 @@
package gr.auth.databases.flavours.activities.main;
import android.content.Intent;
-import android.content.pm.PackageManager;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
@@ -118,7 +117,6 @@ public class MainActivity extends BaseActivity {
return true;
}
-
return super.onOptionsItemSelected(item);
}
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 cbb0347..5638d1e 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
@@ -1,5 +1,16 @@
package gr.auth.databases.flavours.activities.restaurant;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.MenuItem;
+import android.view.View;
+
+import com.google.android.material.floatingactionbutton.FloatingActionButton;
+import com.google.android.material.tabs.TabLayout;
+
+import java.util.ArrayList;
+import java.util.List;
+
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.Toolbar;
@@ -9,6 +20,7 @@ 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.RateRestaurantActivity;
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;
@@ -18,18 +30,7 @@ import gr.auth.databases.flavours.activities.restaurant.fragments.RestaurantRati
import gr.auth.databases.flavours.base.BaseActivity;
import gr.auth.databases.flavours.model.ItemSummary;
-import android.content.Intent;
-import android.os.Bundle;
-import android.view.MenuItem;
-import android.view.View;
-
-import com.google.android.material.floatingactionbutton.FloatingActionButton;
-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;
+import static gr.auth.databases.flavours.activities.AddItemActivity.BUNDLE_ADD_ITEM_ITEM_TYPE;
public class RestaurantActivity extends BaseActivity
implements RestaurantFoodsFragment.RestaurantFoodsFragmentInteractionListener,
@@ -61,11 +62,14 @@ public class RestaurantActivity extends BaseActivity
public void onClick(View view) {
if (viewPager.getCurrentItem() == 1) {
Intent intent = new Intent(view.getContext(), AddItemActivity.class);
- intent.putExtra(ITEM_TYPE, ItemSummary.ItemType.FOOD);
+ intent.putExtra(BUNDLE_ADD_ITEM_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);
+ intent.putExtra(BUNDLE_ADD_ITEM_ITEM_TYPE, ItemSummary.ItemType.DRINK);
+ startActivity(intent);
+ } else if (viewPager.getCurrentItem() == 3) {
+ Intent intent = new Intent(view.getContext(), RateRestaurantActivity.class);
startActivity(intent);
}
}
diff --git a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/restaurant/fragments/RestaurantDrinksFragment.java b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/restaurant/fragments/RestaurantDrinksFragment.java
index 9333519..968a0de 100644
--- a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/restaurant/fragments/RestaurantDrinksFragment.java
+++ b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/restaurant/fragments/RestaurantDrinksFragment.java
@@ -1,8 +1,6 @@
package gr.auth.databases.flavours.activities.restaurant.fragments;
-
import android.os.Bundle;
-import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -10,7 +8,6 @@ import android.view.ViewGroup;
import java.util.ArrayList;
import androidx.annotation.NonNull;
-import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import gr.auth.databases.flavours.R;
diff --git a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/restaurant/fragments/RestaurantFoodsFragment.java b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/restaurant/fragments/RestaurantFoodsFragment.java
index e7a6112..07df4bc 100644
--- a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/restaurant/fragments/RestaurantFoodsFragment.java
+++ b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/restaurant/fragments/RestaurantFoodsFragment.java
@@ -8,7 +8,6 @@ import android.view.ViewGroup;
import java.util.ArrayList;
import androidx.annotation.NonNull;
-import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import gr.auth.databases.flavours.R;
diff --git a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/restaurant/fragments/RestaurantItemAdapter.java b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/restaurant/fragments/RestaurantItemAdapter.java
index 13ecf2e..425c319 100644
--- a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/restaurant/fragments/RestaurantItemAdapter.java
+++ b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/restaurant/fragments/RestaurantItemAdapter.java
@@ -1,6 +1,5 @@
package gr.auth.databases.flavours.activities.restaurant.fragments;
-import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
diff --git a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/base/BaseActivity.java b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/base/BaseActivity.java
index e5e49f1..dd95e9a 100644
--- a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/base/BaseActivity.java
+++ b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/base/BaseActivity.java
@@ -83,7 +83,6 @@ public abstract class BaseActivity extends AppCompatActivity {
drawer.closeDrawer();
}
-
public static OkHttpClient getClient() {
return client;
}
@@ -208,7 +207,6 @@ public abstract class BaseActivity extends AppCompatActivity {
}
});
-
drawerBuilder.addDrawerItems(homeItem, loginLogoutItem);
drawer = drawerBuilder.build();
diff --git a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/model/ItemRating.java b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/model/ItemRating.java
index 91f9dc7..3de5c3d 100644
--- a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/model/ItemRating.java
+++ b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/model/ItemRating.java
@@ -1,8 +1,47 @@
package gr.auth.databases.flavours.model;
+import androidx.annotation.Nullable;
+
public class ItemRating extends Rating {
public enum PortionSize {
- SMALL, MEDIUM, BIG
+ SMALL(0), MEDIUM(1), BIG(2), UNSUPPORTED(-1);
+
+ private int id;
+
+ PortionSize(int id) {
+ this.id = id;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ @Nullable
+ public static String getWorkingTypeFromId(int id) {
+ switch (id) {
+ case 0:
+ return "Small";
+ case 1:
+ return "Medium";
+ case 2:
+ return "Big";
+ default:
+ return null;
+ }
+ }
+
+ public static PortionSize getEnumTypeFromId(int id) {
+ switch (id) {
+ case 0:
+ return SMALL;
+ case 1:
+ return MEDIUM;
+ case 2:
+ return BIG;
+ default:
+ return UNSUPPORTED;
+ }
+ }
}
private PortionSize portionSize;
diff --git a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/model/RestaurantRating.java b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/model/RestaurantRating.java
index 176b44b..b8b3d11 100644
--- a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/model/RestaurantRating.java
+++ b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/model/RestaurantRating.java
@@ -1,8 +1,47 @@
package gr.auth.databases.flavours.model;
+import androidx.annotation.Nullable;
+
public class RestaurantRating extends Rating {
public enum Accessibility {
- EASY, MODERATE, HARD
+ EASY(0), MODERATE(1), HARD(2), UNSUPPORTED(-1);
+
+ private int id;
+
+ Accessibility(int id) {
+ this.id = id;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ @Nullable
+ public static String getWorkingTypeFromId(int id) {
+ switch (id) {
+ case 0:
+ return "Easy";
+ case 1:
+ return "Moderate";
+ case 2:
+ return "Hard";
+ default:
+ return null;
+ }
+ }
+
+ public static Accessibility getEnumTypeFromId(int id) {
+ switch (id) {
+ case 0:
+ return EASY;
+ case 1:
+ return MODERATE;
+ case 2:
+ return HARD;
+ default:
+ return UNSUPPORTED;
+ }
+ }
}
private Accessibility accessibility;
diff --git a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/session/SessionManager.java b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/session/SessionManager.java
index e4416ab..d605569 100644
--- a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/session/SessionManager.java
+++ b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/session/SessionManager.java
@@ -1,6 +1,5 @@
package gr.auth.databases.flavours.session;
-
import android.content.SharedPreferences;
import com.franmontiel.persistentcookiejar.PersistentCookieJar;
@@ -17,6 +16,33 @@ import okhttp3.RequestBody;
import okhttp3.Response;
public class SessionManager {
+ public enum UserType {
+ USER(0), MODERATOR(1), OWNER(2);
+
+ private int id;
+
+ UserType(int id) {
+ this.id = id;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public static UserType fromInteger(int x) {
+ switch (x) {
+ case 0:
+ return USER;
+ case 1:
+ return MODERATOR;
+ case 2:
+ return OWNER;
+ }
+ return null;
+ }
+
+ }
+
//Generic constants
public static final HttpUrl indexUrl = HttpUrl.parse("https://www.thmmy.gr/smf/index.php?theme=4");
private static final HttpUrl loginUrl = HttpUrl.parse("https://www.thmmy.gr/smf/index.php?action=login2");
@@ -30,6 +56,7 @@ public class SessionManager {
private final SharedPreferences sharedPrefs;
private static final String USERNAME = "Username";
private static final String USER_ID = "UserID";
+ private static final String USER_TYPE = "USER_TYPE";
private static final String LOGOUT_LINK = "LogoutLink";
private static final String LOGGED_IN = "LoggedIn";
private static final String LOGIN_SCREEN_AS_DEFAULT = "LoginScreenAsDefault";
@@ -78,13 +105,9 @@ public class SessionManager {
SharedPreferences.Editor editor = sharedPrefs.edit();
setLoginScreenAsDefault(false);
editor.putBoolean(LOGGED_IN, true);
- /*editor.putString(USERNAME, extractUserName(document));
- editor.putInt(USER_ID, extractUserId(document));
- String avatar = extractAvatarLink(document);*/
- /*if (avatar != null)
- editor.putString(AVATAR_LINK, avatar);
- editor.putBoolean(HAS_AVATAR, avatar != null);
- editor.putString(LOGOUT_LINK, extractLogoutLink(document));*/
+ editor.putString(USERNAME, "Username");
+ editor.putInt(USER_ID, 10);
+ editor.putInt(USER_TYPE, UserType.USER.getId());
editor.apply();
return 0;
@@ -150,6 +173,10 @@ public class SessionManager {
return sharedPrefs.getInt(USER_ID, -1);
}
+ public UserType getUserType() {
+ return UserType.fromInteger(sharedPrefs.getInt(USER_TYPE, -1));
+ }
+
public Cookie getThmmyCookie() {
List cookieList = cookieJar.loadForRequest(indexUrl);
for (Cookie cookie : cookieList) {
@@ -196,6 +223,7 @@ public class SessionManager {
sharedPrefs.edit().clear().apply(); //Clear session data
sharedPrefs.edit().putString(USERNAME, "Guest").apply();
sharedPrefs.edit().putInt(USER_ID, -1).apply();
+ sharedPrefs.edit().putInt(USER_TYPE, -1).apply();
sharedPrefs.edit().putBoolean(LOGGED_IN, false).apply(); //User logs out
}
diff --git a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
deleted file mode 100644
index 1f6bb29..0000000
--- a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/drawable/ic_launcher_background.xml b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/drawable/ic_launcher_background.xml
deleted file mode 100644
index 0d025f9..0000000
--- a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/drawable/ic_launcher_background.xml
+++ /dev/null
@@ -1,170 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
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
index 18328a0..92aa233 100644
--- 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
@@ -18,7 +18,8 @@
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
- app:popupTheme="@style/Theme.AppCompat.Light" />
+ app:popupTheme="@style/Theme.AppCompat.Light"
+ app:title="@string/add_item_toolbar_title" />
+ android:text="@string/add_item_add_btn" />
\ No newline at end of file
diff --git a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/activity_login.xml b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/activity_login.xml
index fa3b417..33cf76c 100644
--- a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/activity_login.xml
+++ b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/activity_login.xml
@@ -1,130 +1,99 @@
-
+ android:fillViewport="true"
+ android:fitsSystemWindows="true"
+ android:isScrollContainer="false">
-
+ android:layout_height="wrap_content"
+ android:focusableInTouchMode="true"
+ android:orientation="vertical"
+ android:paddingLeft="24dp"
+ android:paddingRight="24dp">
-
-
-
-
-
-
-
-
-
+ android:contentDescription="@string/app_logo_description"
+ android:src="@drawable/logo" />
-
+
+
-
-
+ android:hint="@string/login_hint_username"
+ android:importantForAutofill="no"
+ android:inputType="textPersonName"
+ tools:targetApi="o" />
+
-
-
-
-
-
-
-
+
-
+
+
-
+ android:hint="@string/login_hint_password"
+ android:importantForAutofill="no"
+ android:inputType="textPassword"
+ tools:targetApi="o" />
+
-
-
-
-
-
+
+ android:background="@drawable/accent_button_bg"
+ android:padding="12dp"
+ android:text="@string/login_btn_login"
+ android:textSize="18sp" />
+
+
- -->
-
\ No newline at end of file
+ android:background="@color/colorBackground"
+ android:gravity="center"
+ android:text="@string/login_btn_go_to_sign_up"
+ android:textAllCaps="false"
+ android:textColor="@color/colorAccent"
+ android:textSize="15sp" />
+
+
+
+
\ No newline at end of file
diff --git a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/activity_rate_item.xml b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/activity_rate_item.xml
new file mode 100644
index 0000000..35c1f83
--- /dev/null
+++ b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/activity_rate_item.xml
@@ -0,0 +1,105 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/activity_rate_restaurant.xml b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/activity_rate_restaurant.xml
new file mode 100644
index 0000000..684bcfd
--- /dev/null
+++ b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/activity_rate_restaurant.xml
@@ -0,0 +1,127 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/activity_restaurant.xml b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/activity_restaurant.xml
index 20f812d..2f36dfd 100644
--- a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/activity_restaurant.xml
+++ b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/activity_restaurant.xml
@@ -19,7 +19,8 @@
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:gravity="center"
- app:popupTheme="@style/ToolbarTheme"/>
+ app:popupTheme="@style/ToolbarTheme"
+ app:title="@string/restaurant_toolbar_title" />
-
+ android:fillViewport="true"
+ android:fitsSystemWindows="true"
+ android:isScrollContainer="false">
-
+ android:layout_height="wrap_content"
+ android:focusableInTouchMode="true"
+ android:orientation="vertical"
+ android:paddingLeft="24dp"
+ android:paddingRight="24dp">
-
+ android:contentDescription="@string/app_logo_description"
+ android:src="@drawable/logo" />
+
+
+
-
+ android:hint="@string/sign_up_hint_email"
+ android:importantForAutofill="no"
+ android:inputType="textEmailAddress"
+ tools:targetApi="o" />
+
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+ android:hint="@string/sign_up_hint_username"
+ android:importantForAutofill="no"
+ android:inputType="textPersonName"
+ tools:targetApi="o" />
+
-
-
+
-
+
+
-
-
-
+
+
+
+
+
+
-
-
+ android:layout_height="wrap_content"
+ android:hint="@string/sign_up_hint_birthday"
+ android:importantForAutofill="no"
+ android:inputType="date"
+ tools:targetApi="o" />
+
-
+
+ android:background="@drawable/accent_button_bg"
+ android:padding="12dp"
+ android:text="@string/sign_up_btn_sign_up"
+ android:textSize="18sp" />
+
+
- -->
-
\ No newline at end of file
+ android:background="@color/colorBackground"
+ android:gravity="center"
+ android:text="@string/sign_up_btn_go_to_login"
+ android:textAllCaps="false"
+ android:textColor="@color/colorAccent"
+ android:textSize="15sp" />
+
+
+
+
\ No newline at end of file
diff --git a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/menu/restaurant_toolbar_menu.xml b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/menu/restaurant_toolbar_menu.xml
deleted file mode 100644
index ceedeec..0000000
--- a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/menu/restaurant_toolbar_menu.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
\ 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
deleted file mode 100644
index f17f5fc..0000000
--- a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/values/activity_rate_item_spinner_grade.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
- - 1
- - 2
- - 3
- - 4
- - 5
-
-
\ No newline at end of file
diff --git a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/values/activity_rate_restaurant_spinner_accessibility.xml b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/values/activity_rate_restaurant_spinner_accessibility.xml
new file mode 100644
index 0000000..bfa8da4
--- /dev/null
+++ b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/values/activity_rate_restaurant_spinner_accessibility.xml
@@ -0,0 +1,8 @@
+
+
+
+ - Easy
+ - Moderate
+ - Hard
+
+
\ No newline at end of file
diff --git a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/values/rating_spinner_grade.xml b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/values/rating_spinner_grade.xml
new file mode 100644
index 0000000..48f4ec0
--- /dev/null
+++ b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/values/rating_spinner_grade.xml
@@ -0,0 +1,10 @@
+
+
+
+ - \t\t1\t\t
+ - \t\t2\t\t
+ - \t\t3\t\t
+ - \t\t4\t\t
+ - \t\t5\t\t
+
+
\ No newline at end of file
diff --git a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/values/rating_spinner_portion_size.xml b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/values/rating_spinner_portion_size.xml
new file mode 100644
index 0000000..12f0433
--- /dev/null
+++ b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/values/rating_spinner_portion_size.xml
@@ -0,0 +1,8 @@
+
+
+
+ - Small
+ - Medium
+ - Big
+
+
\ 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 1a06219..b4e8512 100644
--- a/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/values/strings.xml
+++ b/UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/values/strings.xml
@@ -111,4 +111,21 @@
ADD ITEM
ADD FOOD
ADD DRINK
+
+
+ Rate Restaurant
+ Rate %1$s
+ Grade:
+ Accessibility:
+ Diet:
+ Add some text to your rating
+ RATE
+
+
+ Rate Item
+ Rate %1$s
+ Grade:
+ Portion size:
+ Add some text to your rating
+ RATE