How darkempire78/opencalc works
Main Components
• Application/Entry Point: Represent the custom Application class (OpenCalcApp) that initializes global settings.
• UI Layer: Include all Activities (MainActivity, SettingsActivity, AboutActivity) and dialogs (e.g., DonationDialog) as the primary interfaces with the user.
• Calculator Engine: Create a distinct component for the core calculator functionality (the “calculator” package), which contains the Calculator class along with the parser (Expression and NumberFormatter) responsible for evaluating and formatting expressions.
• History Module: Display the History classes (History and HistoryAdapter) as a component that manages past calculations.
• Preferences and Themes: Add a component for configuration and customization (MyPreferences, Themes, and TextSizeAdjuster) that controls user options, themes, and display adjustments.
• Services: Include components like MyTileService which exposes the quick settings tile functionality.
• Android Resources: Represent resources such as layouts, drawables, and values, as they play an important role in the presentation layer.
• Testing and Build Tools: Although not part of the runtime architecture, note the testing (androidTest and test folders) and build/deployment configurations (Gradle build scripts and Fastlane metadata) that support continuous integration and release management.
Component Relationships and Interactions
• Global settings and theming (Preferences, Themes, TextSizeAdjuster) are accessed by both the UI Layer and, occasionally, the Calculator Engine to modify behavior or presentation.
• Background Services (MyTileService) interact with the Android system and may trigger some UI interactions.
Architectural Patterns and Design Principles
• Separation of Concerns: The project smartly segments UI, business logic, and domain-specific processing (calculation and parsing).
Relevant Technologies and Tools
• Android SDK and Kotlin as the primary language and platform.
• Gradle as the build automation system.
• Fastlane for build/deployment to the Play Store.
• XML resources for layouts, drawables, and string resources.
• Testing frameworks (unit tests and instrumented tests) to ensure reliability.