Browse Source

Add restaurants list

master
Apostolos Fanakis 6 years ago
parent
commit
f0b7873576
  1. 1
      UI/AndroidApp/flavoursWithoutBorders/app/build.gradle
  2. 2
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/AndroidManifest.xml
  3. 1
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/LoginActivity.java
  4. 156
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/main/MainActivity.java
  5. 83
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/main/MainAdapter.java
  6. 47
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/main/fragments/MainListFragment.java
  7. 105
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/main/fragments/MainMapFragment.java
  8. 28
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/model/Restaurant.java
  9. BIN
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/drawable-hdpi/ic_filter_list_black_24dp.png
  10. BIN
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/drawable-mdpi/ic_filter_list_black_24dp.png
  11. BIN
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/drawable-xhdpi/ic_filter_list_black_24dp.png
  12. BIN
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/drawable-xxhdpi/ic_filter_list_black_24dp.png
  13. BIN
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/drawable-xxxhdpi/ic_filter_list_black_24dp.png
  14. 39
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/activity_main.xml
  15. 57
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/activity_main_list_row.xml
  16. 8
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/fragment_main_list.xml
  17. 5
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/fragment_main_map.xml
  18. 8
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/map_view.xml
  19. 6
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/menu_item_main_map.xml
  20. 19
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/menu/main_tollbar_menu.xml
  21. 17
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/values/strings.xml

1
UI/AndroidApp/flavoursWithoutBorders/app/build.gradle

@ -25,6 +25,7 @@ dependencies {
implementation 'androidx.preference:preference:1.1.0-alpha02'
implementation 'androidx.legacy:legacy-preference-v14:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'

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

@ -39,7 +39,7 @@
android:value="@string/google_maps_key" />
<activity
android:name=".MainActivity"
android:name=".main.MainActivity"
android:label="@string/title_activity_main"></activity>
</application>

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

@ -5,6 +5,7 @@ import android.os.Bundle;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity;
import gr.auth.databases.flavours.main.MainActivity;
public class LoginActivity extends AppCompatActivity {

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

@ -0,0 +1,156 @@
package gr.auth.databases.flavours.main;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.DecelerateInterpolator;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;
import androidx.viewpager.widget.PagerAdapter;
import androidx.viewpager.widget.ViewPager;
import gr.auth.databases.flavours.R;
import gr.auth.databases.flavours.main.fragments.MainListFragment;
import gr.auth.databases.flavours.main.fragments.MainMapFragment;
public class MainActivity extends AppCompatActivity {
private static final int NUM_PAGES = 2;
private ViewPager viewPager;
private MenuItem menuMapItem;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = findViewById(R.id.main_toolbar);
toolbar.setTitle("Restaurants");
setSupportActionBar(toolbar);
final Animation fadeIn = new AlphaAnimation(0, 1);
fadeIn.setInterpolator(new DecelerateInterpolator());
fadeIn.setDuration(700);
fadeIn.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
menuMapItem.setVisible(true);
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
menuMapItem.setVisible(true);
}
});
final Animation fadeOut = new AlphaAnimation(1, 0);
fadeOut.setInterpolator(new AccelerateInterpolator());
fadeOut.setStartOffset(100);
fadeOut.setDuration(700);
fadeOut.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
menuMapItem.setVisible(false);
}
});
viewPager = findViewById(R.id.main_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 (menuMapItem == null) {
return;
}
if (position == 0) {
menuMapItem.setVisible(true);
menuMapItem.getActionView().startAnimation(fadeIn);
} else {
menuMapItem.getActionView().startAnimation(fadeOut);
}
}
});
PagerAdapter pagerAdapter = new MainPagerAdapter(getSupportFragmentManager());
viewPager.setAdapter(pagerAdapter);
}
@Override
public void onBackPressed() {
if (viewPager.getCurrentItem() == 0) {
super.onBackPressed();
} else {
viewPager.setCurrentItem(0);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main_tollbar_menu, menu);
menuMapItem = menu.findItem(R.id.main_toolbar_menu_map);
View view = getLayoutInflater().inflate(R.layout.menu_item_main_map, null);
menuMapItem.setActionView(view);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.main_toolbar_menu_filter) {
return true;
} else if (id == R.id.main_toolbar_menu_map) {
viewPager.setCurrentItem(1);
return true;
}
return super.onOptionsItemSelected(item);
}
private class MainPagerAdapter extends FragmentStatePagerAdapter {
MainPagerAdapter(FragmentManager fm) {
super(fm);
}
@NonNull
@Override
public Fragment getItem(int position) {
if (position == 0) {
return new MainListFragment();
} else {
return new MainMapFragment();
}
}
@Override
public int getCount() {
return NUM_PAGES;
}
}
}

83
UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/main/MainAdapter.java

@ -0,0 +1,83 @@
package gr.auth.databases.flavours.main;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import gr.auth.databases.flavours.R;
import gr.auth.databases.flavours.model.Restaurant;
public class MainAdapter extends RecyclerView.Adapter<MainAdapter.RestaurantViewHolder> {
private Context context;
private Restaurant[] restaurants;
public MainAdapter(Context context, Restaurant[] restaurants) {
this.context = context;
this.restaurants = restaurants;
}
@NonNull
@Override
public MainAdapter.RestaurantViewHolder onCreateViewHolder(@NonNull ViewGroup parent,
int viewType) {
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.activity_main_list_row,
parent, false);
return new RestaurantViewHolder(v);
}
@Override
public void onBindViewHolder(@NonNull RestaurantViewHolder holder, int position) {
holder.name.setText(restaurants[position].getName());
holder.workingHours.setText(context.getString(R.string.main_row_working_hours_placeholder,
restaurants[position].getOpeningTime().substring(0,5),
restaurants[position].getClosingTime().substring(0,5)));
if (restaurants[position].getType().equals("restaurant")) {
holder.typeImage.setImageResource(R.drawable.restaurant_marker);
holder.typeText.setText(context.getResources().getString(R.string.main_restaurant_type));
}
if (restaurants[position].getType().equals("bar")) {
holder.typeImage.setImageResource(R.drawable.bar_marker);
holder.typeText.setText(context.getResources().getString(R.string.main_bar_type));
}
if (restaurants[position].getType().equals("cafeteria")) {
holder.typeImage.setImageResource(R.drawable.cafeteria_marker);
holder.typeText.setText(context.getResources().getString(R.string.main_cafeteria_type));
}
if (restaurants[position].getType().equals("pub")) {
holder.typeImage.setImageResource(R.drawable.pub_marker);
holder.typeText.setText(context.getResources().getString(R.string.main_pub_type));
}
if (restaurants[position].getType().equals("fast_food")) {
holder.typeImage.setImageResource(R.drawable.fast_food_marker);
holder.typeText.setText(context.getResources().getString(R.string.main_fast_food_type));
}
if (restaurants[position].getType().equals("ethnic")) {
holder.typeImage.setImageResource(R.drawable.restaurant_marker);
holder.typeText.setText(context.getResources().getString(R.string.main_ethnic_type));
}
}
@Override
public int getItemCount() {
return restaurants.length;
}
static class RestaurantViewHolder extends RecyclerView.ViewHolder {
TextView name, typeText, workingHours;
ImageView typeImage;
RestaurantViewHolder(View v) {
super(v);
name = v.findViewById(R.id.main_row_name);
typeText = v.findViewById(R.id.main_row_type_txt);
workingHours = v.findViewById(R.id.main_row_working_hours);
typeImage = v.findViewById(R.id.main_row_type_img);
}
}
}

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

@ -0,0 +1,47 @@
package gr.auth.databases.flavours.main.fragments;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import gr.auth.databases.flavours.R;
import gr.auth.databases.flavours.main.MainAdapter;
import gr.auth.databases.flavours.model.Restaurant;
public class MainListFragment extends Fragment {
private Restaurant[] restaurants = new Restaurant[13];
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_main_list, container, false);
RecyclerView recyclerView = rootView.findViewById(R.id.main_recycler);
recyclerView.setHasFixedSize(true);
LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
recyclerView.setLayoutManager(layoutManager);
restaurants[0] = new Restaurant("U Fleků", "pub", "18:00:00", "04:00:00");
restaurants[1] = new Restaurant("Σ σύγχρονα εστιατόρια", "restaurant", "12:00:00", "22:00:00");
restaurants[2] = new Restaurant("U Fleků Garden", "pub", "18:00:00", "02:00:00");
restaurants[3] = new Restaurant("McDonald\'s", "fast_food", "12:00:00", "23:59:00");
restaurants[4] = new Restaurant("Grill 15", "fast_food", "12:00:00", "01:30:00");
restaurants[5] = new Restaurant("Butterflies and Hurricanes", "cafeteria", "08:00:00", "20:00:00");
restaurants[6] = new Restaurant("The Hoppy Pub", "pub", "17:30:00", "01:30:00");
restaurants[7] = new Restaurant("Belleville sin patron", "bar", "12:00:00", "02:00:00");
restaurants[8] = new Restaurant("Αιθερόπλοο", "pub", "08:00:00", "02:00:00");
restaurants[9] = new Restaurant("Οδυσσέας", "restaurant", "12:30:00", "18:00:00");
restaurants[10] = new Restaurant("Pulp", "bar", "09:00:00", "23:59:00");
restaurants[11] = new Restaurant("McDonald\'s", "fast_food", "12:00:00", "23:59:00");
restaurants[12] = new Restaurant("Γιαννούλα", "restaurant", "13:30:00", "01:00:00");
MainAdapter mainAdapter = new MainAdapter(getContext(), restaurants);
recyclerView.setAdapter(mainAdapter);
return rootView;
}
}

105
UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/MainActivity.java → UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/main/fragments/MainMapFragment.java

@ -1,32 +1,81 @@
package gr.auth.databases.flavours;
package gr.auth.databases.flavours.main.fragments;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapView;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
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.fragment.app.FragmentActivity;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import gr.auth.databases.flavours.R;
public class MainActivity extends FragmentActivity implements OnMapReadyCallback {
public class MainMapFragment extends Fragment implements OnMapReadyCallback {
private MapView gMapView = null;
private GoogleMap mMap;
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_main_map, container, false);
gMapView = rootView.findViewById(R.id.main_map);
gMapView.getMapAsync(this);
gMapView.onCreate(getArguments());
return rootView;
}
@Override
public void onResume() {
super.onResume();
if (gMapView != null) {
gMapView.onResume();
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
public void onDestroy() {
super.onDestroy();
if (gMapView != null) {
gMapView.onDestroy();
}
}
@Override
public void onStart() {
super.onStart();
if (gMapView != null) {
gMapView.onStart();
}
}
@Override
public void onStop() {
super.onStop();
if (gMapView != null) {
gMapView.onStop();
}
}
@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
if (gMapView != null) {
gMapView.onSaveInstanceState(outState);
}
}
/**
* Manipulates the map once available.
@ -39,8 +88,6 @@ public class MainActivity extends FragmentActivity implements OnMapReadyCallback
*/
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
// Add markers and move the camera
LatLng uFleku = new LatLng(40.6357, 22.9367);
LatLng sSyxronaEstiatoria = new LatLng(40.6173, 22.9597);
@ -56,58 +103,58 @@ public class MainActivity extends FragmentActivity implements OnMapReadyCallback
LatLng mcDonalds2 = new LatLng(40.5745, 22.9715);
LatLng gianoula = new LatLng(40.64, 22.9468);
mMap.addMarker(new MarkerOptions()
googleMap.addMarker(new MarkerOptions()
.position(uFleku)
.title("U Fleků")
.icon(BitmapDescriptorFactory.fromResource(R.drawable.pub_marker)));
mMap.addMarker(new MarkerOptions()
googleMap.addMarker(new MarkerOptions()
.position(sSyxronaEstiatoria)
.title("Σ σύγχρονα εστιατόρια")
.icon(BitmapDescriptorFactory.fromResource(R.drawable.restaurant_marker)));
mMap.addMarker(new MarkerOptions()
googleMap.addMarker(new MarkerOptions()
.position(uFlekuGarden)
.title("U Fleků Garden")
.icon(BitmapDescriptorFactory.fromResource(R.drawable.pub_marker)));
mMap.addMarker(new MarkerOptions()
googleMap.addMarker(new MarkerOptions()
.position(mcDonalds)
.title("McDonald\'s")
.icon(BitmapDescriptorFactory.fromResource(R.drawable.fast_food_marker)));
mMap.addMarker(new MarkerOptions()
googleMap.addMarker(new MarkerOptions()
.position(grill15)
.title("Grill 15")
.icon(BitmapDescriptorFactory.fromResource(R.drawable.fast_food_marker)));
mMap.addMarker(new MarkerOptions()
googleMap.addMarker(new MarkerOptions()
.position(butterfliesAndHurricanes)
.title("Butterflies and Hurricanes")
.icon(BitmapDescriptorFactory.fromResource(R.drawable.cafeteria_marker)));
mMap.addMarker(new MarkerOptions()
googleMap.addMarker(new MarkerOptions()
.position(theHoppyPub)
.title("The Hoppy Pub")
.icon(BitmapDescriptorFactory.fromResource(R.drawable.pub_marker)));
mMap.addMarker(new MarkerOptions()
googleMap.addMarker(new MarkerOptions()
.position(bellevilleSinPatron)
.title("Belleville sin patron")
.icon(BitmapDescriptorFactory.fromResource(R.drawable.bar_marker)));
mMap.addMarker(new MarkerOptions()
googleMap.addMarker(new MarkerOptions()
.position(aitheroploo)
.title("Αιθερόπλοο")
.icon(BitmapDescriptorFactory.fromResource(R.drawable.pub_marker)));
mMap.addMarker(new MarkerOptions()
googleMap.addMarker(new MarkerOptions()
.position(odysseas)
.title("Οδυσσέας")
.icon(BitmapDescriptorFactory.fromResource(R.drawable.restaurant_marker)));
mMap.addMarker(new MarkerOptions()
googleMap.addMarker(new MarkerOptions()
.position(pulp)
.title("Pulp")
.icon(BitmapDescriptorFactory.fromResource(R.drawable.bar_marker)));
mMap.addMarker(new MarkerOptions()
googleMap.addMarker(new MarkerOptions()
.position(mcDonalds2)
.title("McDonald\'s")
.icon(BitmapDescriptorFactory.fromResource(R.drawable.fast_food_marker)));
mMap.addMarker(new MarkerOptions()
googleMap.addMarker(new MarkerOptions()
.position(gianoula)
.title("Γιαννούλα")
.icon(BitmapDescriptorFactory.fromResource(R.drawable.restaurant_marker)));
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(grill15, 12.0f));
googleMap.animateCamera(CameraUpdateFactory.newLatLngZoom(grill15, 12.0f));
}
}

28
UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/model/Restaurant.java

@ -0,0 +1,28 @@
package gr.auth.databases.flavours.model;
public class Restaurant {
private final String name, type, openingTime, closingTime;
public Restaurant(String name, String type, String openingTime, String closingTime) {
this.name = name;
this.type= type;
this.openingTime = openingTime;
this.closingTime = closingTime;
}
public String getName() {
return name;
}
public String getType() {
return type;
}
public String getOpeningTime() {
return openingTime;
}
public String getClosingTime() {
return closingTime;
}
}

BIN
UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/drawable-hdpi/ic_filter_list_black_24dp.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 B

BIN
UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/drawable-mdpi/ic_filter_list_black_24dp.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 B

BIN
UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/drawable-xhdpi/ic_filter_list_black_24dp.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 B

BIN
UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/drawable-xxhdpi/ic_filter_list_black_24dp.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 B

BIN
UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/drawable-xxxhdpi/ic_filter_list_black_24dp.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 B

39
UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/activity_main.xml

@ -1,9 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
<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"
tools:context=".MainActivity" />
android:background="@android:color/background_light"
android:fitsSystemWindows="true">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/main_appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/Theme.AppCompat.Light">
<androidx.appcompat.widget.Toolbar
android:id="@+id/main_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/Theme.AppCompat.Light" />
</com.google.android.material.appbar.AppBarLayout>
<androidx.viewpager.widget.ViewPager
android:id="@+id/main_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_anchor="@id/main_appbar"
app:layout_anchorGravity="bottom|start"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_anchor="@id/main_appbar"
app:layout_anchorGravity="bottom|right|end" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

57
UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/activity_main_list_row.xml

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:foreground="?android:attr/selectableItemBackground"
card_view:cardCornerRadius="5dp"
card_view:cardElevation="1dp"
card_view:cardPreventCornerOverlap="false"
card_view:cardUseCompatPadding="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingStart="2dp"
android:paddingTop="6dp"
android:paddingEnd="4dp"
android:paddingBottom="6dp">
<ImageView
android:id="@+id/main_row_type_img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/main_row_type" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_weight="0.5"
android:orientation="vertical">
<TextView
android:id="@+id/main_row_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:text="@string/main_row_name"
android:textStyle="bold" />
<TextView
android:id="@+id/main_row_working_hours"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/main_row_working_hours" />
</LinearLayout>
<TextView
android:id="@+id/main_row_type_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/main_row_type"
android:textColor="@color/colorAccent" />
</LinearLayout>
</androidx.cardview.widget.CardView>

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

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.recyclerview.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
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" />

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

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.gms.maps.MapView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/main_map"
android:layout_width="match_parent"
android:layout_height="match_parent" />

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

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".main.MainActivity" />

6
UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/menu_item_main_map.xml

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.AppCompatImageButton xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/main_toolbar_menu_map"
android:src="@drawable/ic_map_black_24dp" />

19
UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/menu/main_tollbar_menu.xml

@ -0,0 +1,19 @@
<?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=".main.MainActivity">
<item
android:id="@+id/main_toolbar_menu_filter"
android:icon="@drawable/ic_filter_list_black_24dp"
android:orderInCategory="100"
android:title="@string/main_toolbar_menu_filter"
app:showAsAction="ifRoom" />
<item
android:id="@+id/main_toolbar_menu_map"
android:icon="@drawable/ic_map_black_24dp"
android:orderInCategory="200"
android:title="@string/main_toolbar_menu_map"
app:actionViewClass="androidx.appcompat.widget.AppCompatImageButton"
app:showAsAction="ifRoom" />
</menu>

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

@ -17,4 +17,21 @@
<string name="sign_up_btn_sign_up">SIGN UP</string>
<string name="sign_up_btn_go_to_login">or login</string>
<string name="title_activity_main">Main</string>
<!-- Main -->
<string name="main_toolbar_menu_filter">Filter results</string>
<string name="main_toolbar_menu_map">Show in map</string>
<string name="main_restaurant_type">Restaurant</string>
<string name="main_bar_type">Bar</string>
<string name="main_cafeteria_type">Cafeteria</string>
<string name="main_pub_type">Pub</string>
<string name="main_fast_food_type">Fast food</string>
<string name="main_ethnic_type">Ethnic</string>
<!-- Main row -->
<string name="main_row_name">Restaurant name</string>
<string name="main_row_type">Restaurant type</string>
<string name="main_row_working_hours">Restaurant working hours</string>
<string name="main_row_working_hours_placeholder">%1$s - %2$s</string>
</resources>

Loading…
Cancel
Save