How nethical6/digipaws works
• App Presentation Layer (UI)
• Activities, fragments, dialogs, and overlays found under app/src/main/java/nethical/digipaws/ui and its subdirectories.
• Examples: MainActivity, LauncherActivity, various fragments (e.g., installation, usage stats) and dialogs (e.g., StartFocusMode, TweakBlocker warnings).
• Service Layer
• Android services that handle background tasks and blocker logic located in app/src/main/java/nethical/digipaws/services.
• Examples: AppBlockerService, UsageTrackingService, KeywordBlockerService, GeneralFeaturesService, and ViewBlockerService.
• Core Blocking/Business Logic
• The blockers and their base classes found under the blockers package.
• Examples: BaseBlocker, AppBlocker, FocusModeBlocker, KeywordBlocker, and ViewBlocker. Also related data models and configurations exist under data/blockers.
• Receivers and System Integration
• The admin and accessibility receivers (e.g., AdminReceiver) that capture system-level events.
• Utilities and Helpers
• A collection of utility classes (e.g., CommonUtils, TimeTools, ShizukuRunner, UsageStatsHelper) that provide auxiliary functions.
• Configuration and Resource Layer
• XML files for service configuration (in res/xml) and layout files in res/layout that define UI structure.
• External Integration & Metadata
• Integration with external libraries (e.g., MPAndroidChart for charts) as well as using Shizuku components for special tasks.
Relationships and Data Flow
• The UI layer (Activities, Fragments, Dialogs) sends user actions to trigger service calls and interact with the core blockers.
• Services (such as the AppBlockerService and UsageTrackingService) operate in the background and monitor app usage events, interfacing with Android’s accessibility services.
• The Blockers (e.g., FocusModeBlocker, KeywordBlocker) act upon data provided by the services and user configurations to enforce blocking logic.
• Utility classes assist by managing configurations, scheduling notifications, and handling error logging (CrashLogger).
• Data flows from the accessibility or usage tracking components to the UI overlays (e.g., UsageStatOverlayManager) and widgets for real-time feedback.
• Receivers capture system events (e.g., admin events) which then trigger service actions or updates in the UI.
Architectural Patterns and Design Principles
• Layered/MVC/MVVM Pattern: Although not strictly using a formal pattern like MVVM, the app clearly separates UI components from core business logic (in services and blockers) and utility/data modules.
• Service-Oriented and Event-Driven: The accessibility service, usage tracking, and event receivers indicate a reactive approach based on system events.
• Modularity: The separation of blockers into distinct classes and packages, along with segregated configurations (e.g., XML service configs), shows a modular design intended for easy expansion (e.g., future gamified mode or external API integration).