# kowshiq006/imable architecture

> Architecture diagram of the GitHub repository kowshiq006/imable, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kowshiq006/imable
- Repository: https://github.com/kowshiq006/imable

## Overview

##### Project type and purpose
- This is a single-client Android mobile application (“ImAble”) whose purpose is to connect autistic children, families, and organizations with special features: communication tools (images + audio), parental controls, GPS monitoring, emergency SMS, and a feed section.
- Key indicators: an Android Studio Gradle project with only an “app” module, numerous Activities in com.example.imable1, a google-services.json file, and raw audio resources.

##### File structure
- Top-level:
- app/ – the only Android module
- build.gradle, settings.gradle, gradle/… – standard Android build scripts
- Inside app/:
- src/main/java/com/example/imable1 – contains ~25 Activity and helper classes (AutoMessage, Upload, Constants, etc.)
- src/main/res – UI layouts, menus, drawables, fonts, raw audio files (e.g., angry.mpeg, happy.mpeg)
- src/debug & src/release – Google Maps API key configurations
- src/androidTest & src/test – instrumentation and unit tests
- Configs:
- google-services.json – indicates Firebase services (Auth, Database, Storage, Cloud Messaging)
- AndroidManifest.xml – registers Activities and permissions (e.g. SEND_SMS, ACCESS_FINE_LOCATION)

##### README for additional insights
- Confirms required features: communication tools, parental control, GPS monitoring, emergency SMS, feed.
- No built-in backend module, so likely relies on Firebase and Android platform services.

a. Main components:
1. Android App (mobile client)
- UI Layer: Activities & Fragments (login, register, homepage, articles, blogs, images, emergency, parental controls)
- Domain/Controller Layer: AutoMessage, Upload, Constants, custom Adapters, ExampleDialog
- Data Layer: Local cache (if any), Firebase SDKs
- Platform Services:
- LocationService (GPS monitoring via Google Maps API)
- SMSService (Emergency SMS via Android TelephonyManager)
2. Backend-as-a-Service: Firebase
- Authentication (user accounts)
- Realtime Database / Firestore (feed section, user profiles)
- Cloud Storage (images, audio uploads)
- Cloud Messaging (notifications, emergency alerts)
- (Optionally) Cloud Functions for SMS fallback or advanced logic
3. External APIs
- Google Maps Android API (for in-app map display & geofencing)
- SMS Gateway (native Android SMS or third-party if configured)
b. Relationships & Data Flows:
- UI Layer <-> Controller Layer: user actions trigger Controller methods
- Controller Layer <-> Firebase SDK: REST/gRPC calls for Auth, DB, Storage
- Controller Layer <-> Platform Services:
- LocationService requests GPS → Google Maps SDK → returns coordinates → upload to Firebase
- SMSService composes and sends SMS on emergencies
- Firebase Cloud Messaging pushes notifications → Android App receives & routes to UI
c. Architectural patterns & design principles:
- MVC/MVP flavor: Activities = View + Controller, helper classes as Model/Service
- SDK-driven integration: minimize custom backend logic by leveraging Firebase PaaS
- Separation of Concerns: UI in res/layout + Activities, business logic in Java classes (AutoMessage, Upload), external integrations via dedicated services
d. Key technologies & libraries:
- Android SDK (min/target API levels in Gradle)
- Firebase Android SDKs (Auth, Firestore/RealtimeDB, Storage, Messaging)
- Google Maps Android API v2
- Android Support Libraries / AndroidX for UI components and navigation
- Gradle build system

##### Essential elements to capture
- All major Activities grouped by functional area (Onboarding, Feed, Communication, Safety/Parental Tools)
- Core Service classes (Upload, AutoMessage, Constants) and their connection to Firebase
- External integrations: Google Maps API + Firebase modules
- Data flow for emergency SMS and GPS monitoring
- Deployment context: Android device → Internet → Firebase → back to device (notifications)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% UI Layer - Onboarding
    subgraph "UI Layer - Onboarding"
        style UIOnb fill:#bbdefb,stroke:#333,stroke-width:1px
        Splash["Splash Screen"]:::ui
        Login["Login"]:::ui
        Register["Register"]:::ui
        Register2["Register Step2"]:::ui
        Logout["Logout"]:::ui
    end

    %% UI Layer - Feed
    subgraph "UI Layer - Feed Section"
        Articles["Articles Activity"]:::ui
        Blogs["Blogs Activity"]:::ui
    end

    %% UI Layer - Communication Tools
    subgraph "UI Layer - Communication Tools"
        IA1["ImagesActivity"]:::ui
        IA2["ImagesActivity2"]:::ui
        CI["CustomizedImages"]:::ui
        ImAd["ImageAdapter"]:::ui
        ImAd1["ImageAdapter1"]:::ui
        MyAd["MyAdapter"]:::ui
    end

    %% UI Layer - Safety & Emergency
    subgraph "UI Layer - Safety & Emergency"
        Emerg["Emergency Activity"]:::ui
        BPH["Button-press History"]:::ui
    end

    %% UI Layer - Parental Controls
    subgraph "UI Layer - Parental Controls"
        ParentSec["Parents Section"]:::ui
    end

    %% Controller / Domain Layer
    subgraph "Controller Layer"
        AutoMsg["AutoMessage Service"]:::ctrl
        Upload["Upload Service"]:::ctrl
        Upload1["Upload1 Service"]:::ctrl
        Const["Constants"]:::ctrl
        Dialog["ExampleDialog"]:::ctrl
    end

    %% Firebase SDKs
    subgraph "Firebase SDKs" 
        Auth["Authentication"]:::sdk
        DB["Firestore/RealtimeDB"]:::sdk
        Storage["Cloud Storage"]:::sdk
        MsgSDK["Cloud Messaging"]:::sdk
    end

    %% Platform Services
    subgraph "Platform Services"
        LocServ["LocationService"]:::platform
        SMSServ["SMSService"]:::platform
    end

    %% External APIs
    subgraph "External APIs"
        GMaps["Google Maps API"]:::external
    end

    %% Data Flows
    Splash -->|launch| Login
    Login -->|credentials| Auth
    Register -->|details| Auth
    Register2 -->|details| Auth
    Logout -->|sign out| Auth

    Articles -->|read feed| DB
    Blogs -->|read feed| DB

    IA1 -->|load images| Storage
    IA2 -->|load images| Storage
    CI -->|load customized| Storage
    IA1 -->|use adapter| ImAd
    IA2 -->|use adapter| ImAd1
    CI -->|use adapter| MyAd

    Emerg -->|trigger emergency| AutoMsg
    Emerg -->|send SMS| SMSServ
    BPH -->|history| DB

    ParentSec -->|load settings| DB

    %% Controller connections
    AutoMsg -->|send SMS| SMSServ
    AutoMsg -->|log event| DB
    Upload -->|upload media| Storage
    Upload1 -->|upload media| Storage
    Const -->|config values| All
    Dialog -->|UI dialogs| All

    %% Service to SDK
    Auth -->|auth request| Auth
    AutoMsg -->|notify| MsgSDK
    MsgSDK -->|push notif| Emerg

    %% Location flow
    LocServ -->|request GPS| GMaps
    GMaps -->|coordinates| LocServ
    LocServ -->|update location| DB

    %% Click Events - Onboarding
    click Splash "https://github.com/kowshiq006/imable/blob/main/app/src/main/java/com/example/imable1/splash_screen.java"
    click Login "https://github.com/kowshiq006/imable/blob/main/app/src/main/java/com/example/imable1/login.java"
    click Register "https://github.com/kowshiq006/imable/blob/main/app/src/main/java/com/example/imable1/register.java"
    click Register2 "https://github.com/kowshiq006/imable/blob/main/app/src/main/java/com/example/imable1/register2.java"
    click Logout "https://github.com/kowshiq006/imable/blob/main/app/src/main/java/com/example/imable1/logout.java"
    click Splash "https://github.com/kowshiq006/imable/blob/main/app/src/main/res/layout/activity_splash_screen.xml"
    click Login "https://github.com/kowshiq006/imable/blob/main/app/src/main/res/layout/activity_login.xml"
    click Register "https://github.com/kowshiq006/imable/blob/main/app/src/main/res/layout/activity_register.xml"
    click Register2 "https://github.com/kowshiq006/imable/blob/main/app/src/main/res/layout/activity_register2.xml"
    click Logout "https://github.com/kowshiq006/imable/blob/main/app/src/main/res/layout/activity_logout.xml"

    %% Click Events - Feed
    click Articles "https://github.com/kowshiq006/imable/blob/main/app/src/main/java/com/example/imable1/articles.java"
    click Articles "https://github.com/kowshiq006/imable/blob/main/app/src/main/res/layout/activity_articles.xml"
    click Blogs "https://github.com/kowshiq006/imable/blob/main/app/src/main/java/com/example/imable1/blogs.java"
    click Blogs "https://github.com/kowshiq006/imable/blob/main/app/src/main/res/layout/activity_blogs.xml"

    %% Click Events - Communication
    click IA1 "https://github.com/kowshiq006/imable/blob/main/app/src/main/java/com/example/imable1/ImagesActivity.java"
    click IA1 "https://github.com/kowshiq006/imable/blob/main/app/src/main/res/layout/activity_images.xml"
    click IA2 "https://github.com/kowshiq006/imable/blob/main/app/src/main/java/com/example/imable1/ImagesActivity2.java"
    click IA2 "https://github.com/kowshiq006/imable/blob/main/app/src/main/res/layout/activity_images2.xml"
    click CI "https://github.com/kowshiq006/imable/blob/main/app/src/main/java/com/example/imable1/customizedimages.java"
    click CI "https://github.com/kowshiq006/imable/blob/main/app/src/main/res/layout/activity_customizedimages.xml"
    click ImAd "https://github.com/kowshiq006/imable/blob/main/app/src/main/java/com/example/imable1/ImageAdapter.java"
    click ImAd1 "https://github.com/kowshiq006/imable/blob/main/app/src/main/java/com/example/imable1/ImageAdapter1.java"
    click MyAd "https://github.com/kowshiq006/imable/blob/main/app/src/main/java/com/example/imable1/MyAdapter.java"

    %% Click Events - Safety & Emergency
    click Emerg "https://github.com/kowshiq006/imable/blob/main/app/src/main/java/com/example/imable1/emergency.java"
    click Emerg "https://github.com/kowshiq006/imable/blob/main/app/src/main/res/layout/activity_emergency.xml"
    click BPH "https://github.com/kowshiq006/imable/blob/main/app/src/main/java/com/example/imable1/buttonpress_history.java"
    click BPH "https://github.com/kowshiq006/imable/blob/main/app/src/main/res/layout/activity_buttonpress_history.xml"

    %% Click Events - Parental Controls
    click ParentSec "https://github.com/kowshiq006/imable/blob/main/app/src/main/java/com/example/imable1/parentsSectioon.java"
    click ParentSec "https://github.com/kowshiq006/imable/blob/main/app/src/main/res/layout/activity_parents_sectioon.xml"

    %% Click Events - Domain/Controller
    click AutoMsg "https://github.com/kowshiq006/imable/blob/main/app/src/main/java/com/example/imable1/AutoMessage.java"
    click Upload "https://github.com/kowshiq006/imable/blob/main/app/src/main/java/com/example/imable1/Upload.java"
    click Upload1 "https://github.com/kowshiq006/imable/blob/main/app/src/main/java/com/example/imable1/Upload1.java"
    click Const "https://github.com/kowshiq006/imable/blob/main/app/src/main/java/com/example/imable1/Constants.java"
    click Dialog "https://github.com/kowshiq006/imable/blob/main/app/src/main/java/com/example/imable1/ExampleDialog.java"

    %% Click Events - Firebase Config
    click google-services.json "https://github.com/kowshiq006/imable/blob/main/app/google-services.json"
    click GMaps "https://github.com/kowshiq006/imable/blob/main/app/src/debug/res/values/google_maps_api.xml"
    click GMaps "https://github.com/kowshiq006/imable/blob/main/app/src/release/res/values/google_maps_api.xml"

    %% Styles
    classDef ui fill:#bbdefb,stroke:#333,stroke-width:1px
    classDef ctrl fill:#c8e6c9,stroke:#333,stroke-width:1px
    classDef sdk fill:#ffe0b2,stroke:#333,stroke-width:1px
    classDef platform fill:#e0e0e0,stroke:#333,stroke-width:1px
    classDef external fill:#d1c4e9,stroke:#333,stroke-width:1px
```
