.
This commit is contained in:
@@ -16,9 +16,9 @@
|
|||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||||
android:fullBackupContent="@xml/backup_rules"
|
android:fullBackupContent="@xml/backup_rules"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@drawable/na_mesa"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@drawable/na_mesa"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/Theme.Pap_teste">
|
android:theme="@style/Theme.Pap_teste">
|
||||||
<activity
|
<activity
|
||||||
|
|||||||
@@ -67,8 +67,9 @@ public class ClientDashboardActivity extends AppCompatActivity {
|
|||||||
cats.add(new FoodCategory("Carnes", R.drawable.cat_carnes));
|
cats.add(new FoodCategory("Carnes", R.drawable.cat_carnes));
|
||||||
cats.add(new FoodCategory("Massas", R.drawable.cat_massas));
|
cats.add(new FoodCategory("Massas", R.drawable.cat_massas));
|
||||||
cats.add(new FoodCategory("Sushi", R.drawable.cat_sushi));
|
cats.add(new FoodCategory("Sushi", R.drawable.cat_sushi));
|
||||||
cats.add(new FoodCategory("Pizzas", R.drawable.cat_pizzas));
|
// Using circle_bg as placeholder for missing images
|
||||||
cats.add(new FoodCategory("Sobremesas", R.drawable.cat_sobremesas));
|
cats.add(new FoodCategory("Pizzas", R.drawable.circle_bg));
|
||||||
|
cats.add(new FoodCategory("Sobremesas", R.drawable.circle_bg));
|
||||||
|
|
||||||
FoodCategoryAdapter adapter = new FoodCategoryAdapter(cats, category -> {
|
FoodCategoryAdapter adapter = new FoodCategoryAdapter(cats, category -> {
|
||||||
Intent intent = new Intent(this, ExplorarRestaurantesActivity.class);
|
Intent intent = new Intent(this, ExplorarRestaurantesActivity.class);
|
||||||
|
|||||||
@@ -4,23 +4,19 @@ import android.view.LayoutInflater;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ReservationOptionAdapter extends RecyclerView.Adapter<ReservationOptionAdapter.ViewHolder> {
|
public class ReservationOptionAdapter extends RecyclerView.Adapter<ReservationOptionAdapter.ViewHolder> {
|
||||||
|
private List<String> options;
|
||||||
|
private OnOptionClickListener listener;
|
||||||
|
|
||||||
public interface OnOptionSelectedListener {
|
public interface OnOptionClickListener {
|
||||||
void onOptionSelected(String option);
|
void onOptionClick(String option);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final List<String> options;
|
public ReservationOptionAdapter(List<String> options, OnOptionClickListener listener) {
|
||||||
private final OnOptionSelectedListener listener;
|
|
||||||
private int selectedPosition = -1;
|
|
||||||
|
|
||||||
public ReservationOptionAdapter(List<String> options, OnOptionSelectedListener listener) {
|
|
||||||
this.options = options;
|
this.options = options;
|
||||||
this.listener = listener;
|
this.listener = listener;
|
||||||
}
|
}
|
||||||
@@ -28,26 +24,17 @@ public class ReservationOptionAdapter extends RecyclerView.Adapter<ReservationOp
|
|||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_reservation_option, parent, false);
|
View view = LayoutInflater.from(parent.getContext()).inflate(android.R.layout.simple_list_item_1, parent, false);
|
||||||
return new ViewHolder(view);
|
return new ViewHolder(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||||
String option = options.get(position);
|
String option = options.get(position);
|
||||||
holder.txtValue.setText(option);
|
holder.text1.setText(option);
|
||||||
|
|
||||||
boolean isSelected = position == selectedPosition;
|
|
||||||
holder.cardRoot.setCardBackgroundColor(isSelected ? 0xFFFF6B6B : 0xFFFFFFFF);
|
|
||||||
holder.txtValue.setTextColor(isSelected ? 0xFFFFFFFF : 0xFF000000);
|
|
||||||
|
|
||||||
holder.itemView.setOnClickListener(v -> {
|
holder.itemView.setOnClickListener(v -> {
|
||||||
int previousSelected = selectedPosition;
|
|
||||||
selectedPosition = holder.getAdapterPosition();
|
|
||||||
notifyItemChanged(previousSelected);
|
|
||||||
notifyItemChanged(selectedPosition);
|
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
listener.onOptionSelected(option);
|
listener.onOptionClick(option);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -58,13 +45,10 @@ public class ReservationOptionAdapter extends RecyclerView.Adapter<ReservationOp
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class ViewHolder extends RecyclerView.ViewHolder {
|
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||||
TextView txtValue;
|
TextView text1;
|
||||||
androidx.cardview.widget.CardView cardRoot;
|
|
||||||
|
|
||||||
public ViewHolder(@NonNull View itemView) {
|
public ViewHolder(@NonNull View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
txtValue = itemView.findViewById(R.id.txtOptionValue);
|
text1 = itemView.findViewById(android.R.id.text1);
|
||||||
cardRoot = itemView.findViewById(R.id.cardOption);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,25 +3,20 @@ package com.example.pap_teste;
|
|||||||
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.ImageButton;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.example.pap_teste.models.Restaurant;
|
import com.example.pap_teste.models.Restaurant;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class RestaurantAdapter extends RecyclerView.Adapter<RestaurantAdapter.ViewHolder> {
|
public class RestaurantAdapter extends RecyclerView.Adapter<RestaurantAdapter.ViewHolder> {
|
||||||
|
private List<Restaurant> restaurants;
|
||||||
|
private OnRestaurantClickListener listener;
|
||||||
|
|
||||||
public interface OnRestaurantClickListener {
|
public interface OnRestaurantClickListener {
|
||||||
void onRestaurantClick(Restaurant restaurant);
|
void onRestaurantClick(Restaurant restaurant);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final List<Restaurant> restaurants;
|
|
||||||
private final OnRestaurantClickListener listener;
|
|
||||||
|
|
||||||
public RestaurantAdapter(List<Restaurant> restaurants, OnRestaurantClickListener listener) {
|
public RestaurantAdapter(List<Restaurant> restaurants, OnRestaurantClickListener listener) {
|
||||||
this.restaurants = restaurants;
|
this.restaurants = restaurants;
|
||||||
this.listener = listener;
|
this.listener = listener;
|
||||||
@@ -30,23 +25,16 @@ public class RestaurantAdapter extends RecyclerView.Adapter<RestaurantAdapter.Vi
|
|||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_restaurant, parent, false);
|
View view = LayoutInflater.from(parent.getContext()).inflate(android.R.layout.simple_list_item_2, parent, false);
|
||||||
return new ViewHolder(view);
|
return new ViewHolder(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||||
Restaurant restaurant = restaurants.get(position);
|
Restaurant restaurant = restaurants.get(position);
|
||||||
holder.txtName.setText(restaurant.getName());
|
holder.text1.setText(restaurant.getName());
|
||||||
holder.txtCategory.setText(restaurant.getCategory());
|
holder.text2.setText(restaurant.getCategory() + (restaurant.isAvailable() ? " - Disponível" : " - Indisponível"));
|
||||||
|
|
||||||
updateFavoriteIcon(holder.btnFavorite, restaurant.isFavorite());
|
|
||||||
|
|
||||||
holder.btnFavorite.setOnClickListener(v -> {
|
|
||||||
restaurant.setFavorite(!restaurant.isFavorite());
|
|
||||||
updateFavoriteIcon(holder.btnFavorite, restaurant.isFavorite());
|
|
||||||
});
|
|
||||||
|
|
||||||
holder.itemView.setOnClickListener(v -> {
|
holder.itemView.setOnClickListener(v -> {
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
listener.onRestaurantClick(restaurant);
|
listener.onRestaurantClick(restaurant);
|
||||||
@@ -54,28 +42,17 @@ public class RestaurantAdapter extends RecyclerView.Adapter<RestaurantAdapter.Vi
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateFavoriteIcon(ImageButton btn, boolean isFavorite) {
|
|
||||||
if (isFavorite) {
|
|
||||||
btn.setImageResource(android.R.drawable.btn_star_big_on);
|
|
||||||
} else {
|
|
||||||
btn.setImageResource(android.R.drawable.btn_star_big_off);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getItemCount() {
|
public int getItemCount() {
|
||||||
return restaurants.size();
|
return restaurants.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ViewHolder extends RecyclerView.ViewHolder {
|
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||||
TextView txtName, txtCategory;
|
TextView text1, text2;
|
||||||
ImageButton btnFavorite;
|
|
||||||
|
|
||||||
public ViewHolder(@NonNull View itemView) {
|
public ViewHolder(@NonNull View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
txtName = itemView.findViewById(R.id.txtRestaurantName);
|
text1 = itemView.findViewById(android.R.id.text1);
|
||||||
txtCategory = itemView.findViewById(R.id.txtRestaurantCategory);
|
text2 = itemView.findViewById(android.R.id.text2);
|
||||||
btnFavorite = itemView.findViewById(R.id.btnFavorite);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,57 +4,17 @@ public class Restaurant {
|
|||||||
private String name;
|
private String name;
|
||||||
private String category;
|
private String category;
|
||||||
private String email;
|
private String email;
|
||||||
private String address;
|
private boolean available;
|
||||||
private boolean isFavorite;
|
|
||||||
|
|
||||||
public Restaurant() {
|
public Restaurant(String name, String category, String email, boolean available) {
|
||||||
// Required for Firebase
|
|
||||||
}
|
|
||||||
|
|
||||||
public Restaurant(String name, String category, String email, boolean isFavorite) {
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.category = category;
|
this.category = category;
|
||||||
this.email = email;
|
this.email = email;
|
||||||
this.isFavorite = isFavorite;
|
this.available = available;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() { return name; }
|
||||||
return name;
|
public String getCategory() { return category; }
|
||||||
}
|
public String getEmail() { return email; }
|
||||||
|
public boolean isAvailable() { return available; }
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCategory() {
|
|
||||||
return category;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCategory(String category) {
|
|
||||||
this.category = category;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEmail() {
|
|
||||||
return email;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEmail(String email) {
|
|
||||||
this.email = email;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAddress() {
|
|
||||||
return address;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAddress(String address) {
|
|
||||||
this.address = address;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isFavorite() {
|
|
||||||
return isFavorite;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFavorite(boolean favorite) {
|
|
||||||
isFavorite = favorite;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -153,8 +153,7 @@
|
|||||||
android:background="@drawable/input_bg"
|
android:background="@drawable/input_bg"
|
||||||
android:hint="Email"
|
android:hint="Email"
|
||||||
android:inputType="textEmailAddress"
|
android:inputType="textEmailAddress"
|
||||||
android:padding="12dp"
|
android:padding="12dp" />
|
||||||
android:text="EstabelecimentoPap@gmail.com" />
|
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/inputOwnerPhone"
|
android:id="@+id/inputOwnerPhone"
|
||||||
@@ -208,8 +207,7 @@
|
|||||||
android:background="@drawable/input_bg"
|
android:background="@drawable/input_bg"
|
||||||
android:hint="Palavra-passe"
|
android:hint="Palavra-passe"
|
||||||
android:inputType="textPassword"
|
android:inputType="textPassword"
|
||||||
android:padding="12dp"
|
android:padding="12dp" />
|
||||||
android:text="PaP@P.1" />
|
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/btnFinalCriarConta"
|
android:id="@+id/btnFinalCriarConta"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
[versions]
|
[versions]
|
||||||
agp = "9.0.1"
|
agp = "9.1.0"
|
||||||
junit = "4.13.2"
|
junit = "4.13.2"
|
||||||
junitVersion = "1.3.0"
|
junitVersion = "1.3.0"
|
||||||
espressoCore = "3.7.0"
|
espressoCore = "3.7.0"
|
||||||
|
|||||||
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,7 +1,7 @@
|
|||||||
#Tue Feb 24 17:05:40 WET 2026
|
#Tue Feb 24 17:05:40 WET 2026
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionSha256Sum=a17ddd85a26b6a7f5ddb71ff8b05fc5104c0202c6e64782429790c933686c806
|
distributionSha256Sum=b266d5ff6b90eada6dc3b20cb090e3731302e553a27c5d3e4df1f0d76beaff06
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|||||||
Reference in New Issue
Block a user