Apostolos Fanakis
6 years ago
21 changed files with 584 additions and 182 deletions
@ -1,8 +1,7 @@ |
|||||
package gr.auth.databases.flavours.activities.restaurant; |
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.MenuItem; |
import android.view.MenuItem; |
||||
import android.view.MotionEvent; |
import android.view.MotionEvent; |
||||
import android.view.View; |
import android.view.View; |
@ -0,0 +1,67 @@ |
|||||
|
package gr.auth.databases.flavours.activities.restaurant.fragments; |
||||
|
|
||||
|
|
||||
|
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.recyclerview.widget.DividerItemDecoration; |
||||
|
import androidx.recyclerview.widget.LinearLayoutManager; |
||||
|
import androidx.recyclerview.widget.RecyclerView; |
||||
|
import gr.auth.databases.flavours.R; |
||||
|
import gr.auth.databases.flavours.base.BaseFragment; |
||||
|
import gr.auth.databases.flavours.model.ItemSummary; |
||||
|
|
||||
|
public class RestaurantDrinksFragment extends BaseFragment { |
||||
|
|
||||
|
public RestaurantDrinksFragment() { |
||||
|
// Required empty public constructor
|
||||
|
} |
||||
|
|
||||
|
private static final String RESTAURANT_ID = "RESTAURANT_ID"; |
||||
|
|
||||
|
private int restaurantId; |
||||
|
|
||||
|
public static RestaurantDrinksFragment newInstance(int restaurantId) { |
||||
|
RestaurantDrinksFragment fragment = new RestaurantDrinksFragment(); |
||||
|
Bundle args = new Bundle(); |
||||
|
args.putInt(RESTAURANT_ID, restaurantId); |
||||
|
fragment.setArguments(args); |
||||
|
return fragment; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onCreate(Bundle savedInstanceState) { |
||||
|
super.onCreate(savedInstanceState); |
||||
|
assert getArguments() != null; |
||||
|
restaurantId = getArguments().getInt(RESTAURANT_ID); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { |
||||
|
final View rootView = inflater.inflate(R.layout.fragment_restaurant_items, container, false); |
||||
|
|
||||
|
ArrayList<ItemSummary> drinks = new ArrayList<>(); |
||||
|
drinks.add(new ItemSummary("White russian", ItemSummary.ItemType.DRINK)); |
||||
|
drinks.add(new ItemSummary("Τσίπουρο Τσάπουρας", ItemSummary.ItemType.DRINK)); |
||||
|
|
||||
|
RestaurantItemAdapter itemAdapter = new RestaurantItemAdapter(fragmentInteractionListener, drinks); |
||||
|
RecyclerView mainContent = rootView.findViewById(R.id.restaurant_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; |
||||
|
} |
||||
|
|
||||
|
public interface RestaurantDrinksFragmentInteractionListener extends FragmentInteractionListener { |
||||
|
void onRestaurantDrinksFragmentInteraction(ItemSummary foodSummary); |
||||
|
} |
||||
|
} |
@ -0,0 +1,66 @@ |
|||||
|
package gr.auth.databases.flavours.activities.restaurant.fragments; |
||||
|
|
||||
|
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.recyclerview.widget.DividerItemDecoration; |
||||
|
import androidx.recyclerview.widget.LinearLayoutManager; |
||||
|
import androidx.recyclerview.widget.RecyclerView; |
||||
|
import gr.auth.databases.flavours.R; |
||||
|
import gr.auth.databases.flavours.base.BaseFragment; |
||||
|
import gr.auth.databases.flavours.model.ItemSummary; |
||||
|
|
||||
|
public class RestaurantFoodsFragment extends BaseFragment { |
||||
|
|
||||
|
public RestaurantFoodsFragment() { |
||||
|
// Required empty public constructor
|
||||
|
} |
||||
|
|
||||
|
private static final String RESTAURANT_ID = "RESTAURANT_ID"; |
||||
|
|
||||
|
private int restaurantId; |
||||
|
|
||||
|
public static RestaurantFoodsFragment newInstance(int restaurantId) { |
||||
|
RestaurantFoodsFragment fragment = new RestaurantFoodsFragment(); |
||||
|
Bundle args = new Bundle(); |
||||
|
args.putInt(RESTAURANT_ID, restaurantId); |
||||
|
fragment.setArguments(args); |
||||
|
return fragment; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onCreate(Bundle savedInstanceState) { |
||||
|
super.onCreate(savedInstanceState); |
||||
|
assert getArguments() != null; |
||||
|
restaurantId = getArguments().getInt(RESTAURANT_ID); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { |
||||
|
final View rootView = inflater.inflate(R.layout.fragment_restaurant_items, container, false); |
||||
|
|
||||
|
ArrayList<ItemSummary> foods = new ArrayList<>(); |
||||
|
foods.add(new ItemSummary("Γιουβαρλάκια", ItemSummary.ItemType.FOOD)); |
||||
|
foods.add(new ItemSummary("Γεμιστά", ItemSummary.ItemType.FOOD)); |
||||
|
|
||||
|
RestaurantItemAdapter itemAdapter = new RestaurantItemAdapter(fragmentInteractionListener, foods); |
||||
|
RecyclerView mainContent = rootView.findViewById(R.id.restaurant_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; |
||||
|
} |
||||
|
|
||||
|
public interface RestaurantFoodsFragmentInteractionListener extends FragmentInteractionListener { |
||||
|
void onRestaurantFoodsFragmentInteraction(ItemSummary foodSummary); |
||||
|
} |
||||
|
} |
@ -1,30 +1,69 @@ |
|||||
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.view.LayoutInflater; |
import android.view.LayoutInflater; |
||||
import android.view.View; |
import android.view.View; |
||||
import android.view.ViewGroup; |
import android.view.ViewGroup; |
||||
|
import android.widget.LinearLayout; |
||||
|
import android.widget.TextView; |
||||
|
|
||||
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 androidx.annotation.NonNull; |
import androidx.annotation.NonNull; |
||||
import androidx.fragment.app.Fragment; |
|
||||
import gr.auth.databases.flavours.R; |
import gr.auth.databases.flavours.R; |
||||
|
import gr.auth.databases.flavours.base.BaseFragment; |
||||
|
|
||||
public class RestaurantMapFragment extends Fragment implements OnMapReadyCallback { |
public class RestaurantInfoFragment extends BaseFragment implements OnMapReadyCallback { |
||||
private MapView gMapView = null; |
private MapView gMapView = null; |
||||
|
|
||||
|
public RestaurantInfoFragment() { |
||||
|
// Required empty public constructor
|
||||
|
} |
||||
|
|
||||
|
private static final String RESTAURANT_ID = "RESTAURANT_ID"; |
||||
|
|
||||
|
private int restaurantId; |
||||
|
|
||||
|
public static RestaurantInfoFragment newInstance(int restaurantId) { |
||||
|
RestaurantInfoFragment fragment = new RestaurantInfoFragment(); |
||||
|
Bundle args = new Bundle(); |
||||
|
args.putInt(RESTAURANT_ID, restaurantId); |
||||
|
fragment.setArguments(args); |
||||
|
return fragment; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onCreate(Bundle savedInstanceState) { |
||||
|
super.onCreate(savedInstanceState); |
||||
|
assert getArguments() != null; |
||||
|
restaurantId = getArguments().getInt(RESTAURANT_ID); |
||||
|
} |
||||
|
|
||||
@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_restaurant_map, container, false); |
final View rootView = inflater.inflate(R.layout.fragment_restaurant_info, container, false); |
||||
|
|
||||
|
TextView workingHours = rootView.findViewById(R.id.restaurant_working_hours); |
||||
|
workingHours.setText(getString(R.string.restaurant_working_hours, |
||||
|
"12:00", "01:30")); |
||||
|
TextView type = rootView.findViewById(R.id.restaurant_type); |
||||
|
type.setText(getString(R.string.restaurant_type, "Bar")); |
||||
|
TextView averageRatings = rootView.findViewById(R.id.restaurant_average_rating); |
||||
|
averageRatings.setText(getString(R.string.restaurant_average_rating, 4.78)); |
||||
|
|
||||
|
LinearLayout averageRatingPerDiet = rootView.findViewById(R.id.restaurant_average_rating_per_diet); |
||||
|
TextView dietRatingView = new TextView(getContext()); |
||||
|
dietRatingView.setText(getString(R.string.restaurant_diet_average_rating, "όγκος", 4.65)); |
||||
|
averageRatingPerDiet.addView(dietRatingView); |
||||
|
dietRatingView = new TextView(getContext()); |
||||
|
dietRatingView.setText(getString(R.string.restaurant_diet_average_rating, "vegan", 2.23)); |
||||
|
averageRatingPerDiet.addView(dietRatingView); |
||||
|
|
||||
gMapView = rootView.findViewById(R.id.restaurant_map); |
gMapView = rootView.findViewById(R.id.restaurant_map); |
||||
gMapView.getMapAsync(this); |
gMapView.getMapAsync(this); |
||||
gMapView.onCreate(getArguments()); |
gMapView.onCreate(getArguments()); |
||||
|
|
||||
return rootView; |
return rootView; |
||||
} |
} |
||||
|
|
@ -0,0 +1,69 @@ |
|||||
|
package gr.auth.databases.flavours.activities.restaurant.fragments; |
||||
|
|
||||
|
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.cardview.widget.CardView; |
||||
|
import androidx.recyclerview.widget.RecyclerView; |
||||
|
import gr.auth.databases.flavours.R; |
||||
|
import gr.auth.databases.flavours.base.BaseFragment; |
||||
|
import gr.auth.databases.flavours.model.ItemSummary; |
||||
|
|
||||
|
public class RestaurantItemAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { |
||||
|
private final RestaurantFoodsFragment.RestaurantFoodsFragmentInteractionListener interactionListener; |
||||
|
private final ArrayList<ItemSummary> items; |
||||
|
|
||||
|
RestaurantItemAdapter(BaseFragment.FragmentInteractionListener interactionListener, |
||||
|
ArrayList<ItemSummary> items) { |
||||
|
this.interactionListener = (RestaurantFoodsFragment.RestaurantFoodsFragmentInteractionListener) interactionListener; |
||||
|
this.items = items; |
||||
|
} |
||||
|
|
||||
|
@NonNull |
||||
|
@Override |
||||
|
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { |
||||
|
View view = LayoutInflater.from(parent.getContext()). |
||||
|
inflate(R.layout.restaurant_item_row, parent, false); |
||||
|
return new ItemViewHolder(view); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onBindViewHolder(@NonNull final RecyclerView.ViewHolder holder, int position) { |
||||
|
ItemSummary item = items.get(position); |
||||
|
ItemViewHolder itemViewHolder = (ItemViewHolder) holder; |
||||
|
|
||||
|
itemViewHolder.card.setOnClickListener(new View.OnClickListener() { |
||||
|
@Override |
||||
|
public void onClick(View view) { |
||||
|
if (interactionListener != null) { |
||||
|
// Notify the active callbacks interface (the activity, if the
|
||||
|
// fragment is attached to one) that an item has been selected.
|
||||
|
interactionListener.onRestaurantFoodsFragmentInteraction(items.get(holder.getAdapterPosition())); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
itemViewHolder.item.setText(item.getItem()); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public int getItemCount() { |
||||
|
return items == null ? 0 : items.size(); |
||||
|
} |
||||
|
|
||||
|
private static class ItemViewHolder extends RecyclerView.ViewHolder { |
||||
|
CardView card; |
||||
|
TextView item; |
||||
|
|
||||
|
ItemViewHolder(View itemView) { |
||||
|
super(itemView); |
||||
|
card = itemView.findViewById(R.id.restaurant_item_row_card); |
||||
|
item = itemView.findViewById(R.id.restaurant_item_row_item); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -1,42 +0,0 @@ |
|||||
package gr.auth.databases.flavours.activities.restaurant.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.activities.restaurant.RestaurantAdapter; |
|
||||
import gr.auth.databases.flavours.model.Rating; |
|
||||
|
|
||||
public class RestaurantListFragment extends Fragment { |
|
||||
private Rating[] ratings = new Rating[7]; |
|
||||
|
|
||||
@Override |
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { |
|
||||
ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_restaurant_list, container, false); |
|
||||
|
|
||||
RecyclerView recyclerView = rootView.findViewById(R.id.restaurant_recycler); |
|
||||
recyclerView.setHasFixedSize(true); |
|
||||
LinearLayoutManager layoutManager = new LinearLayoutManager(getContext()); |
|
||||
recyclerView.setLayoutManager(layoutManager); |
|
||||
|
|
||||
ratings[0] = new Rating(5, "Ανώνυμος", "Πάρα πολύ καλό!", "2018-01-04", Rating.Accessibility.MODERATE); |
|
||||
ratings[1] = new Rating(5, "Ανύπαρκτος", "Εξαιρετικό service.\nΘα ξαναπάω!", "2018-06-08", Rating.Accessibility.EASY); |
|
||||
ratings[2] = new Rating(4, "Γαρδένιος ο Stoner", "-", "2018-06-08", Rating.Accessibility.EASY); |
|
||||
ratings[3] = new Rating(4, "Μαγκούστα", "Μου άρεσε.", "2018-06-08", Rating.Accessibility.MODERATE); |
|
||||
ratings[4] = new Rating(5, "Νταλίκας", "Τέλειο.", "2018-06-08", Rating.Accessibility.EASY); |
|
||||
ratings[5] = new Rating(2, "Ms Godzila", "Το φαϊ άργησε πάρα πολύ!", "2018-06-08", null); |
|
||||
ratings[6] = new Rating(4, "eddie lives inside you", "-", "2018-06-08", Rating.Accessibility.MODERATE); |
|
||||
|
|
||||
RestaurantAdapter restaurantAdapter = new RestaurantAdapter(getContext(), ratings); |
|
||||
recyclerView.setAdapter(restaurantAdapter); |
|
||||
|
|
||||
return rootView; |
|
||||
} |
|
||||
} |
|
@ -0,0 +1,67 @@ |
|||||
|
package gr.auth.databases.flavours.activities.restaurant.fragments; |
||||
|
|
||||
|
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.Rating; |
||||
|
|
||||
|
public class RestaurantRatingsFragment extends Fragment { |
||||
|
|
||||
|
public RestaurantRatingsFragment() { |
||||
|
// Required empty public constructor
|
||||
|
} |
||||
|
|
||||
|
private static final String RESTAURANT_ID = "RESTAURANT_ID"; |
||||
|
|
||||
|
private int restaurantId; |
||||
|
|
||||
|
public static RestaurantRatingsFragment newInstance(int restaurantId) { |
||||
|
RestaurantRatingsFragment fragment = new RestaurantRatingsFragment(); |
||||
|
Bundle args = new Bundle(); |
||||
|
args.putInt(RESTAURANT_ID, restaurantId); |
||||
|
fragment.setArguments(args); |
||||
|
return fragment; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onCreate(Bundle savedInstanceState) { |
||||
|
super.onCreate(savedInstanceState); |
||||
|
assert getArguments() != null; |
||||
|
restaurantId = getArguments().getInt(RESTAURANT_ID); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { |
||||
|
final View rootView = inflater.inflate(R.layout.fragment_restaurant_items, container, false); |
||||
|
|
||||
|
ArrayList<Rating> ratings = new ArrayList<>(); |
||||
|
ratings.add(new Rating(5, "Ανώνυμος", "Πάρα πολύ καλό!", "2018-01-04", Rating.Accessibility.MODERATE)); |
||||
|
ratings.add(new Rating(5, "Ανύπαρκτος", "Εξαιρετικό service.\nΘα ξαναπάω!", "2018-06-08", Rating.Accessibility.EASY)); |
||||
|
ratings.add(new Rating(4, "Γαρδένιος ο Stoner", "-", "2018-06-08", Rating.Accessibility.EASY)); |
||||
|
ratings.add(new Rating(4, "Μαγκούστα", "Μου άρεσε.", "2018-06-08", Rating.Accessibility.MODERATE)); |
||||
|
ratings.add(new Rating(5, "Νταλίκας", "Τέλειο.", "2018-06-08", Rating.Accessibility.EASY)); |
||||
|
ratings.add(new Rating(2, "Ms Godzila", "Το φαϊ άργησε πάρα πολύ!", "2018-06-08", null)); |
||||
|
ratings.add(new Rating(4, "eddie lives inside you", "-", "2018-06-08", Rating.Accessibility.MODERATE)); |
||||
|
|
||||
|
RestaurantRatingsAdapter itemAdapter = new RestaurantRatingsAdapter(getContext(), ratings); |
||||
|
RecyclerView mainContent = rootView.findViewById(R.id.restaurant_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; |
||||
|
} |
||||
|
} |
@ -0,0 +1,53 @@ |
|||||
|
package gr.auth.databases.flavours.base; |
||||
|
|
||||
|
import android.content.Context; |
||||
|
import android.os.Bundle; |
||||
|
|
||||
|
import androidx.annotation.NonNull; |
||||
|
import androidx.annotation.Nullable; |
||||
|
import androidx.fragment.app.Fragment; |
||||
|
import okhttp3.OkHttpClient; |
||||
|
|
||||
|
public abstract class BaseFragment extends Fragment { |
||||
|
protected static final String ARG_SECTION_NUMBER = "SectionNumber"; |
||||
|
protected static final String ARG_TAG = "FragmentTAG"; |
||||
|
|
||||
|
protected FragmentInteractionListener fragmentInteractionListener; |
||||
|
|
||||
|
protected static OkHttpClient client; |
||||
|
|
||||
|
@Override |
||||
|
public void onCreate(@Nullable Bundle savedInstanceState) { |
||||
|
super.onCreate(savedInstanceState); |
||||
|
//int sectionNumber = getArguments().getInt(ARG_SECTION_NUMBER);
|
||||
|
if (client == null) |
||||
|
client = BaseApplication.getInstance().getClient(); //must check every time - e.g.
|
||||
|
// becomes null when app restarts after crash
|
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onAttach(@NonNull Context context) { |
||||
|
super.onAttach(context); |
||||
|
/*if (context instanceof FragmentInteractionListener) { |
||||
|
fragmentInteractionListener = (FragmentInteractionListener) context; |
||||
|
|
||||
|
} else { |
||||
|
throw new RuntimeException(context.toString() |
||||
|
+ " must implement OnFragmentInteractionListener"); |
||||
|
}*/ |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onDetach() { |
||||
|
super.onDetach(); |
||||
|
fragmentInteractionListener = null; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* This interface MUST be extended by the fragment subclass AND implemented by |
||||
|
* the activity that contains it, to allow communication upon interaction, |
||||
|
* between the fragment and the activity/ other fragments |
||||
|
*/ |
||||
|
public interface FragmentInteractionListener { |
||||
|
} |
||||
|
} |
@ -0,0 +1,23 @@ |
|||||
|
package gr.auth.databases.flavours.model; |
||||
|
|
||||
|
public class ItemSummary { |
||||
|
public enum ItemType { |
||||
|
FOOD, DRINK |
||||
|
} |
||||
|
|
||||
|
private String item; |
||||
|
private ItemType type; |
||||
|
|
||||
|
public ItemSummary(String item, ItemType type) { |
||||
|
this.item = item; |
||||
|
this.type = type; |
||||
|
} |
||||
|
|
||||
|
public String getItem() { |
||||
|
return item; |
||||
|
} |
||||
|
|
||||
|
public ItemType getType() { |
||||
|
return type; |
||||
|
} |
||||
|
} |
@ -0,0 +1,42 @@ |
|||||
|
<?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"> |
||||
|
|
||||
|
<TextView |
||||
|
android:id="@+id/restaurant_working_hours" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:text="@string/restaurant_working_hours" /> |
||||
|
|
||||
|
<TextView |
||||
|
android:id="@+id/restaurant_type" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_marginTop="4dp" |
||||
|
android:text="@string/restaurant_type" /> |
||||
|
|
||||
|
<TextView |
||||
|
android:id="@+id/restaurant_average_rating" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_marginTop="4dp" |
||||
|
android:text="@string/restaurant_average_rating" /> |
||||
|
|
||||
|
<LinearLayout |
||||
|
android:id="@+id/restaurant_average_rating_per_diet" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_marginTop="4dp" |
||||
|
android:orientation="vertical" |
||||
|
android:visibility="gone" /> |
||||
|
|
||||
|
<com.google.android.gms.maps.MapView |
||||
|
android:id="@+id/restaurant_map" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="0dp" |
||||
|
android:layout_marginTop="6dp" |
||||
|
android:layout_marginBottom="12dp" |
||||
|
android:layout_weight="1" /> |
||||
|
</LinearLayout> |
@ -1,10 +1,8 @@ |
|||||
<?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" |
||||
xmlns:app="http://schemas.android.com/apk/res-auto" |
android:id="@+id/restaurant_list" |
||||
android:id="@+id/restaurant_recycler" |
|
||||
android:layout_width="match_parent" |
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
android:layout_height="match_parent" |
||||
android:layout_marginStart="12dp" |
android:layout_marginStart="12dp" |
||||
android:layout_marginEnd="12dp" |
android:layout_marginEnd="12dp" |
||||
android:orientation="vertical" |
android:orientation="vertical" /> |
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior" /> |
|
@ -1,5 +0,0 @@ |
|||||
<?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/restaurant_map" |
|
||||
android:layout_width="match_parent" |
|
||||
android:layout_height="match_parent" /> |
|
@ -0,0 +1,20 @@ |
|||||
|
<?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:id="@+id/restaurant_item_row_card" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_gravity="center" |
||||
|
android:layout_marginStart="8dp" |
||||
|
android:layout_marginEnd="8dp" |
||||
|
android:foreground="?android:attr/selectableItemBackground" |
||||
|
card_view:cardCornerRadius="5dp" |
||||
|
card_view:cardElevation="2dp" |
||||
|
card_view:cardPreventCornerOverlap="false" |
||||
|
card_view:cardUseCompatPadding="true"> |
||||
|
|
||||
|
<TextView |
||||
|
android:id="@+id/restaurant_item_row_item" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="wrap_content" /> |
||||
|
</androidx.cardview.widget.CardView> |
@ -0,0 +1,4 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<resources> |
||||
|
<dimen name="appbar_padding_top">8dp</dimen> |
||||
|
</resources> |
Loading…
Reference in new issue