Skip to main content

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.

La Casa del Bordadito is a single-module Android app built entirely with Kotlin, using Firebase as its backend. The project follows a feature-based package layout: each domain area (café menu, embroidery canvas, shopping cart, chat, etc.) lives in its own package and owns its activities, adapters, and data models. A shared ApplicationClass bootstraps cross-cutting concerns — online presence tracking and OneSignal push notifications — before any activity starts. The app entry point is OpcionesLogin (the launcher activity). After a user authenticates, MainActivity becomes the host for all primary navigation via a BottomNavigationView with five items. Four of those items load a Fragment directly into MainActivity; the fifth item (Taller) launches TallerActivity as a standalone screen.

FragmentInicio

Home screen with a promotional image slider and quick-access cards for featured café items.

FragmentCafe

Café menu browser, filterable by category, with add-to-cart and item detail navigation.

FragmentBordado

Embroidery canvas — loads cross-stitch patterns from Realtime Database and renders them on a custom BordadoCanvasView.

FragmentCuenta

Account hub for regular users (profile, payment methods, order history) and for admins (menu management, pattern management, workshop management).
TallerActivity is a standalone screen launched from the bottom-navigation area to display workshop information and flyers stored in Firebase Storage.

Activities

The full list of activities declared in AndroidManifest.xml:
ActivityPurpose
OpcionesLoginLauncher — choose Email or Google sign-in
Login_emailEmail + password sign-in form
Registro_emailNew account registration
VerificarEmailActivityEmail verification gate
MainActivityPrimary host with BottomNavigationView
DetalleCafeActivityFull detail view for a café item
CarritoActivityShopping cart review and checkout
QRActivityQR code display for order confirmation
HistorialActivityOrder history list
HistorialDetalleActivityOrder detail view
ChatActivityReal-time 1-on-1 chat screen
ListaChatActivityList of all chat conversations
EditarPerfilEdit display name and profile photo
TarjetaAgregarActivityAdd a new credit/debit card
AgregarCafeActivityAdmin: create or edit a café item
TallerActivityWorkshop info and flyer viewer

Fragments

FragmentNav itemResponsibility
FragmentInicioInicio (1st)Home slider and featured items
FragmentCafeCafe (2nd)Browsable café menu with category filter
FragmentBordadoBordado (4th)Cross-stitch pattern canvas
FragmentCuentaCuenta (5th)Account settings and admin tools
The third nav item (Taller) is not backed by a Fragment — it launches TallerActivity directly.

Firebase backend services

Firebase Authentication

Manages user identity with Email/Password and Google Sign-In providers. The UID from FirebaseAuth is used as the primary key across all other Firebase services.

Firestore

Stores structured catalogue data: café items (cafes), per-user shopping carts (carritos), and placed orders (ordenes).

Realtime Database

Stores user profiles (Usuarios), chat messages (Chats), unread counts (ChatsUnreadCount), embroidery patterns (patrones), and workshop info (TallerInfo).

Firebase Storage

Hosts profile photos, images sent in chat, and the workshop promotional flyer.
OneSignal is used for push notifications. It is initialized in ApplicationClass and makes direct REST calls to the OneSignal API via OkHttp (see Notifications).

ApplicationClass

ApplicationClass extends Android’s Application class and is declared as the app-level android:name in AndroidManifest.xml. It runs two things at startup:
  1. OneSignal SDK initialization — reads BuildConfig.ONESIGNAL_APP_ID and calls OneSignal.initWithContext(), then requests notification permission on a background coroutine.
  2. Online-presence tracking — registers ActivityLifecycleCallbacks to write online = true to Realtime Database when the app comes to the foreground, and online = false when it goes to the background.
class ApplicationClass : Application() {

    private val ONESIGNAL_APP_ID = BuildConfig.ONESIGNAL_APP_ID
    private var startedActivities = 0
    private var isChangingConfig = false

    override fun onCreate() {
        super.onCreate()

        OneSignal.Debug.logLevel = LogLevel.VERBOSE
        OneSignal.initWithContext(this, ONESIGNAL_APP_ID)

        CoroutineScope(Dispatchers.IO).launch {
            OneSignal.Notifications.requestPermission(false)
        }

        registerActivityLifecycleCallbacks(object : ActivityLifecycleCallbacks {
            override fun onActivityStarted(activity: Activity) {
                if (startedActivities == 0 && !isChangingConfig) {
                    actualizarEstadoOnline(true)
                }
                startedActivities++
            }

            override fun onActivityStopped(activity: Activity) {
                isChangingConfig = activity.isChangingConfigurations
                startedActivities--
                if (startedActivities == 0 && !isChangingConfig) {
                    actualizarEstadoOnline(false)
                }
            }
            // ... other no-op overrides
        })
    }

    companion object {
        fun actualizarEstadoOnline(online: Boolean) {
            val uid = FirebaseAuth.getInstance().uid ?: return
            val ref = FirebaseDatabase.getInstance().getReference("Usuarios").child(uid)
            if (online) {
                ref.child("online").setValue(true)
                ref.child("online").onDisconnect().setValue(false)
            } else {
                ref.child("online").setValue(false)
            }
        }
    }
}
The onDisconnect().setValue(false) call ensures the online flag is cleared even if the device loses connectivity without gracefully stopping the app.

Constantes object

Constantes is a Kotlin object (singleton) that centralises shared utility functions and message-type constants used across the codebase.
object Constantes {

    const val MENSAJE_TIPO_TEXTO  = "TEXTO"
    const val MENSAJE_TIPO_IMAGEN = "IMAGEN"

    fun obtenerTiempoDis(): Long = System.currentTimeMillis()

    fun obtenerFecha(tiempo: Long): String {
        val calendario = Calendar.getInstance(Locale.ENGLISH)
        calendario.timeInMillis = tiempo
        return DateFormat.format("dd/MM/yyyy", calendario).toString()
    }

    fun obtenerFechaHora(tiempo: Long): String {
        val calendar = Calendar.getInstance(Locale.ENGLISH)
        calendar.timeInMillis = tiempo
        return DateFormat.format("dd/MM/yyyy hh:mm:a", calendar).toString()
    }

    fun rutaChat(receptorUid: String, emisorUid: String): String {
        val arrayUid = arrayOf(receptorUid, emisorUid)
        Arrays.sort(arrayUid)
        return "${arrayUid[0]}_${arrayUid[1]}"
    }
}
  • MENSAJE_TIPO_TEXTO / MENSAJE_TIPO_IMAGEN — type discriminators stored in each Chat document.
  • obtenerFecha / obtenerFechaHora — format epoch milliseconds for display in the order history and chat UI.
  • rutaChat — deterministically generates a shared chat room path for any two users (see Data Model).

Package structure

com.example.applacasadelbordadito/
├── Adaptadores/          # AdaptadorChat, AdaptadorUsuario
├── Bordado/              # PatronBordado model, BordadoCanvasView, adapters
├── Cafe/                 # Cafe model, AgregarCafeActivity, adapters
├── Carrito/              # CarritoItem model, CarritoActivity, QRActivity
├── Chat/                 # ChatActivity, ListaChatActivity
├── Fragmentos/           # FragmentInicio, FragmentCafe, FragmentBordado, FragmentCuenta
├── Historial/            # Orden model, HistorialActivity, HistorialDetalleActivity
├── Modelos/              # Usuario, Chat (message model)
├── Notificaciones/       # FcmUtil
├── Opciones_Login/       # Login_email
├── Perfil/               # PaymentMethod, EditarPerfil, TarjetaAgregarActivity
├── Taller/               # TallerActivity
├── ApplicationClass.kt
├── Constantes.kt
├── MainActivity.kt
├── OpcionesLogin.kt
├── Registro_email.kt
└── VerificarEmailActivity.kt
The Firebase Functions file (functions/index.js) is present in the repository and contains a welcome-email function (enviarCorreoBienvenida) triggered by a Realtime Database onCreate event on the /Usuarios/{uid} path, but it is not currently deployed. All core business logic — cart management, order placement, notification dispatch — runs client-side in the Android app.

Build docs developers (and LLMs) love