How joehalliwell/meditation-time works
Project type and purpose
• This is a single-module Android application (“Meditation Time”) written in Kotlin. Its core functionality is to let users set up timed meditation sessions with optional interval bells, daily alerts, and feedback, and to log session times.
File structure
• Top-level: Gradle scripts (build.gradle, settings.gradle), Android wrapper files, a play-store folder, and project-wide configs.
• app/: the only module. Under app/src/main:
• java/com/joehalliwell/meditationtime: Kotlin code – MainActivity, PreferencesActivity, BaseActivity, TimerView, TimerViewListener
• Tests under androidTest and test packages.
• No external microservices or multi-module divisions.
Extract additional insights from README
• Core features: interval bells, full screen, feedback sounds, daily notifications, session logging, UI themes.
• No mention of remote storage or server integration; everything runs locally.
Main components
a. UI Layer
• MainActivity (session control screen)
• TimerView (custom view displaying the timer)
• PreferencesActivity (settings screen)
b. Business Logic Layer
• TimerViewListener (handles start/stop/tick events)
• SessionManager (implicit—manages session state, counts interval bells, triggers end)
c. Data Layer
• SharedPreferences (stores user preferences: bell count, durations, daily alert time, themes)
• Local Session Log (e.g. file or SharedPreferences-based logging of past sessions)
d. Android System Services
• AlarmManager (schedules daily alerts)
• NotificationManager (displays alerts if app is backgrounded)
• MediaPlayer/AudioManager (plays .ogg files)
e. Resource Layer
• res/raw audio assets
• res/drawable, res/layout, res/values
Relationships and interactions
• User taps Play → MainActivity instantiates TimerView → TimerViewListener starts a countdown → on each interval boundary, MediaPlayer plays a raw audio resource → TimerView updates UI.
• User opens PreferencesActivity → reads/writes SharedPreferences → AlarmManager is reset to the new daily alert time.
• At daily alert time, AlarmManager fires a PendingIntent → NotificationManager shows a notification → tapping it opens MainActivity.
• At session end, SessionManager logs the session to local storage via SharedPreferences or a simple file.
Architectural patterns and design principles
• MVC / MVVM-lite: Activities = controllers, TimerView = view, SessionManager & SharedPreferences = model
• Single Responsibility: custom view separated from Activity logic
• Use of Android system services for scheduling and notifications
• Resource-driven UI: all strings, dimensions, themes in res/values