Browse Source

Init FoodActivity, DrinkActivity, Minor changes, Fix maps for apis>18

master
Apostolos Fanakis 6 years ago
parent
commit
6610273872
  1. 4
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/AndroidManifest.xml
  2. 137
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/drink/DrinkActivity.java
  3. 50
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/drink/fragments/DrinkInfoFragment.java
  4. 66
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/drink/fragments/DrinkIngredientsFragment.java
  5. 137
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/food/FoodActivity.java
  6. 50
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/food/fragments/FoodInfoFragment.java
  7. 66
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/food/fragments/FoodIngredientsFragment.java
  8. 1
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/main/MainActivity.java
  9. 4
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/main/fragments/MainListFragment.java
  10. 17
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/restaurant/RestaurantActivity.java
  11. 12
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/restaurant/fragments/RestaurantDrinksFragment.java
  12. 11
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/restaurant/fragments/RestaurantFoodsFragment.java
  13. 11
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/restaurant/fragments/RestaurantInfoFragment.java
  14. 23
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/restaurant/fragments/RestaurantItemAdapter.java
  15. 4
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/restaurant/fragments/RestaurantRatingsFragment.java
  16. 26
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/base/BaseActivity.java
  17. 4
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/base/BaseFragment.java
  18. 19
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/model/IngredientSummary.java
  19. 8
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/model/ItemSummary.java
  20. 57
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/utils/IngredientItemAdapter.java
  21. 53
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/activity_drink.xml
  22. 53
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/activity_food.xml
  23. 26
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/fragment_drink_info.xml
  24. 26
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/fragment_food_info.xml
  25. 10
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/fragment_main_list.xml
  26. 8
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/fragment_restaurant_info.xml
  27. 21
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/ingredient_row.xml
  28. 2
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/reusable_recycler_list.xml
  29. 21
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/values/strings.xml

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

@ -10,6 +10,8 @@
--> -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application <application
android:name=".base.BaseApplication" android:name=".base.BaseApplication"
@ -46,6 +48,8 @@
android:name=".activities.main.MainActivity" android:name=".activities.main.MainActivity"
android:label="@string/main_activity_title" /> android:label="@string/main_activity_title" />
<activity android:name=".activities.restaurant.RestaurantActivity" /> <activity android:name=".activities.restaurant.RestaurantActivity" />
<activity android:name=".activities.food.FoodActivity" />
<activity android:name=".activities.drink.DrinkActivity" />
<activity android:name=".activities.AddRestaurantActivity" /> <activity android:name=".activities.AddRestaurantActivity" />
</application> </application>

137
UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/drink/DrinkActivity.java

@ -0,0 +1,137 @@
package gr.auth.databases.flavours.activities.drink;
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.Toolbar;
import androidx.fragment.app.Fragment;
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.drink.fragments.DrinkInfoFragment;
import gr.auth.databases.flavours.activities.drink.fragments.DrinkIngredientsFragment;
import gr.auth.databases.flavours.base.BaseActivity;
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;
public class DrinkActivity extends BaseActivity {
private ViewPager viewPager;
private FloatingActionButton FAB;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_drink);
Toolbar toolbar = findViewById(R.id.drink_toolbar);
toolbar.setTitle("White Russian");
setSupportActionBar(toolbar);
ActionBar actionbar = getSupportActionBar();
if (actionbar != null) {
actionbar.setDisplayHomeAsUpEnabled(true);
actionbar.setHomeAsUpIndicator(R.drawable.ic_menu_black_24dp);
}
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) {
}
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
public void onPageSelected(int position) {
if (position == 0) {
FAB.hide();
} else {
FAB.show();
}
}
});
setupViewPager(viewPager);
TabLayout tabLayout = findViewById(R.id.drink_tabs);
tabLayout.setupWithViewPager(viewPager);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == android.R.id.home) {
drawer.openDrawer();
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
public void onBackPressed() {
if (drawer.isDrawerOpen()) {
drawer.closeDrawer();
} else {
super.onBackPressed();
}
}
private void setupViewPager(ViewPager viewPager) {
RestaurantPagerAdapter adapter = new RestaurantPagerAdapter(getSupportFragmentManager());
adapter.addFrag(DrinkInfoFragment.newInstance(64), "INFO");
adapter.addFrag(DrinkIngredientsFragment.newInstance(64), "INGREDIENTS");
/*adapter.addFrag(DrinkRatingsFragment.newInstance(64), "RATINGS");*/
viewPager.setAdapter(adapter);
}
private class RestaurantPagerAdapter extends FragmentPagerAdapter {
private final List<Fragment> mFragmentList = new ArrayList<>();
private final List<String> mFragmentTitleList = new ArrayList<>();
RestaurantPagerAdapter(FragmentManager manager) {
super(manager);
}
@NonNull
@Override
public Fragment getItem(int position) {
return mFragmentList.get(position);
}
@Override
public int getCount() {
return mFragmentList.size();
}
void addFrag(Fragment fragment, String title) {
mFragmentList.add(fragment);
mFragmentTitleList.add(title);
}
@Override
public CharSequence getPageTitle(int position) {
return mFragmentTitleList.get(position);
}
}
}

50
UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/drink/fragments/DrinkInfoFragment.java

@ -0,0 +1,50 @@
package gr.auth.databases.flavours.activities.drink.fragments;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import gr.auth.databases.flavours.R;
public class DrinkInfoFragment extends Fragment {
public DrinkInfoFragment() {
// Required empty public constructor
}
private static final String DRINK_ID = "DRINK_ID";
private int drinkId;
public static DrinkInfoFragment newInstance(int drinkId) {
DrinkInfoFragment fragment = new DrinkInfoFragment();
Bundle args = new Bundle();
args.putInt(DRINK_ID, drinkId);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
assert getArguments() != null;
drinkId = getArguments().getInt(DRINK_ID);
}
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View rootView = inflater.inflate(R.layout.fragment_drink_info, container, false);
TextView restaurantServing = rootView.findViewById(R.id.drink_serving_restaurant);
restaurantServing.setText(getString(R.string.drink_serving_restaurant, "Restaurant's name"));
TextView hasAlcohol = rootView.findViewById(R.id.drink_contains_alcohol);
hasAlcohol.setText(getString(R.string.drink_has_alcohol, "YES"));
TextView description = rootView.findViewById(R.id.drink_description);
description.setText("a description");
return rootView;
}
}

66
UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/drink/fragments/DrinkIngredientsFragment.java

@ -0,0 +1,66 @@
package gr.auth.databases.flavours.activities.drink.fragments;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import gr.auth.databases.flavours.R;
import gr.auth.databases.flavours.model.IngredientSummary;
import gr.auth.databases.flavours.utils.IngredientItemAdapter;
public class DrinkIngredientsFragment extends Fragment {
public DrinkIngredientsFragment() {
// Required empty public constructor
}
private static final String DRINK_ID = "DRINK_ID";
private int drinkId;
public static DrinkIngredientsFragment newInstance(int drinkId) {
DrinkIngredientsFragment fragment = new DrinkIngredientsFragment();
Bundle args = new Bundle();
args.putInt(DRINK_ID, drinkId);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
assert getArguments() != null;
drinkId = getArguments().getInt(DRINK_ID);
}
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View rootView = inflater.inflate(R.layout.reusable_recycler_list, container, false);
ArrayList<IngredientSummary> ingredients = new ArrayList<>();
ingredients.add(new IngredientSummary("Βότκα", true));
ingredients.add(new IngredientSummary("Γάλα", false));
Context context = getContext();
assert context != null;
IngredientItemAdapter itemAdapter = new IngredientItemAdapter(context, ingredients);
RecyclerView mainContent = rootView.findViewById(R.id.recycler_list);
mainContent.setAdapter(itemAdapter);
LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
mainContent.setLayoutManager(layoutManager);
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(mainContent.getContext(),
layoutManager.getOrientation());
mainContent.addItemDecoration(dividerItemDecoration);
return rootView;
}
}

137
UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/food/FoodActivity.java

@ -0,0 +1,137 @@
package gr.auth.databases.flavours.activities.food;
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.Toolbar;
import androidx.fragment.app.Fragment;
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.food.fragments.FoodInfoFragment;
import gr.auth.databases.flavours.activities.food.fragments.FoodIngredientsFragment;
import gr.auth.databases.flavours.base.BaseActivity;
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;
public class FoodActivity extends BaseActivity {
private ViewPager viewPager;
private FloatingActionButton FAB;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_food);
Toolbar toolbar = findViewById(R.id.food_toolbar);
toolbar.setTitle("Γεμιστά");
setSupportActionBar(toolbar);
ActionBar actionbar = getSupportActionBar();
if (actionbar != null) {
actionbar.setDisplayHomeAsUpEnabled(true);
actionbar.setHomeAsUpIndicator(R.drawable.ic_menu_black_24dp);
}
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) {
}
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
public void onPageSelected(int position) {
if (position == 0) {
FAB.hide();
} else {
FAB.show();
}
}
});
setupViewPager(viewPager);
TabLayout tabLayout = findViewById(R.id.food_tabs);
tabLayout.setupWithViewPager(viewPager);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == android.R.id.home) {
drawer.openDrawer();
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
public void onBackPressed() {
if (drawer.isDrawerOpen()) {
drawer.closeDrawer();
} else {
super.onBackPressed();
}
}
private void setupViewPager(ViewPager viewPager) {
RestaurantPagerAdapter adapter = new RestaurantPagerAdapter(getSupportFragmentManager());
adapter.addFrag(FoodInfoFragment.newInstance(64), "INFO");
adapter.addFrag(FoodIngredientsFragment.newInstance(64), "INGREDIENTS");
/*adapter.addFrag(FoodRatingsFragment.newInstance(64), "RATINGS");*/
viewPager.setAdapter(adapter);
}
private class RestaurantPagerAdapter extends FragmentPagerAdapter {
private final List<Fragment> mFragmentList = new ArrayList<>();
private final List<String> mFragmentTitleList = new ArrayList<>();
RestaurantPagerAdapter(FragmentManager manager) {
super(manager);
}
@NonNull
@Override
public Fragment getItem(int position) {
return mFragmentList.get(position);
}
@Override
public int getCount() {
return mFragmentList.size();
}
void addFrag(Fragment fragment, String title) {
mFragmentList.add(fragment);
mFragmentTitleList.add(title);
}
@Override
public CharSequence getPageTitle(int position) {
return mFragmentTitleList.get(position);
}
}
}

50
UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/food/fragments/FoodInfoFragment.java

@ -0,0 +1,50 @@
package gr.auth.databases.flavours.activities.food.fragments;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import gr.auth.databases.flavours.R;
public class FoodInfoFragment extends Fragment {
public FoodInfoFragment() {
// Required empty public constructor
}
private static final String FOOD_ID = "FOOD_ID";
private int foodId;
public static FoodInfoFragment newInstance(int foodId) {
FoodInfoFragment fragment = new FoodInfoFragment();
Bundle args = new Bundle();
args.putInt(FOOD_ID, foodId);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
assert getArguments() != null;
foodId = getArguments().getInt(FOOD_ID);
}
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View rootView = inflater.inflate(R.layout.fragment_food_info, container, false);
TextView restaurantServing = rootView.findViewById(R.id.food_serving_restaurant);
restaurantServing.setText(getString(R.string.food_serving_restaurant, "Restaurant's name"));
TextView calories = rootView.findViewById(R.id.food_calories);
calories.setText(getString(R.string.food_calories, 500));
TextView description = rootView.findViewById(R.id.food_description);
description.setText("some awesome description");
return rootView;
}
}

66
UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/food/fragments/FoodIngredientsFragment.java

@ -0,0 +1,66 @@
package gr.auth.databases.flavours.activities.food.fragments;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import gr.auth.databases.flavours.R;
import gr.auth.databases.flavours.model.IngredientSummary;
import gr.auth.databases.flavours.utils.IngredientItemAdapter;
public class FoodIngredientsFragment extends Fragment {
public FoodIngredientsFragment() {
// Required empty public constructor
}
private static final String FOOD_ID = "FOOD_ID";
private int foodId;
public static FoodIngredientsFragment newInstance(int foodId) {
FoodIngredientsFragment fragment = new FoodIngredientsFragment();
Bundle args = new Bundle();
args.putInt(FOOD_ID, foodId);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
assert getArguments() != null;
foodId = getArguments().getInt(FOOD_ID);
}
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View rootView = inflater.inflate(R.layout.reusable_recycler_list, container, false);
ArrayList<IngredientSummary> ingredients = new ArrayList<>();
ingredients.add(new IngredientSummary("Κιμάς", false));
ingredients.add(new IngredientSummary("Ρύζι", false));
Context context = getContext();
assert context != null;
IngredientItemAdapter itemAdapter = new IngredientItemAdapter(context, ingredients);
RecyclerView mainContent = rootView.findViewById(R.id.recycler_list);
mainContent.setAdapter(itemAdapter);
LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
mainContent.setLayoutManager(layoutManager);
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(mainContent.getContext(),
layoutManager.getOrientation());
mainContent.addItemDecoration(dividerItemDecoration);
return rootView;
}
}

1
UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/main/MainActivity.java

@ -1,6 +1,7 @@
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;

4
UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/main/fragments/MainListFragment.java

@ -18,9 +18,9 @@ public class MainListFragment extends Fragment {
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_main_list, container, false); ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.reusable_recycler_list, container, false);
RecyclerView recyclerView = rootView.findViewById(R.id.main_recycler); RecyclerView recyclerView = rootView.findViewById(R.id.recycler_list);
recyclerView.setHasFixedSize(true); recyclerView.setHasFixedSize(true);
LinearLayoutManager layoutManager = new LinearLayoutManager(getContext()); LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
recyclerView.setLayoutManager(layoutManager); recyclerView.setLayoutManager(layoutManager);

17
UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/restaurant/RestaurantActivity.java

@ -8,6 +8,8 @@ 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.drink.DrinkActivity;
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;
import gr.auth.databases.flavours.activities.restaurant.fragments.RestaurantFoodsFragment; import gr.auth.databases.flavours.activities.restaurant.fragments.RestaurantFoodsFragment;
import gr.auth.databases.flavours.activities.restaurant.fragments.RestaurantInfoFragment; import gr.auth.databases.flavours.activities.restaurant.fragments.RestaurantInfoFragment;
@ -15,7 +17,10 @@ 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 android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import android.view.MenuItem;
import android.view.View; import android.view.View;
import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.android.material.floatingactionbutton.FloatingActionButton;
@ -37,7 +42,7 @@ public class RestaurantActivity extends BaseActivity
setContentView(R.layout.activity_restaurant); setContentView(R.layout.activity_restaurant);
Toolbar toolbar = findViewById(R.id.restaurant_toolbar); Toolbar toolbar = findViewById(R.id.restaurant_toolbar);
toolbar.setTitle(getString(R.string.restaurant_toolbar_title)); toolbar.setTitle("Αιθερόπλοο");
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
ActionBar actionbar = getSupportActionBar(); ActionBar actionbar = getSupportActionBar();
if (actionbar != null) { if (actionbar != null) {
@ -80,7 +85,7 @@ public class RestaurantActivity extends BaseActivity
tabLayout.setupWithViewPager(viewPager); tabLayout.setupWithViewPager(viewPager);
} }
/*@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId(); int id = item.getItemId();
@ -90,7 +95,7 @@ public class RestaurantActivity extends BaseActivity
} }
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
}*/ }
@Override @Override
public void onBackPressed() { public void onBackPressed() {
@ -103,12 +108,14 @@ public class RestaurantActivity extends BaseActivity
@Override @Override
public void onRestaurantFoodsFragmentInteraction(ItemSummary item) { public void onRestaurantFoodsFragmentInteraction(ItemSummary item) {
// todo Intent intent = new Intent(this, FoodActivity.class);
startActivity(intent);
} }
@Override @Override
public void onRestaurantDrinksFragmentInteraction(ItemSummary item) { public void onRestaurantDrinksFragmentInteraction(ItemSummary item) {
// todo Intent intent = new Intent(this, DrinkActivity.class);
startActivity(intent);
} }
private void setupViewPager(ViewPager viewPager) { private void setupViewPager(ViewPager viewPager) {

12
UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/restaurant/fragments/RestaurantDrinksFragment.java

@ -2,6 +2,7 @@ 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;
@ -43,14 +44,15 @@ public class RestaurantDrinksFragment extends BaseFragment {
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View rootView = inflater.inflate(R.layout.fragment_restaurant_items, container, false); final View rootView = inflater.inflate(R.layout.reusable_recycler_list, container, false);
ArrayList<ItemSummary> drinks = new ArrayList<>(); ArrayList<ItemSummary> drinks = new ArrayList<>();
drinks.add(new ItemSummary("White russian", ItemSummary.ItemType.DRINK)); drinks.add(new ItemSummary("White russian", 5, ItemSummary.ItemType.DRINK));
drinks.add(new ItemSummary("Τσίπουρο Τσάπουρας", ItemSummary.ItemType.DRINK)); drinks.add(new ItemSummary("Τσίπουρο Τσάπουρας", 5, ItemSummary.ItemType.DRINK));
RestaurantItemAdapter itemAdapter = new RestaurantItemAdapter(fragmentInteractionListener, drinks); RestaurantItemAdapter itemAdapter = new RestaurantItemAdapter(fragmentInteractionListener,
RecyclerView mainContent = rootView.findViewById(R.id.restaurant_list); ItemSummary.ItemType.DRINK, drinks);
RecyclerView mainContent = rootView.findViewById(R.id.recycler_list);
mainContent.setAdapter(itemAdapter); mainContent.setAdapter(itemAdapter);
LinearLayoutManager layoutManager = new LinearLayoutManager(getContext()); LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
mainContent.setLayoutManager(layoutManager); mainContent.setLayoutManager(layoutManager);

11
UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/restaurant/fragments/RestaurantFoodsFragment.java

@ -42,14 +42,15 @@ public class RestaurantFoodsFragment extends BaseFragment {
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View rootView = inflater.inflate(R.layout.fragment_restaurant_items, container, false); final View rootView = inflater.inflate(R.layout.reusable_recycler_list, container, false);
ArrayList<ItemSummary> foods = new ArrayList<>(); ArrayList<ItemSummary> foods = new ArrayList<>();
foods.add(new ItemSummary("Γιουβαρλάκια", ItemSummary.ItemType.FOOD)); foods.add(new ItemSummary("Γιουβαρλάκια", 5, ItemSummary.ItemType.FOOD));
foods.add(new ItemSummary("Γεμιστά", ItemSummary.ItemType.FOOD)); foods.add(new ItemSummary("Γεμιστά", 5, ItemSummary.ItemType.FOOD));
RestaurantItemAdapter itemAdapter = new RestaurantItemAdapter(fragmentInteractionListener, foods); RestaurantItemAdapter itemAdapter = new RestaurantItemAdapter(fragmentInteractionListener,
RecyclerView mainContent = rootView.findViewById(R.id.restaurant_list); ItemSummary.ItemType.FOOD, foods);
RecyclerView mainContent = rootView.findViewById(R.id.recycler_list);
mainContent.setAdapter(itemAdapter); mainContent.setAdapter(itemAdapter);
LinearLayoutManager layoutManager = new LinearLayoutManager(getContext()); LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
mainContent.setLayoutManager(layoutManager); mainContent.setLayoutManager(layoutManager);

11
UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/restaurant/fragments/RestaurantInfoFragment.java

@ -7,9 +7,13 @@ import android.view.ViewGroup;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapView; import com.google.android.gms.maps.MapView;
import com.google.android.gms.maps.OnMapReadyCallback; import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import gr.auth.databases.flavours.R; import gr.auth.databases.flavours.R;
@ -124,6 +128,11 @@ public class RestaurantInfoFragment extends BaseFragment implements OnMapReadyCa
*/ */
@Override @Override
public void onMapReady(GoogleMap googleMap) { public void onMapReady(GoogleMap googleMap) {
//googleMap.animateCamera(CameraUpdateFactory.newLatLngZoom(grill15, 12.0f)); LatLng aitheroploo = new LatLng(40.6144, 22.9598);
googleMap.addMarker(new MarkerOptions()
.position(aitheroploo)
.title("Αιθερόπλοο")
.icon(BitmapDescriptorFactory.fromResource(R.drawable.pub_marker)));
googleMap.animateCamera(CameraUpdateFactory.newLatLngZoom(aitheroploo, 12.0f));
} }
} }

23
UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/restaurant/fragments/RestaurantItemAdapter.java

@ -1,5 +1,6 @@
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;
@ -15,12 +16,18 @@ import gr.auth.databases.flavours.base.BaseFragment;
import gr.auth.databases.flavours.model.ItemSummary; import gr.auth.databases.flavours.model.ItemSummary;
public class RestaurantItemAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { public class RestaurantItemAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private final RestaurantFoodsFragment.RestaurantFoodsFragmentInteractionListener interactionListener; private RestaurantFoodsFragment.RestaurantFoodsFragmentInteractionListener foodInteractionListener;
private RestaurantDrinksFragment.RestaurantDrinksFragmentInteractionListener drinkInteractionListener;
private final ArrayList<ItemSummary> items; private final ArrayList<ItemSummary> items;
RestaurantItemAdapter(BaseFragment.FragmentInteractionListener interactionListener, RestaurantItemAdapter(BaseFragment.FragmentInteractionListener interactionListener,
ArrayList<ItemSummary> items) { ItemSummary.ItemType itemType, ArrayList<ItemSummary> items) {
this.interactionListener = (RestaurantFoodsFragment.RestaurantFoodsFragmentInteractionListener) interactionListener; if (itemType == ItemSummary.ItemType.FOOD) {
this.foodInteractionListener = (RestaurantFoodsFragment.RestaurantFoodsFragmentInteractionListener) interactionListener;
} else if (itemType == ItemSummary.ItemType.DRINK) {
this.drinkInteractionListener = (RestaurantDrinksFragment.RestaurantDrinksFragmentInteractionListener) interactionListener;
}
this.items = items; this.items = items;
} }
@ -40,10 +47,16 @@ public class RestaurantItemAdapter extends RecyclerView.Adapter<RecyclerView.Vie
itemViewHolder.card.setOnClickListener(new View.OnClickListener() { itemViewHolder.card.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
if (interactionListener != null) { if (items.get(holder.getAdapterPosition()).getType() == ItemSummary.ItemType.FOOD &&
foodInteractionListener != null) {
// Notify the active callbacks interface (the activity, if the
// fragment is attached to one) that an item has been selected.
foodInteractionListener.onRestaurantFoodsFragmentInteraction(items.get(holder.getAdapterPosition()));
} else if (items.get(holder.getAdapterPosition()).getType() == ItemSummary.ItemType.DRINK
&& drinkInteractionListener != null) {
// Notify the active callbacks interface (the activity, if the // Notify the active callbacks interface (the activity, if the
// fragment is attached to one) that an item has been selected. // fragment is attached to one) that an item has been selected.
interactionListener.onRestaurantFoodsFragmentInteraction(items.get(holder.getAdapterPosition())); drinkInteractionListener.onRestaurantDrinksFragmentInteraction(items.get(holder.getAdapterPosition()));
} }
} }
}); });

4
UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/restaurant/fragments/RestaurantRatingsFragment.java

@ -42,7 +42,7 @@ public class RestaurantRatingsFragment extends Fragment {
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View rootView = inflater.inflate(R.layout.fragment_restaurant_items, container, false); final View rootView = inflater.inflate(R.layout.reusable_recycler_list, container, false);
ArrayList<Rating> ratings = new ArrayList<>(); ArrayList<Rating> ratings = new ArrayList<>();
ratings.add(new Rating(5, "Ανώνυμος", "Πάρα πολύ καλό!", "2018-01-04", Rating.Accessibility.MODERATE)); ratings.add(new Rating(5, "Ανώνυμος", "Πάρα πολύ καλό!", "2018-01-04", Rating.Accessibility.MODERATE));
@ -54,7 +54,7 @@ public class RestaurantRatingsFragment extends Fragment {
ratings.add(new Rating(4, "eddie lives inside you", "-", "2018-06-08", Rating.Accessibility.MODERATE)); ratings.add(new Rating(4, "eddie lives inside you", "-", "2018-06-08", Rating.Accessibility.MODERATE));
RestaurantRatingsAdapter itemAdapter = new RestaurantRatingsAdapter(getContext(), ratings); RestaurantRatingsAdapter itemAdapter = new RestaurantRatingsAdapter(getContext(), ratings);
RecyclerView mainContent = rootView.findViewById(R.id.restaurant_list); RecyclerView mainContent = rootView.findViewById(R.id.recycler_list);
mainContent.setAdapter(itemAdapter); mainContent.setAdapter(itemAdapter);
LinearLayoutManager layoutManager = new LinearLayoutManager(getContext()); LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
mainContent.setLayoutManager(layoutManager); mainContent.setLayoutManager(layoutManager);

26
UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/base/BaseActivity.java

@ -52,13 +52,17 @@ public abstract class BaseActivity extends AppCompatActivity {
isMainActivity = this instanceof MainActivity; isMainActivity = this instanceof MainActivity;
if (client == null) if (client == null)
client = BaseApplication.getInstance().getClient(); //must check every time - e.g. client = BaseApplication.getInstance().getClient(); //must check every time
// they become null when app restarts after crash // they become null when app restarts after crash
if (sessionManager == null) if (sessionManager == null)
sessionManager = BaseApplication.getInstance().getSessionManager(); sessionManager = BaseApplication.getInstance().getSessionManager();
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
if (!checkPerms()) {
requestPerms();
}
} }
@Override @Override
@ -226,12 +230,12 @@ public abstract class BaseActivity extends AppCompatActivity {
//True if permissions are OK //True if permissions are OK
private boolean checkPerms() { private boolean checkPerms() {
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP_MR1) { if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP_MR1) {
String[] PERMISSIONS_STORAGE = { String[] PERMISSIONS_MAP = {
Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.WRITE_EXTERNAL_STORAGE}; Manifest.permission.INTERNET};
return !(checkSelfPermission(PERMISSIONS_STORAGE[0]) == PackageManager.PERMISSION_DENIED || return !(checkSelfPermission(PERMISSIONS_MAP[0]) == PackageManager.PERMISSION_DENIED ||
checkSelfPermission(PERMISSIONS_STORAGE[1]) == PackageManager.PERMISSION_DENIED); checkSelfPermission(PERMISSIONS_MAP[1]) == PackageManager.PERMISSION_DENIED);
} }
return true; return true;
} }
@ -239,21 +243,19 @@ public abstract class BaseActivity extends AppCompatActivity {
//Display popup for user to grant permission //Display popup for user to grant permission
private void requestPerms() { //Runtime permissions request for devices with API >= 23 private void requestPerms() { //Runtime permissions request for devices with API >= 23
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP_MR1) { if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP_MR1) {
String[] PERMISSIONS_STORAGE = { String[] PERMISSIONS_MAP = {
Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.WRITE_EXTERNAL_STORAGE}; Manifest.permission.INTERNET};
requestPermissions(PERMISSIONS_STORAGE, PERMISSIONS_REQUEST_CODE); requestPermissions(PERMISSIONS_MAP, PERMISSIONS_REQUEST_CODE);
} }
} }
@Override @Override
public void onRequestPermissionsResult(int permsRequestCode, @NonNull String[] permissions public void onRequestPermissionsResult(int permsRequestCode, @NonNull String[] permissions
, @NonNull int[] grantResults) { , @NonNull int[] grantResults) {
switch (permsRequestCode) { switch (permsRequestCode) {
case PERMISSIONS_REQUEST_CODE: case PERMISSIONS_REQUEST_CODE:
//downloadFile();
break; break;
} }
} }

4
UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/base/BaseFragment.java

@ -28,13 +28,13 @@ public abstract class BaseFragment extends Fragment {
@Override @Override
public void onAttach(@NonNull Context context) { public void onAttach(@NonNull Context context) {
super.onAttach(context); super.onAttach(context);
/*if (context instanceof FragmentInteractionListener) { if (context instanceof FragmentInteractionListener) {
fragmentInteractionListener = (FragmentInteractionListener) context; fragmentInteractionListener = (FragmentInteractionListener) context;
} else { } else {
throw new RuntimeException(context.toString() throw new RuntimeException(context.toString()
+ " must implement OnFragmentInteractionListener"); + " must implement OnFragmentInteractionListener");
}*/ }
} }
@Override @Override

19
UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/model/IngredientSummary.java

@ -0,0 +1,19 @@
package gr.auth.databases.flavours.model;
public class IngredientSummary {
private String name;
private boolean hasAlcohol;
public IngredientSummary(String name, boolean hasAlcohol) {
this.name = name;
this.hasAlcohol = hasAlcohol;
}
public String getName() {
return name;
}
public boolean hasAlcohol() {
return hasAlcohol;
}
}

8
UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/model/ItemSummary.java

@ -6,10 +6,12 @@ public class ItemSummary {
} }
private String item; private String item;
private int id;
private ItemType type; private ItemType type;
public ItemSummary(String item, ItemType type) { public ItemSummary(String item, int id, ItemType type) {
this.item = item; this.item = item;
this.id = id;
this.type = type; this.type = type;
} }
@ -17,6 +19,10 @@ public class ItemSummary {
return item; return item;
} }
public int getId() {
return id;
}
public ItemType getType() { public ItemType getType() {
return type; return type;
} }

57
UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/utils/IngredientItemAdapter.java

@ -0,0 +1,57 @@
package gr.auth.databases.flavours.utils;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import java.util.ArrayList;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import gr.auth.databases.flavours.R;
import gr.auth.databases.flavours.model.IngredientSummary;
public class IngredientItemAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private final ArrayList<IngredientSummary> ingredients;
private Context context;
public IngredientItemAdapter(@NonNull Context context, ArrayList<IngredientSummary> ingredients) {
this.ingredients = ingredients;
this.context = context;
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).
inflate(R.layout.ingredient_row, parent, false);
return new ItemViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull final RecyclerView.ViewHolder holder, int position) {
IngredientSummary ingredient = ingredients.get(position);
ItemViewHolder itemViewHolder = (ItemViewHolder) holder;
itemViewHolder.name.setText(ingredient.getName());
itemViewHolder.hasAlcohol.setText(context.getString(R.string.ingredient_has_alcohol,
ingredient.hasAlcohol() ? "YES" : "NO"));
}
@Override
public int getItemCount() {
return ingredients == null ? 0 : ingredients.size();
}
private static class ItemViewHolder extends RecyclerView.ViewHolder {
TextView name, hasAlcohol;
ItemViewHolder(View itemView) {
super(itemView);
name = itemView.findViewById(R.id.ingredient_name);
hasAlcohol = itemView.findViewById(R.id.ingredient_has_alcohol);
}
}
}

53
UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/activity_drink.xml

@ -0,0 +1,53 @@
<?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"
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/drink_appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/appbar_padding_top"
android:theme="@style/ToolbarTheme">
<androidx.appcompat.widget.Toolbar
android:id="@+id/drink_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:gravity="center"
app:popupTheme="@style/ToolbarTheme"
app:title="@string/drink_toolbar_title" />
<com.google.android.material.tabs.TabLayout
android:id="@+id/drink_tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
app:tabGravity="fill"
app:tabMode="fixed"
app:tabSelectedTextColor="@color/accent"
app:tabTextColor="@color/iron" />
</com.google.android.material.appbar.AppBarLayout>
<androidx.viewpager.widget.ViewPager
android:id="@+id/drink_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_anchor="@id/drink_appbar"
app:layout_anchorGravity="bottom|start"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/drink_fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:src="@drawable/ic_add_white_24dp"
app:fabSize="normal"
app:layout_behavior="gr.auth.databases.flavours.utils.ScrollAwareFABBehavior" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

53
UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/activity_food.xml

@ -0,0 +1,53 @@
<?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"
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/food_appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/appbar_padding_top"
android:theme="@style/ToolbarTheme">
<androidx.appcompat.widget.Toolbar
android:id="@+id/food_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:gravity="center"
app:popupTheme="@style/ToolbarTheme"
app:title="@string/food_toolbar_title" />
<com.google.android.material.tabs.TabLayout
android:id="@+id/food_tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
app:tabGravity="fill"
app:tabMode="fixed"
app:tabSelectedTextColor="@color/accent"
app:tabTextColor="@color/iron" />
</com.google.android.material.appbar.AppBarLayout>
<androidx.viewpager.widget.ViewPager
android:id="@+id/food_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_anchor="@id/food_appbar"
app:layout_anchorGravity="bottom|start"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/food_fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:src="@drawable/ic_add_white_24dp"
app:fabSize="normal"
app:layout_behavior="gr.auth.databases.flavours.utils.ScrollAwareFABBehavior" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

26
UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/fragment_drink_info.xml

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingStart="12dp"
android:paddingEnd="12dp">
<TextView
android:id="@+id/drink_serving_restaurant"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/drink_serving_restaurant_placeholder" />
<TextView
android:id="@+id/drink_contains_alcohol"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/drink_has_alcohol_placeholder" />
<TextView
android:id="@+id/drink_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/drink_description_placeholder" />
</LinearLayout>

26
UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/fragment_food_info.xml

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingStart="12dp"
android:paddingEnd="12dp">
<TextView
android:id="@+id/food_serving_restaurant"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/food_serving_restaurant_placeholder" />
<TextView
android:id="@+id/food_calories"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/food_calories_placeholder" />
<TextView
android:id="@+id/food_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/food_description_placeholder" />
</LinearLayout>

10
UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/fragment_main_list.xml

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.recyclerview.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_recycler"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:orientation="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />

8
UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/fragment_restaurant_info.xml

@ -8,6 +8,8 @@
android:id="@+id/restaurant_working_hours" android:id="@+id/restaurant_working_hours"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingStart="12dp"
android:paddingEnd="12dp"
android:text="@string/restaurant_working_hours" /> android:text="@string/restaurant_working_hours" />
<TextView <TextView
@ -15,6 +17,8 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="4dp" android:layout_marginTop="4dp"
android:paddingStart="12dp"
android:paddingEnd="12dp"
android:text="@string/restaurant_type" /> android:text="@string/restaurant_type" />
<TextView <TextView
@ -22,6 +26,8 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="4dp" android:layout_marginTop="4dp"
android:paddingStart="12dp"
android:paddingEnd="12dp"
android:text="@string/restaurant_average_rating" /> android:text="@string/restaurant_average_rating" />
<LinearLayout <LinearLayout
@ -30,6 +36,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="4dp" android:layout_marginTop="4dp"
android:orientation="vertical" android:orientation="vertical"
android:paddingStart="12dp"
android:paddingEnd="12dp"
android:visibility="gone" /> android:visibility="gone" />
<com.google.android.gms.maps.MapView <com.google.android.gms.maps.MapView

21
UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/ingredient_row.xml

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:orientation="vertical">
<TextView
android:id="@+id/ingredient_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/ingredient_name_placeholder"
android:textStyle="bold" />
<TextView
android:id="@+id/ingredient_has_alcohol"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/ingredient_has_alcohol_placeholder" />
</LinearLayout>

2
UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/fragment_restaurant_items.xml → UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/reusable_recycler_list.xml

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.recyclerview.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android" <androidx.recyclerview.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/restaurant_list" android:id="@+id/recycler_list"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginStart="12dp" android:layout_marginStart="12dp"

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

@ -51,6 +51,27 @@
<string name="restaurant_row_grade_placeholder">Grade = %1$d/5</string> <string name="restaurant_row_grade_placeholder">Grade = %1$d/5</string>
<string name="restaurant_row_accessibility_placeholder">Accessibility = %1$s</string> <string name="restaurant_row_accessibility_placeholder">Accessibility = %1$s</string>
<!-- Food -->
<string name="food_toolbar_title">Food</string>
<string name="food_serving_restaurant_placeholder">Restaurant</string>
<string name="food_serving_restaurant">Restaurant: %1$s</string>
<string name="food_calories_placeholder">Food calories</string>
<string name="food_calories">Food calories: %1$d</string>
<string name="food_description_placeholder">Food description</string>
<!-- Drink -->
<string name="drink_toolbar_title">Drink</string>
<string name="drink_serving_restaurant_placeholder">Restaurant</string>
<string name="drink_serving_restaurant">Restaurant: %1$s</string>
<string name="drink_has_alcohol_placeholder">Drink has alcohol</string>
<string name="drink_has_alcohol">Drink has alcohol: %1$s</string>
<string name="drink_description_placeholder">Drink description</string>
<!-- Ingredient -->
<string name="ingredient_name_placeholder">Ingredient name</string>
<string name="ingredient_has_alcohol_placeholder">Ingredient contains alcohol</string>
<string name="ingredient_has_alcohol">Ingredient contains alcohol: %1$s</string>
<!-- Add Restaurant --> <!-- Add Restaurant -->
<string name="add_restaurant_toolbar_title">Add Restaurant</string> <string name="add_restaurant_toolbar_title">Add Restaurant</string>
<string name="add_restaurant_hint_name">Restaurant\'s name</string> <string name="add_restaurant_hint_name">Restaurant\'s name</string>

Loading…
Cancel
Save