Package Directory Structure
Package Directory Structure
RideEase follows the Recommended Android App Architecture (MVVM), separating concerns into distinct layers to ensure scalability and ease of maintenance. The codebase is organized into the following package structure:
com.rideease.app.activities
This package contains the UI controllers (Activities) that manage user interactions and navigation. These classes are responsible for inflating layouts via ViewBinding and observing LiveData from the ViewModels.
- SplashActivity: The entry point of the application. It handles initial authentication state checks and manages the Android 12+ splash screen.
- LoginActivity / SignupActivity: Manage the authentication flow, including email verification and user type selection (Rider/Driver).
- UserDetailsActivity: Facilitates profile completion, specifically collecting names and phone numbers.
- ResetPasswordActivity: Provides the interface for Firebase password reset requests.
- MainActivity: The primary dashboard for the application once a user is authenticated.
com.rideease.app.viewmodels
ViewModels act as the bridge between the UI and the data layer. They maintain the UI state and handle business logic, ensuring state is preserved during configuration changes.
- AuthViewModel: The core logic hub for Firebase Authentication and Firestore user data synchronization.
- UserDetailsViewModel: Specifically manages phone verification processes and repository interactions.
Usage Example: Observing Auth State
// In an Activity
viewModel = new ViewModelProvider(this).get(AuthViewModel.class);
viewModel.getAuthResult().observe(this, authResult -> {
if (authResult.isSuccess()) {
// Navigate to the next screen
}
});
com.rideease.app.models
Contains Plain Old Java Objects (POJOs) that represent the data entities used throughout the application.
- User: Defines the user profile structure, including
userId,userType,fullName,email, and verification status.
com.rideease.app.repository
This layer abstracts data sources from the rest of the application. It interacts directly with Firebase services (Auth and Firestore).
- AuthRepository: (Internal) Handles the low-level implementation of phone number verification and OTP callbacks.
com.rideease.app.utils
Contains helper classes and utility functions that provide shared functionality across the application.
- AuthUtils: Provides static methods to validate user sessions and check if a user has completed their profile details in Firestore.
- AuthResult: A data wrapper used to communicate the success or failure of authentication operations to the UI.
Usage Example: Checking User State
AuthUtils.checkUserDetails(userId, new AuthUtils.UserDetailsCallback() {
@Override
public void onComplete(boolean hasDetails, String userId) {
if (hasDetails) {
// User has completed their profile
}
}
@Override
public void onError(String error) {
// Handle error
}
});
Resource Organization
Beyond the Java/Kotlin packages, the project utilizes standard Android resource directories:
res/layout: XML files usingDataBindingandViewBinding.res/values: Theming (Colors, Styles) and string constants.res/raw: Contains Lottie animations used for loading states and splash screens.