Browse Source

Add ratings support, Minor fixes

master
Apostolos Fanakis 6 years ago
parent
commit
40c56f4367
  1. 2
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/AndroidManifest.xml
  2. 5
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/AddItemActivity.java
  3. 105
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/RateItemActivity.java
  4. 120
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/RateRestaurantActivity.java
  5. 50
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/drink/DrinkActivity.java
  6. 53
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/food/FoodActivity.java
  7. 2
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/main/MainActivity.java
  8. 32
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/restaurant/RestaurantActivity.java
  9. 3
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/restaurant/fragments/RestaurantDrinksFragment.java
  10. 1
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/restaurant/fragments/RestaurantFoodsFragment.java
  11. 1
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/restaurant/fragments/RestaurantItemAdapter.java
  12. 2
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/base/BaseActivity.java
  13. 41
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/model/ItemRating.java
  14. 41
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/model/RestaurantRating.java
  15. 44
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/session/SessionManager.java
  16. 34
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
  17. 170
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/drawable/ic_launcher_background.xml
  18. 5
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/activity_add_item.xml
  19. 49
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/activity_login.xml
  20. 105
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/activity_rate_item.xml
  21. 127
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/activity_rate_restaurant.xml
  22. 3
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/activity_restaurant.xml
  23. 37
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/activity_sign_up.xml
  24. 12
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/menu/restaurant_toolbar_menu.xml
  25. 10
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/values/activity_rate_item_spinner_grade.xml
  26. 8
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/values/activity_rate_restaurant_spinner_accessibility.xml
  27. 10
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/values/rating_spinner_grade.xml
  28. 8
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/values/rating_spinner_portion_size.xml
  29. 17
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/values/strings.xml

2
UI/AndroidApp/flavoursWithoutBorders/app/src/main/AndroidManifest.xml

@ -53,6 +53,8 @@
<activity android:name=".activities.AddRestaurantActivity" /> <activity android:name=".activities.AddRestaurantActivity" />
<activity android:name=".activities.AddItemActivity" /> <activity android:name=".activities.AddItemActivity" />
<activity android:name=".activities.profile.ProfileActivity" /> <activity android:name=".activities.profile.ProfileActivity" />
<activity android:name=".activities.RateRestaurantActivity" />
<activity android:name=".activities.RateItemActivity" />
</application> </application>
</manifest> </manifest>

5
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.annotation.SuppressLint;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
@ -23,7 +22,7 @@ import gr.auth.databases.flavours.model.IngredientSummary;
import gr.auth.databases.flavours.model.ItemSummary; import gr.auth.databases.flavours.model.ItemSummary;
public class AddItemActivity extends BaseActivity { 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<IngredientSummary> ingredients = new ArrayList<>(); private ArrayList<IngredientSummary> ingredients = new ArrayList<>();
private ItemSummary.ItemType itemType; private ItemSummary.ItemType itemType;
@ -37,7 +36,7 @@ public class AddItemActivity extends BaseActivity {
Bundle extras = getIntent().getExtras(); Bundle extras = getIntent().getExtras();
if (extras != null) { 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); Toolbar toolbar = findViewById(R.id.add_item_toolbar);

105
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<CharSequence> 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<CharSequence> 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) {
}
}

120
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<CharSequence> 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<CharSequence> 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<String> spinnerArray = new ArrayList<String>();
spinnerArray.add("Όγκος");
spinnerArray.add("Πολύ όγκος");
Spinner dietSpinner = findViewById(R.id.rate_restaurant_diet);
ArrayAdapter<String> 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) {
}
}

50
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; 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.annotation.NonNull;
import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
@ -8,20 +19,14 @@ import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter; import androidx.fragment.app.FragmentPagerAdapter;
import androidx.viewpager.widget.ViewPager; import androidx.viewpager.widget.ViewPager;
import gr.auth.databases.flavours.R; 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.DrinkInfoFragment;
import gr.auth.databases.flavours.activities.drink.fragments.DrinkIngredientsFragment; import gr.auth.databases.flavours.activities.drink.fragments.DrinkIngredientsFragment;
import gr.auth.databases.flavours.activities.drink.fragments.DrinkRatingsFragment; import gr.auth.databases.flavours.activities.drink.fragments.DrinkRatingsFragment;
import gr.auth.databases.flavours.base.BaseActivity; import gr.auth.databases.flavours.base.BaseActivity;
import gr.auth.databases.flavours.model.ItemSummary;
import android.os.Bundle; import static gr.auth.databases.flavours.activities.RateItemActivity.BUNDLE_RATE_ITEM_TYPE;
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;
public class DrinkActivity extends BaseActivity { public class DrinkActivity extends BaseActivity {
@ -45,16 +50,6 @@ public class DrinkActivity extends BaseActivity {
createDrawer(); createDrawer();
drawer.setSelection(-1); 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 = findViewById(R.id.drink_pager);
viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
public void onPageScrollStateChanged(int state) { 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); setupViewPager(viewPager);
TabLayout tabLayout = findViewById(R.id.drink_tabs); TabLayout tabLayout = findViewById(R.id.drink_tabs);
tabLayout.setupWithViewPager(viewPager); tabLayout.setupWithViewPager(viewPager);

53
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; 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.annotation.NonNull;
import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
@ -8,20 +19,17 @@ import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter; import androidx.fragment.app.FragmentPagerAdapter;
import androidx.viewpager.widget.ViewPager; import androidx.viewpager.widget.ViewPager;
import gr.auth.databases.flavours.R; 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.FoodInfoFragment;
import gr.auth.databases.flavours.activities.food.fragments.FoodIngredientsFragment; import gr.auth.databases.flavours.activities.food.fragments.FoodIngredientsFragment;
import gr.auth.databases.flavours.activities.food.fragments.FoodRatingsFragment; 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.base.BaseActivity;
import gr.auth.databases.flavours.model.ItemSummary;
import android.os.Bundle; import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
import android.view.MenuItem; import static gr.auth.databases.flavours.activities.RateItemActivity.BUNDLE_RATE_ITEM_TYPE;
import android.view.View; import static gr.auth.databases.flavours.activities.profile.ProfileActivity.BUNDLE_USER_ID;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.tabs.TabLayout;
import java.util.ArrayList;
import java.util.List;
public class FoodActivity extends BaseActivity { public class FoodActivity extends BaseActivity {
@ -45,16 +53,6 @@ public class FoodActivity extends BaseActivity {
createDrawer(); createDrawer();
drawer.setSelection(-1); 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 = findViewById(R.id.food_pager);
viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
public void onPageScrollStateChanged(int state) { 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); setupViewPager(viewPager);
TabLayout tabLayout = findViewById(R.id.food_tabs); TabLayout tabLayout = findViewById(R.id.food_tabs);
tabLayout.setupWithViewPager(viewPager); tabLayout.setupWithViewPager(viewPager);

2
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; package gr.auth.databases.flavours.activities.main;
import android.content.Intent; import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle; import android.os.Bundle;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
@ -118,7 +117,6 @@ public class MainActivity extends BaseActivity {
return true; return true;
} }
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
} }

32
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; 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.annotation.NonNull;
import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
@ -9,6 +20,7 @@ import androidx.fragment.app.FragmentPagerAdapter;
import androidx.viewpager.widget.ViewPager; import androidx.viewpager.widget.ViewPager;
import gr.auth.databases.flavours.R; import gr.auth.databases.flavours.R;
import gr.auth.databases.flavours.activities.AddItemActivity; 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.drink.DrinkActivity;
import gr.auth.databases.flavours.activities.food.FoodActivity; import gr.auth.databases.flavours.activities.food.FoodActivity;
import gr.auth.databases.flavours.activities.restaurant.fragments.RestaurantDrinksFragment; 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.base.BaseActivity;
import gr.auth.databases.flavours.model.ItemSummary; import gr.auth.databases.flavours.model.ItemSummary;
import android.content.Intent; import static gr.auth.databases.flavours.activities.AddItemActivity.BUNDLE_ADD_ITEM_ITEM_TYPE;
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;
public class RestaurantActivity extends BaseActivity public class RestaurantActivity extends BaseActivity
implements RestaurantFoodsFragment.RestaurantFoodsFragmentInteractionListener, implements RestaurantFoodsFragment.RestaurantFoodsFragmentInteractionListener,
@ -61,11 +62,14 @@ public class RestaurantActivity extends BaseActivity
public void onClick(View view) { public void onClick(View view) {
if (viewPager.getCurrentItem() == 1) { if (viewPager.getCurrentItem() == 1) {
Intent intent = new Intent(view.getContext(), AddItemActivity.class); 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); startActivity(intent);
} else if (viewPager.getCurrentItem() == 2) { } else if (viewPager.getCurrentItem() == 2) {
Intent intent = new Intent(view.getContext(), AddItemActivity.class); 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); startActivity(intent);
} }
} }

3
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; package gr.auth.databases.flavours.activities.restaurant.fragments;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -10,7 +8,6 @@ import android.view.ViewGroup;
import java.util.ArrayList; import java.util.ArrayList;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import gr.auth.databases.flavours.R; import gr.auth.databases.flavours.R;

1
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 java.util.ArrayList;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import gr.auth.databases.flavours.R; import gr.auth.databases.flavours.R;

1
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; package gr.auth.databases.flavours.activities.restaurant.fragments;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;

2
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(); drawer.closeDrawer();
} }
public static OkHttpClient getClient() { public static OkHttpClient getClient() {
return client; return client;
} }
@ -208,7 +207,6 @@ public abstract class BaseActivity extends AppCompatActivity {
} }
}); });
drawerBuilder.addDrawerItems(homeItem, loginLogoutItem); drawerBuilder.addDrawerItems(homeItem, loginLogoutItem);
drawer = drawerBuilder.build(); drawer = drawerBuilder.build();

41
UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/model/ItemRating.java

@ -1,8 +1,47 @@
package gr.auth.databases.flavours.model; package gr.auth.databases.flavours.model;
import androidx.annotation.Nullable;
public class ItemRating extends Rating { public class ItemRating extends Rating {
public enum PortionSize { 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; private PortionSize portionSize;

41
UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/model/RestaurantRating.java

@ -1,8 +1,47 @@
package gr.auth.databases.flavours.model; package gr.auth.databases.flavours.model;
import androidx.annotation.Nullable;
public class RestaurantRating extends Rating { public class RestaurantRating extends Rating {
public enum Accessibility { 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; private Accessibility accessibility;

44
UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/session/SessionManager.java

@ -1,6 +1,5 @@
package gr.auth.databases.flavours.session; package gr.auth.databases.flavours.session;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import com.franmontiel.persistentcookiejar.PersistentCookieJar; import com.franmontiel.persistentcookiejar.PersistentCookieJar;
@ -17,6 +16,33 @@ import okhttp3.RequestBody;
import okhttp3.Response; import okhttp3.Response;
public class SessionManager { 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 //Generic constants
public static final HttpUrl indexUrl = HttpUrl.parse("https://www.thmmy.gr/smf/index.php?theme=4"); 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"); 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 final SharedPreferences sharedPrefs;
private static final String USERNAME = "Username"; private static final String USERNAME = "Username";
private static final String USER_ID = "UserID"; 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 LOGOUT_LINK = "LogoutLink";
private static final String LOGGED_IN = "LoggedIn"; private static final String LOGGED_IN = "LoggedIn";
private static final String LOGIN_SCREEN_AS_DEFAULT = "LoginScreenAsDefault"; private static final String LOGIN_SCREEN_AS_DEFAULT = "LoginScreenAsDefault";
@ -78,13 +105,9 @@ public class SessionManager {
SharedPreferences.Editor editor = sharedPrefs.edit(); SharedPreferences.Editor editor = sharedPrefs.edit();
setLoginScreenAsDefault(false); setLoginScreenAsDefault(false);
editor.putBoolean(LOGGED_IN, true); editor.putBoolean(LOGGED_IN, true);
/*editor.putString(USERNAME, extractUserName(document)); editor.putString(USERNAME, "Username");
editor.putInt(USER_ID, extractUserId(document)); editor.putInt(USER_ID, 10);
String avatar = extractAvatarLink(document);*/ editor.putInt(USER_TYPE, UserType.USER.getId());
/*if (avatar != null)
editor.putString(AVATAR_LINK, avatar);
editor.putBoolean(HAS_AVATAR, avatar != null);
editor.putString(LOGOUT_LINK, extractLogoutLink(document));*/
editor.apply(); editor.apply();
return 0; return 0;
@ -150,6 +173,10 @@ public class SessionManager {
return sharedPrefs.getInt(USER_ID, -1); return sharedPrefs.getInt(USER_ID, -1);
} }
public UserType getUserType() {
return UserType.fromInteger(sharedPrefs.getInt(USER_TYPE, -1));
}
public Cookie getThmmyCookie() { public Cookie getThmmyCookie() {
List<Cookie> cookieList = cookieJar.loadForRequest(indexUrl); List<Cookie> cookieList = cookieJar.loadForRequest(indexUrl);
for (Cookie cookie : cookieList) { for (Cookie cookie : cookieList) {
@ -196,6 +223,7 @@ public class SessionManager {
sharedPrefs.edit().clear().apply(); //Clear session data sharedPrefs.edit().clear().apply(); //Clear session data
sharedPrefs.edit().putString(USERNAME, "Guest").apply(); sharedPrefs.edit().putString(USERNAME, "Guest").apply();
sharedPrefs.edit().putInt(USER_ID, -1).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 sharedPrefs.edit().putBoolean(LOGGED_IN, false).apply(); //User logs out
} }

34
UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/drawable-v24/ic_launcher_foreground.xml

@ -1,34 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillType="evenOdd"
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
android:strokeWidth="1"
android:strokeColor="#00000000">
<aapt:attr name="android:fillColor">
<gradient
android:endX="78.5885"
android:endY="90.9159"
android:startX="48.7653"
android:startY="61.0927"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>

170
UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/drawable/ic_launcher_background.xml

@ -1,170 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#008577"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>

5
UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/activity_add_item.xml

@ -18,7 +18,8 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary" android:background="?attr/colorPrimary"
app:popupTheme="@style/Theme.AppCompat.Light" /> app:popupTheme="@style/Theme.AppCompat.Light"
app:title="@string/add_item_toolbar_title" />
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView <androidx.core.widget.NestedScrollView
@ -107,7 +108,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="end" android:layout_gravity="end"
android:text="@string/add_restaurant_add_btn" /> android:text="@string/add_item_add_btn" />
</LinearLayout> </LinearLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

49
UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/activity_login.xml

@ -1,17 +1,13 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/colorBackground"
android:fitsSystemWindows="true">
<ScrollView
android:id="@+id/login_inner_scroll" android:id="@+id/login_inner_scroll"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/colorBackground"
android:fillViewport="true" android:fillViewport="true"
android:fitsSystemWindows="true"
android:isScrollContainer="false"> android:isScrollContainer="false">
<LinearLayout <LinearLayout
@ -25,8 +21,8 @@
<ImageView <ImageView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:src="@drawable/logo" android:contentDescription="@string/app_logo_description"
android:contentDescription="@string/app_logo_description" /> android:src="@drawable/logo" />
<!-- Username Label --> <!-- Username Label -->
<com.google.android.material.textfield.TextInputLayout <com.google.android.material.textfield.TextInputLayout
@ -38,8 +34,8 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:hint="@string/login_hint_username" android:hint="@string/login_hint_username"
android:inputType="textPersonName"
android:importantForAutofill="no" android:importantForAutofill="no"
android:inputType="textPersonName"
tools:targetApi="o" /> tools:targetApi="o" />
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
@ -59,8 +55,8 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:hint="@string/login_hint_password" android:hint="@string/login_hint_password"
android:inputType="textPassword"
android:importantForAutofill="no" android:importantForAutofill="no"
android:inputType="textPassword"
tools:targetApi="o" /> tools:targetApi="o" />
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
@ -89,10 +85,10 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/colorBackground" android:background="@color/colorBackground"
android:text="@string/login_btn_go_to_sign_up"
android:textColor="@color/colorAccent"
android:gravity="center" android:gravity="center"
android:text="@string/login_btn_go_to_sign_up"
android:textAllCaps="false" android:textAllCaps="false"
android:textColor="@color/colorAccent"
android:textSize="15sp" /> android:textSize="15sp" />
<Space <Space
@ -101,30 +97,3 @@
android:layout_weight="0.3" /> android:layout_weight="0.3" />
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>
<!--<LinearLayout
android:id="@+id/login_progress_bar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:visibility="invisible">
<ProgressBar
style="?android:attr/progressBarStyleInverse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/progress_bar_bg"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:text="@string/login_spinner"
android:textColor="@color/accent"
android:textSize="20sp"
android:textStyle="bold"/>
</LinearLayout>-->
</RelativeLayout>

105
UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/activity_rate_item.xml

@ -0,0 +1,105 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout 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:background="@android:color/background_light"
android:fitsSystemWindows="true">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/rate_item_appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/Theme.AppCompat.Light">
<androidx.appcompat.widget.Toolbar
android:id="@+id/rate_item_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/Theme.AppCompat.Light"
app:title="@string/rate_item_toolbar_title" />
</com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_marginEnd="4dp"
android:focusableInTouchMode="true"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:text="@string/rate_item_grade_title"
android:textSize="16sp"
android:textStyle="bold" />
<androidx.appcompat.widget.AppCompatSpinner
android:id="@+id/rate_item_grade"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:text="@string/rate_item_portion_size_title"
android:textSize="16sp"
android:textStyle="bold" />
<androidx.appcompat.widget.AppCompatSpinner
android:id="@+id/rate_item_portion_size"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
app:passwordToggleEnabled="true">
<EditText
android:id="@+id/rate_item_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/rate_item_text"
android:importantForAutofill="no"
android:inputType="textMultiLine"
tools:targetApi="o" />
</com.google.android.material.textfield.TextInputLayout>
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/rate_item_rate_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:text="@string/rate_item_rate_btn" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

127
UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/activity_rate_restaurant.xml

@ -0,0 +1,127 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout 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:background="@android:color/background_light"
android:fitsSystemWindows="true">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/rate_restaurant_appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/Theme.AppCompat.Light">
<androidx.appcompat.widget.Toolbar
android:id="@+id/rate_restaurant_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/Theme.AppCompat.Light"
app:title="@string/rate_restaurant_toolbar_title" />
</com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_marginEnd="4dp"
android:focusableInTouchMode="true"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:text="@string/rate_restaurant_grade_title"
android:textSize="16sp"
android:textStyle="bold" />
<androidx.appcompat.widget.AppCompatSpinner
android:id="@+id/rate_restaurant_grade"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:text="@string/rate_restaurant_accessibility_title"
android:textSize="16sp"
android:textStyle="bold" />
<androidx.appcompat.widget.AppCompatSpinner
android:id="@+id/rate_restaurant_accessibility"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:text="@string/rate_restaurant_diet_title"
android:textSize="16sp"
android:textStyle="bold" />
<androidx.appcompat.widget.AppCompatSpinner
android:id="@+id/rate_restaurant_diet"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone" />
</LinearLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
app:passwordToggleEnabled="true">
<EditText
android:id="@+id/rate_restaurant_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/rate_restaurant_text"
android:importantForAutofill="no"
android:inputType="textMultiLine"
tools:targetApi="o" />
</com.google.android.material.textfield.TextInputLayout>
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/rate_restaurant_rate_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:text="@string/rate_restaurant_rate_btn" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

3
UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/activity_restaurant.xml

@ -19,7 +19,8 @@
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary" android:background="?attr/colorPrimary"
android:gravity="center" android:gravity="center"
app:popupTheme="@style/ToolbarTheme"/> app:popupTheme="@style/ToolbarTheme"
app:title="@string/restaurant_toolbar_title" />
<com.google.android.material.tabs.TabLayout <com.google.android.material.tabs.TabLayout
android:id="@+id/restaurant_tabs" android:id="@+id/restaurant_tabs"

37
UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/activity_sign_up.xml

@ -1,17 +1,13 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/colorBackground"
android:fitsSystemWindows="true">
<ScrollView
android:id="@+id/sign_up_inner_scroll" android:id="@+id/sign_up_inner_scroll"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/colorBackground"
android:fillViewport="true" android:fillViewport="true"
android:fitsSystemWindows="true"
android:isScrollContainer="false"> android:isScrollContainer="false">
<LinearLayout <LinearLayout
@ -137,30 +133,3 @@
android:layout_weight="0.3" /> android:layout_weight="0.3" />
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>
<!--<LinearLayout
android:id="@+id/login_progress_bar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:visibility="invisible">
<ProgressBar
style="?android:attr/progressBarStyleInverse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/progress_bar_bg"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:text="@string/login_spinner"
android:textColor="@color/accent"
android:textSize="20sp"
android:textStyle="bold"/>
</LinearLayout>-->
</RelativeLayout>

12
UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/menu/restaurant_toolbar_menu.xml

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu 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"
tools:context=".activities.main.MainActivity">
<item
android:id="@+id/restaurant_toolbar_menu_map"
android:icon="@drawable/ic_map_black_24dp"
android:orderInCategory="200"
android:title="@string/main_toolbar_menu_map"
app:showAsAction="ifRoom" />
</menu>

10
UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/values/activity_rate_item_spinner_grade.xml

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="item_grade">
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>
<item>5</item>
</string-array>
</resources>

8
UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/values/activity_rate_restaurant_spinner_accessibility.xml

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="rating_accessibility">
<item>Easy</item>
<item>Moderate</item>
<item>Hard</item>
</string-array>
</resources>

10
UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/values/rating_spinner_grade.xml

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="rating_grade">
<item>\t\t1\t\t</item>
<item>\t\t2\t\t</item>
<item>\t\t3\t\t</item>
<item>\t\t4\t\t</item>
<item>\t\t5\t\t</item>
</string-array>
</resources>

8
UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/values/rating_spinner_portion_size.xml

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="rating_portion_size">
<item>Small</item>
<item>Medium</item>
<item>Big</item>
</string-array>
</resources>

17
UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/values/strings.xml

@ -111,4 +111,21 @@
<string name="add_item_add_btn">ADD ITEM</string> <string name="add_item_add_btn">ADD ITEM</string>
<string name="add_food_add_btn">ADD FOOD</string> <string name="add_food_add_btn">ADD FOOD</string>
<string name="add_drink_add_btn">ADD DRINK</string> <string name="add_drink_add_btn">ADD DRINK</string>
<!-- Rate Restaurant -->
<string name="rate_restaurant_toolbar_title">Rate Restaurant</string>
<string name="rate_restaurant_toolbar_title_placeholder">Rate %1$s</string>
<string name="rate_restaurant_grade_title">Grade:</string>
<string name="rate_restaurant_accessibility_title">Accessibility:</string>
<string name="rate_restaurant_diet_title">Diet:</string>
<string name="rate_restaurant_text">Add some text to your rating</string>
<string name="rate_restaurant_rate_btn">RATE</string>
<!-- Rate Item -->
<string name="rate_item_toolbar_title">Rate Item</string>
<string name="rate_item_toolbar_title_placeholder">Rate %1$s</string>
<string name="rate_item_grade_title">Grade:</string>
<string name="rate_item_portion_size_title">Portion size:</string>
<string name="rate_item_text">Add some text to your rating</string>
<string name="rate_item_rate_btn">RATE</string>
</resources> </resources>

Loading…
Cancel
Save