# davematteer/ashesi_news architecture

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

- Interactive diagram: https://gitdiagram.com/davematteer/ashesi_news
- Repository: https://github.com/davematteer/ashesi_news

## Overview

##### Project Type and Purpose
- This is a mobile application (Android) designed primarily for engagement within the Ashesi University community.
- Its purpose is to provide news, campus events, and user interaction with a strong focus on real-time updates, push notifications, and Firebase integration.

##### Key Components from the File Structure and README
a. User Interface Components:
- Activities (e.g., MainActivity, LoginActivity, SignupActivity, FullScreenCardActivity).
- Fragments (e.g., HomeFragment, BookmarkFragment, SearchFragment) to segment the UI.
- Adapters (BookmarkAdapter, CardGridAdapter, CardStackAdapter) that handle the presentation of lists and grids.
- Layout XML files in res/layout which define the UI presentation.
- Resource files (in res/drawable, res/values, etc.) that support UI theming and assets.

b. Application Logic and Data Management:
- Java classes carrying business logic (such as HelperClass, Card.java).
- ViewModels (BookmarkViewModel) that indicate adoption of architectural patterns like MVVM.
- Android Manifest and Gradle/KTS build files to configure runtime and build settings.

c. Testing and Quality Assurance:
- There are separate directories for unit tests (src/test) and instrumentation tests (src/androidTest), which show a structured approach to quality.

d. External Services and Integration:
- Firebase integration is clearly visible with files like google-services.json and the README section listing Firebase features for authentication, database, and storage.
- Google services configuration files (e.g., google-services-ashesi-news.json) ensure appropriate environment setups.

##### Establishing Relationships and Interactions
- The application UI layer (Activities/Fragments) interacts with the underlying ViewModel and business logic classes that manage the interaction with data sources.
- Data flows from Firebase (external service) into the app through APIs configured in the build files and managed via Firebase SDK.
- The Adapters bridge the business logic and UI by processing and rendering data (news articles, event information) using layout resources.

##### Architectural Patterns and Key Technologies
- MVVM is suggested by the presence of ViewModel classes (e.g., BookmarkViewModel) and separation between UI (Activities/Fragments) and logic.
- Dependency management and build configuration are handled via Gradle (build.gradle.kts, settings.gradle.kts).
- Firebase plays a fundamental role by handling real-time updates, user authentication, and possibly push notifications.
- Standard Android architecture components are evident from the project structure.

## Diagram (Mermaid)

```mermaid
graph TD
    %% User Interface Layer
    subgraph "User Interface Layer"
        %% Activities
        subgraph "Activities"
            Act1["MainActivity"] 
            Act2["LoginActivity"]
            Act3["SignupActivity"]
            Act4["FullScreenCardActivity"]
        end
        %% Fragments
        subgraph "Fragments"
            Frag1["HomeFragment"]
            Frag2["BookmarkFragment"]
            Frag3["SearchFragment"]
        end
        %% Adapters
        subgraph "Adapters"
            Adap1["BookmarkAdapter"]
            Adap2["CardGridAdapter"]
            Adap3["CardStackAdapter"]
        end
        %% UI Resources
        subgraph "UI Resources"
            Layout1["activity_main.xml"]
            Layout2["activity_login.xml"]
            Layout3["activity_signup.xml"]
            Layout4["activity_full_screen_card.xml"]
            Layout5["fragment_home.xml"]
            Layout6["fragment_bookmark.xml"]
            Layout7["fragment_search.xml"]
            Layout8["card_item.xml"]
            Layout9["bookmark_item.xml"]
            Layout10["grid_item_card.xml"]
        end
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        BL1["Card.java"]
        BL2["HelperClass.java"]
        VM["BookmarkViewModel"]
    end

    %% External Services & Configuration
    subgraph "External Services & Configuration"
        FB["Firebase Services"]
        subgraph "Firebase Configuration"
            conf1["google-services-ashesi-news.json"]
            conf2["google-services.json"]
            conf3["google-services.json"]
        end
        subgraph "Build & Gradle Files"
            Build1["app/build.gradle.kts"]
            Build2["build.gradle.kts"]
            Build3["settings.gradle.kts"]
            Build4["gradle.properties"]
        end
    end

    %% Testing
    subgraph "Testing"
        Test1["Unit Tests"]
        Test2["Instrumentation Tests"]
    end

    %% Relationships from UI Layer to Business Logic
    Act1 -->|"triggers"| VM
    Act2 -->|"triggers"| VM
    Act3 -->|"triggers"| VM
    Act4 -->|"triggers"| VM
    Frag1 -->|"updates"| VM
    Frag2 -->|"updates"| VM
    Frag3 -->|"updates"| VM

    %% Business Logic interactions
    VM -->|"processes with"| BL1
    VM -->|"processes with"| BL2
    VM -->|"fetches data from"| FB

    %% Build files configure Firebase integration
    Build1 ---|"configures"| FB
    Build2 ---|"configures"| FB
    Build3 ---|"configures"| FB
    Build4 ---|"configures"| FB

    %% Testing connections to UI and Business Logic
    Test1 ---|"validates"| VM
    Test2 ---|"validates"| VM

    %% Styling classes
    class Act1,Act2,Act3,Act4,Frag1,Frag2,Frag3,Adap1,Adap2,Adap3,Layout1,Layout2,Layout3,Layout4,Layout5,Layout6,Layout7,Layout8,Layout9,Layout10 ui
    class BL1,BL2,VM logic
    class FB,conf1,conf2,conf3,Build1,Build2,Build3,Build4 external
    class Test1,Test2 test

    %% Click Events for User Interface Components – Activities
    click Act1 "https://github.com/davematteer/ashesi_news/blob/master/app/src/main/java/project/oop/ashesi_news/MainActivity.java"
    click Act2 "https://github.com/davematteer/ashesi_news/blob/master/app/src/main/java/project/oop/ashesi_news/LoginActivity.java"
    click Act3 "https://github.com/davematteer/ashesi_news/blob/master/app/src/main/java/project/oop/ashesi_news/SignupActivity.java"
    click Act4 "https://github.com/davematteer/ashesi_news/blob/master/app/src/main/java/project/oop/ashesi_news/FullScreenCardActivity.java"

    %% Click Events for User Interface Components – Fragments
    click Frag1 "https://github.com/davematteer/ashesi_news/blob/master/app/src/main/java/project/oop/ashesi_news/HomeFragment.java"
    click Frag2 "https://github.com/davematteer/ashesi_news/blob/master/app/src/main/java/project/oop/ashesi_news/BookmarkFragment.java"
    click Frag3 "https://github.com/davematteer/ashesi_news/blob/master/app/src/main/java/project/oop/ashesi_news/SearchFragment.java"

    %% Click Events for User Interface Components – Adapters
    click Adap1 "https://github.com/davematteer/ashesi_news/blob/master/app/src/main/java/project/oop/ashesi_news/BookmarkAdapter.java"
    click Adap2 "https://github.com/davematteer/ashesi_news/blob/master/app/src/main/java/project/oop/ashesi_news/CardGridAdapter.java"
    click Adap3 "https://github.com/davematteer/ashesi_news/blob/master/app/src/main/java/project/oop/ashesi_news/CardStackAdapter.java"

    %% Click Events for UI Resources – Layouts
    click Layout1 "https://github.com/davematteer/ashesi_news/blob/master/app/src/main/res/layout/activity_main.xml"
    click Layout2 "https://github.com/davematteer/ashesi_news/blob/master/app/src/main/res/layout/activity_login.xml"
    click Layout3 "https://github.com/davematteer/ashesi_news/blob/master/app/src/main/res/layout/activity_signup.xml"
    click Layout4 "https://github.com/davematteer/ashesi_news/blob/master/app/src/main/res/layout/activity_full_screen_card.xml"
    click Layout5 "https://github.com/davematteer/ashesi_news/blob/master/app/src/main/res/layout/fragment_home.xml"
    click Layout6 "https://github.com/davematteer/ashesi_news/blob/master/app/src/main/res/layout/fragment_bookmark.xml"
    click Layout7 "https://github.com/davematteer/ashesi_news/blob/master/app/src/main/res/layout/fragment_search.xml"
    click Layout8 "https://github.com/davematteer/ashesi_news/blob/master/app/src/main/res/layout/card_item.xml"
    click Layout9 "https://github.com/davematteer/ashesi_news/blob/master/app/src/main/res/layout/bookmark_item.xml"
    click Layout10 "https://github.com/davematteer/ashesi_news/blob/master/app/src/main/res/layout/grid_item_card.xml"

    %% Click Events for Business Logic and Data Management
    click BL1 "https://github.com/davematteer/ashesi_news/blob/master/app/src/main/java/project/oop/ashesi_news/Card.java"
    click BL2 "https://github.com/davematteer/ashesi_news/blob/master/app/src/main/java/project/oop/ashesi_news/HelperClass.java"
    click VM "https://github.com/davematteer/ashesi_news/blob/master/app/src/main/java/project/oop/ashesi_news/BookmarkViewModel.java"

    %% Click Events for Firebase Configuration
    click conf1 "https://github.com/davematteer/ashesi_news/blob/master/app/google-services-ashesi-news.json"
    click conf2 "https://github.com/davematteer/ashesi_news/blob/master/app/google-services.json"
    click conf3 "https://github.com/davematteer/ashesi_news/blob/master/app/src/google-services.json"

    %% Click Events for Build & Gradle Files
    click Build1 "https://github.com/davematteer/ashesi_news/blob/master/app/build.gradle.kts"
    click Build2 "https://github.com/davematteer/ashesi_news/blob/master/build.gradle.kts"
    click Build3 "https://github.com/davematteer/ashesi_news/blob/master/settings.gradle.kts"
    click Build4 "https://github.com/davematteer/ashesi_news/blob/master/gradle.properties"

    %% Click Events for Testing
    click Test1 "https://github.com/davematteer/ashesi_news/blob/master/app/src/test/java/project/oop/ashesi_news/ExampleUnitTest.java"
    click Test2 "https://github.com/davematteer/ashesi_news/blob/master/app/src/androidTest/java/project/oop/ashesi_news/ExampleInstrumentedTest.java"
```
