How hfdlys/bjtuselfservice works
Project Type and Purpose
• This is an Android Studio project – a mobile app designed to consolidate numerous student services (automatic MIS login, email viewing without re-login, campus card balance, exam schedules, course table management, local data parsing including captcha recognition, and even a classroom capacity check).
• Its key advantage is local processing for improved security, with a single network interaction for retrieving classroom numbers.
• The app also incorporates email subscription and alert functionality for assignments and courses.
Analyzing the File Structure
• The top-level “app” folder indicates the application module.
• Under “app/src/main/java/team/bjtuss/bjtuselfservice”, directories are arranged by functionality:
• “screen” houses UI screens for various features (LoginScreen, HomeScreen, ExamScheduleScreen, etc.).
• “viewmodel” contains the ViewModels (e.g., LoginViewModel, CourseScheduleViewModel) that likely manage UI state and business logic.
• “repository” abstracts data sources with different repositories (DatabaseRepository, NetworkRepository, etc.).
• “dao”, “database”, and “entity” imply a local database layer (potentially using Room) for persisting course data, grades, homework, etc.
• “component” and “ui/theme” support the UI elements and design consistency.
• “utils” provide helper functions (e.g., network operations, file picking, image conversion for ML model).
• “web” and “jsonclass” suggest integration with external services (like classroom capacity or MIS data).
• The “assets” folder contains a machine learning model (model.pt) used for captcha recognition, adding a specialized component for local ML processing.
• The build files (build.gradle.kts, settings.gradle.kts) and gradle wrapper files handle project builds and dependency management.
Architectural Patterns and Design Principles
• The structure strongly suggests the Model-View-ViewModel (MVVM) pattern:
• The “screen” (View) layer is separated from the “viewmodel” (logic) layer.
• Repositories form the data/model layer, encapsulating database (dao, database, entity) and network operations.
• There’s a clear separation between UI, business logic, and data access, ensuring modularity and ease of testing.
• The use of repositories and a centralized database abstraction provides single points of access to data, enhancing maintainability.
Relationships and Interactions
• UI components sending user interactions to the corresponding ViewModel.
• ViewModels querying or updating data via the Repository layer.
• Data flows between the Database (using DAO) and Repositories.
• Network requests flowing from the Network Repository to external services.