Releases: VishalPVijayan4/ComposeAnimation_HILT
Releases · VishalPVijayan4/ComposeAnimation_HILT
DemoAppFinal
1. API Layer (Networking with Retrofit):
- The app uses Retrofit for network calls to fetch dynamic content from remote APIs.
- API endpoints are defined as Kotlin interfaces. Retrofit handles the HTTP requests and JSON parsing behind the scenes.
- Dependency Injection with Hilt:
- Hilt is used for dependency injection. This simplifies managing instances of Retrofit, repositories, use cases, and ViewModels.
- Hilt modules provide Retrofit instances, API interfaces, and any needed dependencies.
- Repositories are injected into ViewModels through Hilt, ensuring clean separation of concerns and easy testability.
3. Repository Pattern & Clean Architecture:
- The Repository layer serves as the “single source of truth” for data (whether from remote API or local source).
- The repository makes API calls using injected API interfaces (Retrofit).
- It abstracts data-fetching logic so the rest of the app doesn’t need to know where data comes from.
4. Use Cases (Domain Layer):
- Use case classes encapsulate business logic and application operations.
- They call the repository methods and may apply business rules or transform data before passing it to the ViewModel.
5. ViewModel & State Management:
- The ViewModel (annotated with @hiltviewmodel) exposes state as a Kotlin Flow or StateFlow.
- When initialized, the ViewModel triggers the use case to fetch remote data via the repository.
- The result (loading/success/error) flows as state, which is observed by the UI layer (Jetpack Compose Composables).
6. UI Layer (Jetpack Compose):
- UI composables observe changes in the ViewModel’s state.
- As new data arrives or state changes (such as loading, displaying data, or handling errors), the UI recomposes itself automatically.
- All user-triggered actions (e.g., button clicks) are handled via ViewModel events, keeping UI logic clean.
7. Coroutines:
- Kotlin Coroutines are used for all asynchronous operations (making network requests, updating state).
- All heavy or remote operations run off the main thread, ensuring smooth UI performance.
DemoApp
This app begins with a splash screen that welcomes the user and automatically navigates to an onboarding flow after a short delay. The onboarding uses a series of cards, each displaying promotional content and an icon, to educate or entice users about the benefits of the app such as buying gold and having no hidden fees. This application uses static data.