# javierjuanjj/voiceencryption architecture

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

- Interactive diagram: https://gitdiagram.com/javierjuanjj/voiceencryption
- Repository: https://github.com/javierjuanjj/voiceencryption

## Overview

##### Project type and purpose
- From the file tree and build files, this is an Android mobile application named “VoiceEncryption.”
- Its purpose is to capture or load audio (e.g., the provided mirage.mp3 asset), run an encryption/decryption algorithm on voice data, and play back or store the result.

##### File structure
- Top-level Gradle configuration:
- settings.gradle.kts, build.gradle.kts, gradle.properties, the Gradle wrapper under gradle/wrapper and gradlew(±).
- Single Android module “app”:
- app/src/main/java/com/example/voiceencryption → MainActivity.java (UI entry point), Utity.java (business-logic/encryption utility).
- app/src/main/assets → mirage.mp3 (sample audio).
- Test directories under app/src/test and app/src/androidTest.
- ProGuard rules under app/proguard-rules.pro.

##### README
- The README contains only the title “# VoiceEncryption” with no architectural notes. We infer architecture solely from the project layout.

a. Main components
1) User device (Android smartphone).
2) Presentation layer: MainActivity + Layout XMLs (UI).
3) Business logic layer: Utity.java (encryption/decryption algorithms).
4) Android framework services: MediaRecorder (or AudioRecord), MediaPlayer, File I/O APIs.
5) Data layer:
– Assets folder (embedded audio).
– Local storage (external/internal file storage for encrypted files).
6) Build/deployment: Gradle plugin, ProGuard/R8, AndroidManifest.
b. Relationships and interactions
– User taps UI in MainActivity → UI event invokes Utity.encrypt() or Utity.decrypt().
– If recording: MainActivity uses MediaRecorder/AudioRecord → raw PCM → Utity.encrypt() → writes encrypted blob via FileOutputStream.
– If loading asset: MainActivity reads mirage.mp3 from assets → Utity.encrypt() → stores output.
– Playback: MainActivity or Utity hands encrypted data to Utity.decrypt() → decrypted PCM/MP3 → MediaPlayer plays it.
– Gradle builds Java code, packages resources/assets, runs ProGuard → produces final APK installed on device.
c. Architectural patterns and principles
– Layered architecture (Presentation → Domain → Data).
– Single-Activity pattern (if only MainActivity).
– Encapsulation of encryption logic in a utility class.
– Separation of concerns: UI code does not contain algorithm details.
d. Key technologies/frameworks
– Android SDK (MediaRecorder, MediaPlayer, AssetManager, File APIs).
– Kotlin-DSL Gradle build (build.gradle.kts).
– ProGuard/R8 for code shrinking.
– JUnit and AndroidX Test for unit and instrumentation tests.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User & Device Layer
    subgraph "User & Device"
        direction TB
        User["User"]:::external
        Device["Android Device"]:::external
    end

    %% Presentation Layer
    subgraph "Presentation Layer"
        direction TB
        MainActivity["MainActivity"]:::ui
        Layout["activity_main.xml"]:::ui
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        direction TB
        Utity["Utity (Encryption Service)"]:::logic
    end

    %% Data & Platform Services Layer
    subgraph "Data & Platform Services"
        direction TB
        Assets["mirage.mp3"]:::data
        Resources["Resource Values"]:::data
        Drawables["Drawable & Icons"]:::data
        XmlRules["XML Rules"]:::data
        AndroidManifest["AndroidManifest.xml"]:::platform
        MediaRecorder["MediaRecorder/AudioRecord"]:::platform
        MediaPlayer["MediaPlayer"]:::platform
        FileSystem["File System Storage"]:::platform
    end

    %% Build & Deployment
    subgraph "Build & Deployment"
        direction TB
        AppGradle["app/build.gradle.kts"]:::build
        ProjectGradle["Project Gradle Scripts"]:::build
        ProGuard["app/proguard-rules.pro"]:::build
        GradleWrapper["Gradle Wrapper"]:::build
    end

    %% Testing
    subgraph "Testing Suites"
        direction TB
        UnitTest["ExampleUnitTest.java"]:::test
        InstrumentedTest["ExampleInstrumentedTest.java"]:::test
    end

    %% Connections
    User -->|"interacts with"| MainActivity
    MainActivity -->|"loads layout"| Layout
    MainActivity -->|"calls encryption"| Utity
    Utity -->|"reads asset"| Assets
    Utity -->|"uses resources"| Resources
    Utity -->|"uses drawables"| Drawables
    Utity -->|"applies rules"| XmlRules
    MainActivity -->|"records audio"| MediaRecorder
    MainActivity -->|"plays audio"| MediaPlayer
    Utity -->|"reads/writes"| FileSystem
    AndroidManifest -->|includes| MainActivity
    AndroidManifest -->|configures| MediaRecorder
    AndroidManifest -->|configures| MediaPlayer

    %% Build interactions
    AppGradle -->|"builds code & packages assets"| ProjectGradle
    ProjectGradle -->|uses| GradleWrapper
    AppGradle -->|applies| ProGuard
    GradleWrapper -->|"drives build"| AppGradle

    %% Testing interactions
    UnitTest -->|tests| Utity
    InstrumentedTest -->|tests| MainActivity

    %% Click Events
    click MainActivity "https://github.com/javierjuanjj/voiceencryption/blob/master/app/src/main/java/com/example/voiceencryption/MainActivity.java"
    click Layout "https://github.com/javierjuanjj/voiceencryption/blob/master/app/src/main/res/layout/activity_main.xml"
    click Utity "https://github.com/javierjuanjj/voiceencryption/blob/master/app/src/main/java/com/example/voiceencryption/Utity.java"
    click Assets "https://github.com/javierjuanjj/voiceencryption/blob/master/app/src/main/assets/mirage.mp3"
    click Resources "https://github.com/javierjuanjj/voiceencryption/blob/master/app/src/main/res/values/strings.xml"
    click Resources "https://github.com/javierjuanjj/voiceencryption/blob/master/app/src/main/res/values/colors.xml"
    click Resources "https://github.com/javierjuanjj/voiceencryption/blob/master/app/src/main/res/values/themes.xml"
    click Resources "https://github.com/javierjuanjj/voiceencryption/blob/master/app/src/main/res/values-night/themes.xml"
    click Drawables "https://github.com/javierjuanjj/voiceencryption/blob/master/app/src/main/res/drawable/ic_launcher_background.xml"
    click Drawables "https://github.com/javierjuanjj/voiceencryption/blob/master/app/src/main/res/drawable/ic_launcher_foreground.xml"
    click Drawables "https://github.com/javierjuanjj/voiceencryption/blob/master/app/src/main/res/mipmap-mdpi/ic_launcher.png"
    click Drawables "https://github.com/javierjuanjj/voiceencryption/blob/master/app/src/main/res/mipmap-hdpi/ic_launcher.png"
    click Drawables "https://github.com/javierjuanjj/voiceencryption/blob/master/app/src/main/res/mipmap-xhdpi/ic_launcher.png"
    click XmlRules "https://github.com/javierjuanjj/voiceencryption/blob/master/app/src/main/res/xml/backup_rules.xml"
    click XmlRules "https://github.com/javierjuanjj/voiceencryption/blob/master/app/src/main/res/xml/data_extraction_rules.xml"
    click AndroidManifest "https://github.com/javierjuanjj/voiceencryption/blob/master/app/src/main/AndroidManifest.xml"
    click AppGradle "https://github.com/javierjuanjj/voiceencryption/blob/master/app/build.gradle.kts"
    click ProjectGradle "https://github.com/javierjuanjj/voiceencryption/blob/master/build.gradle.kts"
    click ProjectGradle "https://github.com/javierjuanjj/voiceencryption/blob/master/settings.gradle.kts"
    click ProjectGradle "https://github.com/javierjuanjj/voiceencryption/blob/master/gradle.properties"
    click ProGuard "https://github.com/javierjuanjj/voiceencryption/blob/master/app/proguard-rules.pro"
    click GradleWrapper "https://github.com/javierjuanjj/voiceencryption/blob/master/gradle/wrapper/gradle-wrapper.properties"
    click GradleWrapper "https://github.com/javierjuanjj/voiceencryption/blob/master/gradle/wrapper/gradle-wrapper.jar"
    click GradleWrapper "https://github.com/javierjuanjj/voiceencryption/tree/master/gradlew"
    click GradleWrapper "https://github.com/javierjuanjj/voiceencryption/blob/master/gradlew.bat"
    click UnitTest "https://github.com/javierjuanjj/voiceencryption/blob/master/app/src/test/java/com/example/voiceencryption/ExampleUnitTest.java"
    click InstrumentedTest "https://github.com/javierjuanjj/voiceencryption/blob/master/app/src/androidTest/java/com/example/voiceencryption/ExampleInstrumentedTest.java"

    %% Styles
    classDef ui fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef logic fill:#90EE90,stroke:#333,stroke-width:1px
    classDef data fill:#FFA500,stroke:#333,stroke-width:1px
    classDef platform fill:#FFD700,stroke:#333,stroke-width:1px
    classDef build fill:#D3D3D3,stroke:#333,stroke-width:1px
    classDef test fill:#D8BFD8,stroke:#333,stroke-width:1px
    classDef external fill:#ffffff,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5
```
