How afollestad/mnml works
Main Components
• UI/Presentation Layer (app module):
– Contains activities and fragments (for example, MainActivity, SettingsActivity, and various UI components in the “ui” package).
– Uses MVVM design principles with ViewModels (e.g., MainViewModel, ScopedViewModel).
– Includes dependency injection modules (di directory with MainModule.kt and ViewModelModule.kt) to wire up dependencies.
• Core Engine (engine module):
– Implements the screen capturing functionality through classes like CaptureEngine, CaptureEngineRecorder, and the OverlayManager.
– Manages related tasks such as gesture recognition (ShakeListener), permission handling (CapturePermissionActivity, OverlayPermissionActivity), and background services (BackgroundService).
– Provides essential recording and overlay functionalities that drive the actual screen capture.
• Common Utilities (common module):
– Contains shared utilities and extensions (e.g., for intents, lifecycle, live data, and miscellaneous common functions).
– Offers dependency modules such as CommonModule and PrefModule to standardize operations across the app.
• Notifications (notifications module):
– Manages notification channels and displays using components like Notifications, NotificationChannelBuilder, and related resources for foreground notifications.
– Handles interactions with the user during screen recording through interactive notifications.
• Theming (theming module):
– Manages the aesthetic and visual appearance of the application including dark mode (see DarkModeSettings, DarkModeSwitchActivity).
– Provides layout and design resources which ensure the UI remains minimal and consistent.
Relationships and Interactions
• UI components (in the app module) trigger recording operations and interact with user settings and feedback.
• These UI layers depend on ViewModels which are provided via dependency injection, ensuring a clear separation of concerns.
• The UI layer calls into services provided by the engine module, which handles the capture logic, overlay display, and manages permissions.
• The common module supplies utilities and shared resources that are used by both the UI and engine.
• The notifications module listens to state changes (e.g., recording start/stop) and displays appropriate notifications.
• The theming module interacts with the UI layer to apply styling changes based on user preferences (like dark mode).
Architectural Patterns and Design Principles
• Modular Architecture: Each module (app, engine, common, notifications, theming) encapsulates distinct responsibilities.
• MVVM Pattern: UI screens (activities/fragments) work with ViewModels to manage state and business logic.
• Dependency Injection: Modules under “di” in the app layer organize how dependencies are provided to various components.
• Separation of Concerns: Utility functions in “common” are isolated from the domain-specific logic in “engine” and “notifications”.
Relevant Technologies
• Android Framework: The application harnesses Android’s UI components, services, and permissions model.
• Gradle Build System: Separate Gradle build files across modules indicate a well-organized build system.
• Kotlin: The source files (with “.kt” extension) show that Kotlin drives the implementation.
• Unit Testing: Presence of “src/test”, testutil, and theming tests indicates that there is a testing layer for robust functionality.