Skip to content

Commit bfa2780

Browse files
committed
chore: initial project setup with Clean Architecture
0 parents  commit bfa2780

92 files changed

Lines changed: 5311 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
9+
jobs:
10+
test:
11+
name: Unit Tests
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Set up JDK 17
19+
uses: actions/setup-java@v4
20+
with:
21+
java-version: '17'
22+
distribution: 'temurin'
23+
24+
- name: Cache Gradle
25+
uses: actions/cache@v4
26+
with:
27+
path: |
28+
~/.gradle/caches
29+
~/.gradle/wrapper
30+
key: gradle-${{ hashFiles('gradle/libs.versions.toml', 'gradle/wrapper/gradle-wrapper.properties') }}
31+
restore-keys: gradle-
32+
33+
- name: Make gradlew executable
34+
run: chmod +x gradlew
35+
36+
- name: Run unit tests
37+
run: ./gradlew testDebugUnitTest
38+
39+
- name: Upload test report
40+
uses: actions/upload-artifact@v4
41+
if: always()
42+
with:
43+
name: test-report
44+
path: app/build/reports/tests/testDebugUnitTest/
45+
retention-days: 7
46+
47+
build:
48+
name: Build Debug APK
49+
runs-on: ubuntu-latest
50+
needs: test
51+
52+
steps:
53+
- name: Checkout
54+
uses: actions/checkout@v4
55+
56+
- name: Set up JDK 17
57+
uses: actions/setup-java@v4
58+
with:
59+
java-version: '17'
60+
distribution: 'temurin'
61+
62+
- name: Cache Gradle
63+
uses: actions/cache@v4
64+
with:
65+
path: |
66+
~/.gradle/caches
67+
~/.gradle/wrapper
68+
key: gradle-${{ hashFiles('gradle/libs.versions.toml', 'gradle/wrapper/gradle-wrapper.properties') }}
69+
restore-keys: gradle-
70+
71+
- name: Make gradlew executable
72+
run: chmod +x gradlew
73+
74+
- name: Install Android SDK 36
75+
run: |
76+
yes | $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager "platforms;android-36" --sdk_root=$ANDROID_SDK_ROOT
77+
78+
- name: Build debug APK
79+
run: ./gradlew assembleDebug
80+
81+
- name: Upload debug APK
82+
uses: actions/upload-artifact@v4
83+
with:
84+
name: NoiseGuard-debug
85+
path: app/build/outputs/apk/debug/app-debug.apk
86+
retention-days: 7
87+
88+
instrumented-tests:
89+
name: Instrumented Tests
90+
runs-on: ubuntu-latest
91+
needs: test
92+
93+
steps:
94+
- name: Checkout
95+
uses: actions/checkout@v4
96+
97+
- name: Set up JDK 17
98+
uses: actions/setup-java@v4
99+
with:
100+
java-version: '17'
101+
distribution: 'temurin'
102+
103+
- name: Cache Gradle
104+
uses: actions/cache@v4
105+
with:
106+
path: |
107+
~/.gradle/caches
108+
~/.gradle/wrapper
109+
key: gradle-${{ hashFiles('gradle/libs.versions.toml', 'gradle/wrapper/gradle-wrapper.properties') }}
110+
restore-keys: gradle-
111+
112+
- name: Make gradlew executable
113+
run: chmod +x gradlew
114+
115+
- name: Enable KVM
116+
run: |
117+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
118+
sudo udevadm control --reload-rules
119+
sudo udevadm trigger --name-match=kvm
120+
121+
- name: Run instrumented tests
122+
uses: reactivecircus/android-emulator-runner@v2
123+
with:
124+
api-level: 34
125+
arch: x86_64
126+
profile: pixel_6
127+
script: ./gradlew connectedDebugAndroidTest
128+
129+
- name: Upload instrumented test report
130+
uses: actions/upload-artifact@v4
131+
if: always()
132+
with:
133+
name: instrumented-test-report
134+
path: app/build/reports/androidTests/connected/
135+
retention-days: 7

.gitignore

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# Built application files
2+
*.apk
3+
*.ap_
4+
*.aab
5+
6+
# Files for the ART/Dalvik VM
7+
*.dex
8+
9+
# Java class files
10+
*.class
11+
12+
# Generated files
13+
bin/
14+
gen/
15+
out/
16+
release/
17+
18+
# Gradle files
19+
.gradle/
20+
build/
21+
22+
# Local configuration file (sdk path, etc)
23+
local.properties
24+
25+
# Android Studio
26+
.idea/
27+
*.iml
28+
.DS_Store
29+
30+
# External native build folder generated in Android Studio 2.2 and later
31+
.externalNativeBuild
32+
.cxx/
33+
34+
# Google Services (e.g. APIs or Firebase)
35+
google-services.json
36+
37+
# Version control
38+
vcs.xml
39+
40+
# Keystore files
41+
*.jks
42+
*.keystore
43+
44+
# Android Profiling
45+
*.hprof
46+
47+
# IntelliJ
48+
*.iml
49+
.idea/workspace.xml
50+
.idea/tasks.xml
51+
.idea/gradle.xml
52+
.idea/assetWizardSettings.xml
53+
.idea/dictionaries
54+
.idea/libraries
55+
.idea/shelf
56+
.idea/modules.xml
57+
.idea/navEditor.xml
58+
.idea/caches
59+
.idea/misc.xml
60+
61+
# Gradle
62+
gradle-app.setting
63+
!gradle-wrapper.jar
64+
.gradletasknamecache
65+
66+
# Captures folder
67+
captures/
68+
69+
# Log Files
70+
*.log
71+
72+
# BlueJ files
73+
*.ctxt
74+
75+
# Mobile Tools for Java (J2ME)
76+
.mtj.tmp/
77+
78+
# Package Files #
79+
*.jar
80+
*.war
81+
*.nar
82+
*.ear
83+
*.zip
84+
*.tar.gz
85+
*.rar
86+
87+
# virtual machine crash logs
88+
hs_err_pid*
89+
replay_pid*
90+
91+
# Room schema exports should be committed for migration tracking
92+
!app/schemas/
93+
94+
# Claude
95+
.claude

CHANGELOG.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
Format: [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
5+
6+
## [Unreleased]
7+
8+
## [1.1.0] - 2026-05-25
9+
10+
### Added
11+
- Hilt 2.56.2 DI: `@Singleton` repository, `@HiltViewModel` on all ViewModels, `AppModule`
12+
- 13 instrumented tests: `NoiseLevelDaoTest` (9) + `NavigationTest` (4)
13+
- GitHub Actions CI/CD with green badge — unit tests on every push
14+
- `HiltTestRunner`, `TestAppModule` (in-memory Room), `TestUtils` for test infrastructure
15+
16+
### Fixed
17+
- Multiple-ViewModel buffer bug: three independent `NoiseRepositoryImpl` instances
18+
caused clearing history while monitoring to silently fail
19+
- `ActivityInvoker` ClassNotFoundException on instrumented test teardown
20+
21+
## [1.0.2] - 2026-05-24
22+
23+
### Fixed
24+
- Permission flow: app now requests microphone and notification permissions
25+
on first launch via system dialog (previously showed blocked screen immediately)
26+
- Microphone unavailable toast appeared incorrectly when tapping STOP MONITORING
27+
- Version number in Settings was hardcoded as 1.0.0 (now uses BuildConfig.VERSION_NAME)
28+
- Notifications toggle showed ON even when Android notification permission was OFF
29+
30+
## [1.0.1] - 2026-05-23
31+
32+
### Fixed
33+
- License updated from CC BY-NC to BUSL-1.1
34+
- README: Hilt added to tech stack, Accompanist version corrected, Android Studio
35+
version updated to Meerkat (2025.1.1)
36+
- ARCHITECTURE.md: removed incorrect "No Hilt" section, replaced with actual DI setup
37+
- ADRs renumbered (clean sequence), ADR-004 documents Hilt decision
38+
- Calibration offset corrected to 80 dB throughout docs
39+
40+
## [1.0.0] - 2026-05-19
41+
42+
### Core
43+
- Real-time dB SPL monitoring via `AudioRecord` (RMS formula, 20–120 dB range)
44+
- 4 noise categories: QUIET · MODERATE · LOUD · HARMFUL
45+
- Calibrated dB calculation with 80 dB offset (RMS formula, verified in AudioAnalyzerDecibelsTest)
46+
47+
### UI
48+
- Circular gauge with 270° cyan→magenta neon arc and peak marker
49+
- LED-style digital readout with glow effect
50+
- Neon dark theme (`#0A0E1A` base, fixed palette)
51+
- 3 screens: Monitor, History, Settings
52+
53+
### Data
54+
- Room database with timestamp-indexed `NoiseLevelEntity`
55+
- DataStore for scalar preferences (threshold, toggles, sampling rate)
56+
- 30-day auto-cleanup via scheduled timestamp query
57+
- Hilt (2.56.2) for dependency injection — enforces singleton `NoiseRepository` across all ViewModels
58+
59+
### Alerts
60+
- Push notifications with 30-second cooldown
61+
- Vibration alert with independent toggle
62+
- 3-state `RECORD_AUDIO` permission handling (granted → rationale → denied)
63+
- `POST_NOTIFICATIONS` requested contextually on API 33+
64+
65+
66+
### License
67+
- Released under Business Source License 1.1 (BUSL-1.1)
68+
- Free to study and use personally, commercial use prohibited
69+
- Converts to MIT on 2030-01-01

LICENSE.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
Business Source License 1.1
2+
3+
Licensor: Marco Domingues
4+
Licensed Work: NoiseGuard
5+
Change Date: 2030-01-01
6+
Change License: MIT
7+
8+
Use Limitation:
9+
The Licensed Work may not be used for Commercial Purposes.
10+
"Commercial Purposes" means any use intended for or directed
11+
toward commercial advantage or monetary compensation, including
12+
but not limited to:
13+
- Publishing on any app store (Google Play, Apple App Store, etc.)
14+
- Using in a commercial product or service
15+
- Selling or licensing the work
16+
17+
You are free to:
18+
- View, study, and learn from the code
19+
- Fork and modify for personal, non-commercial use
20+
- Share with attribution
21+
22+
On the Change Date (2030-01-01), this license converts
23+
automatically to MIT, allowing all uses.
24+
25+
Full license text: https://mariadb.com/bsl11/
26+
27+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.
28+
Copyright (c) 2026 Marco Domingues

0 commit comments

Comments
 (0)