The Café fragment is the heart of the ordering experience in La Casa del Bordadito. The dedicated Café tab (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/AndresLopezCorrales/La-casa-del-bordadito/llms.txt
Use this file to discover all available pages before exploring further.
FragmentCafe) attaches a real-time Firestore snapshot listener filtered to isActive = true, so the menu always reflects what is actually available at the café today. Each item can be viewed either as a compact card in a two-column grid or as a detailed row in a scrollable list, and a toggle button lets you switch between those modes at any time.
Cafe data model
Every document in thecafes Firestore collection maps to the following Kotlin data class:
| Field | Type | Description |
|---|---|---|
id | String | Firestore document ID, assigned after fetch |
nombre | String | Display name of the item |
descripcion | String | Short description shown in list view |
imagenUrl | String | Remote image URL loaded via Coil |
categoria | String | Category label (e.g. “Bebida caliente”) |
tamano | Map<String, Double> | Size name → price in MXN |
isActive | Boolean | Visibility flag; only true items appear in the menu |
Sample Firestore document
View modes
The fragment ships two adapters that are swapped live by aMaterialButtonToggleGroup:
Grid view
Powered by
CafeInicioAdapter with a two-column GridLayoutManager. Each card shows the item image, name, and a quick add-to-cart button (btnAddCafe). Tapping the card itself opens DetalleCafeActivity.List view
Powered by
CafeAdapter with a LinearLayoutManager. Each row shows the image, name, and full description. Tapping the row opens DetalleCafeActivity.Filtering active items
Both fragments load only items whereisActive equals true. The dedicated Café tab (FragmentCafe) uses a snapshot listener for live updates:
isActive flag is reflected on the customer’s screen in FragmentCafe without a manual refresh. The home screen (FragmentInicio) performs a one-time .get() fetch on load instead and will reflect admin changes on the next visit.
Quick add from the home screen
FragmentInicio also uses CafeInicioAdapter in its café section. Tapping the + button on any card from the home screen calls anadirAlCarrito, which picks the first size in the tamano map as the default and writes a CarritoItem to carritos/{uid}/items in Firestore immediately — no need to visit DetalleCafeActivity first.
Size selection in the detail screen
Opening an item navigates toDetalleCafeActivity, which loads the full Cafe document from Firestore using the cafeId passed as an intent extra. The tamano map is iterated to build a RadioGroup where each RadioButton stores a Pair<String, Double> (size name, price) as its tag:
CarritoItem with the chosen tamano and precio, writes it to carritos/{uid}/items/{cafeId}_{tamano}, and navigates straight to CarritoActivity.
Items with
isActive = false are hidden from all customer-facing views — the menu query and the home screen quick-add grid both filter them out. The documents remain in Firestore so an admin can reactivate them at any time without re-entering the data.