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