How dacb2134/aulavirtual-android works
1. What this repository is
- A single-module Android client written in Kotlin for a Moodle-based virtual classroom.
- The app is UI-heavy, network-backed, and organized around MVVM with a manual Repository layer.
2. Top-level architectural shape
- The runtime stack is: Activities/Fragments → ViewModels → Repository → Retrofit/Moodle API.
- Domain objects are separated into feature-specific model packages for auth, courses, assignments, forums, grades, and user profile.
3. Authentication and session boundary
- The auth subsystem centers on MainActivity, SettingsActivity, LoginViewModel, AuthRepository, and auth DTOs.
- The README describes a hybrid login flow: Google Sign-In plus a Moodle token/session. That implies the app maps an external identity to a Moodle account and then manages Moodle session state.
- TokenExpiryInterceptor indicates session expiration is handled centrally at the network layer rather than inside each screen.
4. Role-based navigation boundary
- After login, the app appears to route users into different shell activities: HomeActivity, TeacherHomeActivity, and AdminHomeActivity.
- UserRoleResolver and UserRole suggest role detection is a first-class concern, influencing which home experience and feature set the user sees.
5. Feature areas exposed through the UI
- The UI is split into domain screens under ui/:
- Home / dashboard: HomeFragment, HomeViewModel
- Courses: CourseDetailActivity, CourseOverviewFragment, CourseContentFragment
- Assignments: AssignmentDetailActivity, AgendaFragment, CourseAssignmentsFragment
- Forums: CourseForumsFragment, ForumDetailActivity
- Grades: GradesFragment, CourseGradesFragment
- Profile / extras: ProfileFragment, BadgesActivity, FilesActivity
- This suggests the app uses a screen-per-feature structure with dedicated flows for each Moodle domain.
6. Presentation layer pattern
- Each major screen is backed by a corresponding ViewModel: HomeViewModel, LoginViewModel, CourseDetailViewModel, CourseContentViewModel, CourseGradesViewModel, CourseParticipantsViewModel, AgendaViewModel, ProfileViewModel.
- These ViewModels are the state holders and orchestration layer for loading data, reacting to user actions, and exposing screen state to the UI.
7. Data access and API boundary
- RetrofitClient, MoodleApiService, and a set of interceptors define the app’s network boundary to Moodle.
- MoodleFormatInterceptor likely normalizes request/response formatting for Moodle’s API conventions.
- NetworkErrorInterceptor centralizes error translation.
- TokenExpiryInterceptor handles auth expiration uniformly.
- This makes the network layer the main integration point with the external Moodle service.
8. Domain model organization
- Models are grouped by functional area rather than by transport layer:
- model/auth: login, OAuth, user details, roles
- model/course: course metadata, content, grades
- model/assignment: assignments and submission status
- model/foro: forums, discussions, posts
- model/grades: grade reports
- model/user: badges, participants, private files
- This structure indicates a feature-oriented DTO layer that mirrors Moodle capabilities.
9. RecyclerView and list rendering
- Adapters such as CourseAdapter, AssignmentAdapter, ForumAdapter, DiscussionAdapter, BadgesAdapter, and grade/section adapters render the app’s list-based views.
- These adapters form the UI binding layer between ViewModel data and the XML layouts for course cards, task lists, forum threads, badges, and grades.
10. Local utilities and cross-cutting helpers
- AssignmentProgressStore suggests some assignment status/progress is stored locally for quick UI filtering or persistence.
- ColorGenerator, SwipeExtension, and UserRoleResolver are shared helpers used across screens.
- These utilities keep view-specific logic out of ViewModels and adapters.
11. Academic workflow data flow
- The main user journey is: sign in → load role/home data → open course → inspect content/assignments/forums/grades → optionally submit files or post in discussions.
- Assignment submission is a notable boundary: the app includes MoodleUploadFile, SaveSubmissionResponse, and SubmissionStatusResponse, which points to a file-upload flow that crosses from local storage into Moodle.
12. Project/UI composition
- The app uses XML layouts and Material-style Android views, not a Compose-first structure.
- Screens are composed from activities, fragments, dialogs, and menus under res/layout, res/menu, and drawable resources.
- Navigation is likely activity/fragments based, with bottom navigation and course-specific navigation menus.
13. External services and platform dependencies
- The app depends materially on Moodle as the backend LMS and Google Sign-In for the identity entry point.
- Android network security config and release/proguard files indicate the app is intended for standard mobile deployment with explicit runtime security and obfuscation considerations.
14. How to draw the architecture diagram
- Show four main vertical layers: UI, ViewModels, Repository/Network, and Moodle backend.
- Add a side boundary for authentication/session management and another for role-based routing.
- Represent feature clusters around the UI layer: Courses, Assignments, Forums, Grades, Profile/Badges/Files, all sharing the same network and model layers.
Main entry points: UserRoleResolver.kt UserRoleResolver · LoginViewModel.kt LoginViewModel · AuthRepository.kt AuthRepository · MoodleApiService.kt MoodleApiService
Components 25
UI layer
Activities, fragments, and list adapters that compose the Moodle client screens.
- MainActivity · Entry activity for app startup and authentication flow.
app/src/main/java/com/practicas/aulavirtualapp/ui/auth/MainActivity.kt - SettingsActivity · Auth-related settings and configuration screen.
app/src/main/java/com/practicas/aulavirtualapp/ui/auth/SettingsActivity.kt - HomeActivity · Primary post-login shell for the student experience.
app/src/main/java/com/practicas/aulavirtualapp/ui/main/HomeActivity.kt - TeacherHomeActivity · Role-specific shell for teachers.
app/src/main/java/com/practicas/aulavirtualapp/ui/main/TeacherHomeActivity.kt - AdminHomeActivity · Role-specific shell for administrators.
app/src/main/java/com/practicas/aulavirtualapp/ui/main/AdminHomeActivity.kt - HomeFragment · Dashboard view showing the landing experience after login.
app/src/main/java/com/practicas/aulavirtualapp/ui/main/HomeFragment.kt - Course screens · Course overview, detail, and content screens.
- Assignment screens · Assignment agenda, detail, and course assignment views.
- Forum screens · Forum list and discussion detail screens.
app/src/main/java/com/practicas/aulavirtualapp/ui/forum/CourseForumsFragment.kt - Grades screens · Overall and course-specific grade views.
app/src/main/java/com/practicas/aulavirtualapp/ui/grades/GradesFragment.kt - Profile screens · Profile, badges, and private files views.
app/src/main/java/com/practicas/aulavirtualapp/ui/profile/ProfileFragment.kt
ViewModels
Screen state and orchestration for feature flows.
- LoginViewModel · Coordinates login state and auth lifecycle.
app/src/main/java/com/practicas/aulavirtualapp/viewmodel/LoginViewModel.kt - HomeViewModel · Loads dashboard state and home content.
app/src/main/java/com/practicas/aulavirtualapp/viewmodel/HomeViewModel.kt - Course VMs · Manages course detail, content, grades, and participants state.
app/src/main/java/com/practicas/aulavirtualapp/viewmodel/CourseDetailViewModel.kt - AgendaViewModel · Orchestrates assignment agenda and deadlines.
app/src/main/java/com/practicas/aulavirtualapp/viewmodel/AgendaViewModel.kt - ProfileViewModel · Loads profile-related data such as badges and files.
app/src/main/java/com/practicas/aulavirtualapp/viewmodel/ProfileViewModel.kt
Data layer
Repositories, network client, interceptors, and domain models.
- AuthRepository · Repository boundary for login, token exchange, and user session data.
app/src/main/java/com/practicas/aulavirtualapp/repository/AuthRepository.kt - RetrofitClient · Builds the Retrofit stack and wires interceptors.
app/src/main/java/com/practicas/aulavirtualapp/network/RetrofitClient.kt - MoodleApiService · Typed service surface for Moodle endpoints.
app/src/main/java/com/practicas/aulavirtualapp/network/MoodleApiService.kt - Interceptors · Moodle formatting, network error translation, and token expiry handling.
app/src/main/java/com/practicas/aulavirtualapp/network/TokenExpiryInterceptor.kt - Domain models · Feature-oriented model packages for auth, courses, assignments, forums, grades, and user data.
app/src/main/java/com/practicas/aulavirtualapp/model
Shared utilities
Cross-cutting helpers for roles, progress, and UI behavior.
- UserRoleResolver · Determines user role and drives shell navigation.
app/src/main/java/com/practicas/aulavirtualapp/utils/UserRoleResolver.kt - AssignmentProgressStore · Stores assignment progress for quick filtering or persistence.
app/src/main/java/com/practicas/aulavirtualapp/utils/AssignmentProgressStore.kt
External systems
Identity and Moodle backend services.
- Google Sign-In · External identity entry point for hybrid authentication.
- Moodle backend · External Moodle service providing courses, forums, grades, and submissions.
Connections 26
- MainActivity → LoginViewModel: starts auth · Main activity delegates authentication state handling.
- SettingsActivity → LoginViewModel: configures auth · Settings participates in the login/session flow.
- LoginViewModel → AuthRepository: uses · Login ViewModel performs auth operations through the repository.
- AuthRepository → RetrofitClient: builds on · Repository calls are backed by the configured Retrofit stack.
- RetrofitClient → Interceptors: applies · Network client wires shared request/response interceptors.
- RetrofitClient → MoodleApiService: creates · Retrofit client instantiates the Moodle API service.
- MoodleApiService → Moodle backend: calls · Service methods reach the Moodle backend.
- LoginViewModel → Google Sign-In: uses · Hybrid login starts with Google identity.
- AuthRepository → Domain models: maps · Auth responses and user/role DTOs are represented in domain models.
- Interceptors → Moodle backend: guards session · Centralized network handling manages expiry and error translation.
- MainActivity → UserRoleResolver: routes by role · Role detection drives the chosen home shell.
- UserRoleResolver → HomeActivity: opens · Student role lands in the main home shell.
- UserRoleResolver → TeacherHomeActivity: opens · Teacher role lands in the teacher shell.
- UserRoleResolver → AdminHomeActivity: opens · Admin role lands in the admin shell.
- HomeActivity → HomeFragment: hosts · Home shell contains the dashboard fragment.
- HomeFragment → HomeViewModel: binds · Dashboard state is supplied by the Home ViewModel.
- Course screens → Course VMs: binds · Course screens are driven by course-related ViewModels.
- Assignment screens → AgendaViewModel: binds · Assignment screens are orchestrated by the agenda ViewModel.
- Forum screens → Domain models: renders · Forum screens display forum and discussion models.
- Grades screens → Course VMs: binds · Grades views share course-state orchestration.
- Profile screens → ProfileViewModel: binds · Profile-related screens rely on the profile ViewModel.
- HomeViewModel → AuthRepository: loads user · Dashboard data depends on authenticated session state.
- Course VMs → MoodleApiService: fetches course data · Course state is sourced from Moodle endpoints.
- AgendaViewModel → AssignmentProgressStore: persists · Assignment workflow can use local progress storage.
- ProfileViewModel → MoodleApiService: fetches profile data · Profile, badges, and files data come from the API.
- Domain models → Moodle backend: mirrors · Feature DTOs reflect Moodle domain concepts.