How trducchinh/coffeeapp works
Main Components
• User Interface Layer:
• Major screens and fragments (e.g., Sign In, Sign Up, Forgot Password, Home Screen, Detail Screen, Cart Screen, Payment Screen, Favourite Screen, Order History, Profile).
• ViewModel Layer:
• Viewmodels (e.g., HomeViewModel, CartViewModel, OrderHistoryViewModel, UserProfileViewModel, etc.) which act as a mediator between the UI and the data/model layer.
• Model/Data Layer:
• Domain objects such as Coffee, CoffeeBean, CartItem, OrderHistory, Address, and User. These are found under the “model” directory.
• Adapter Components:
• The adapters (e.g., CoffeeAdapter, AddressAdapter, CartAdapter, OrderAdapter, etc.) tie into Android’s RecyclerView to display dynamic lists.
• Utility & Service Integration:
• Utilities (under “utils”) handle tasks like payment operations, database interactions (saving to DB), conversions, and Firebase integration.
• External service components: Retrofit-based API services (e.g., GoongApiService) and Firebase configuration (including Firebase Authentication and Firebase Realtime Database integration).
• Android Infrastructure:
• The Android Manifest, resource files (layouts, anims, drawables), navigation graphs, and Gradle build configuration files are also components ensuring the app is bundled correctly and supports navigation, UI theming, and animations.
Relationships and Interactions
• The UI Layer (Activities/Fragments) interacts with the ViewModel layer through observers and data binding.
• The ViewModel layer communicates with the Model/Data layer and uses adapter classes for populating dynamic elements.
• The Model layer holds the data structures that are either loaded from or pushed to the Firebase backend and external services.
• Utility and API service classes (including functions in Retrofit and Firebase connectivity) support both the ViewModel and the Model layers.
• External services (Firebase, Goong Map) are connected to the app through the network module and provided API wrappers.
Architectural Patterns and Design Principles
• Presentation Layer (UI)
• Domain Logic Layer (ViewModels)
• Data Layer (Models, external API & database utilities)
• Mention the use of asynchronous programming using Kotlin Coroutines.
• Role of adapters in handling RecyclerViews lists and managing data interaction in the UI.
• Integration points for external services such as Firebase and Goong Map.