This is a mobile application built using Android with an emphasis on modular architecture, leveraging the MVVM (Model-View-ViewModel) design pattern.
The app simulates a social network, managing albums, posts, and user interactions using various endpoints from the JSONPlaceholder API.
The project serves as a model for applying architectural principles to more complex projects.
Key features include:
- RecyclerViews
- Retrofit for API interactions
- ViewModels
- State and Action Management
- Dependency Injection with Koin
- Clean Architecture
- Modularization
The project follows Clean Architecture, organized into three key layers:
This layer handles the UI components, including activities, fragments, views, adapters, and ViewModels.
It communicates with the Domain Layer to fetch and update data.
The ViewModel observes states and updates the UI accordingly.
-
UI (Activities & Fragments):
Displays user-facing elements such as lists, forms, and navigation.
-
Views:
Includes adapters for RecyclerView, click listeners, and custom UI components.
-
ViewModels:
Manages UI state and interacts with UseCases from the Domain Layer.
Includes action and state management.
-
Utilities:
Helper classes for UI enhancements like RecyclerView decorations or utility functions.
This layer defines the business logic and use cases.
It abstracts the application rules and interacts with repositories in the Data Layer.
-
Entities:
Business objects representing core data.
-
UseCases:
Define application-specific operations (e.g., fetching posts, creating albums).
-
Repositories (Interfaces):
Abstracts data sources, ensuring the Domain Layer doesn't depend directly on the Data Layer.
This layer is responsible for data management.
It connects with APIs and transforms data into domain entities.
-
DataSource:
Contains the Retrofit service interface for API calls.
-
Models:
Data Transfer Objects (DTOs) used for serialization, deserialization, and transformation of DTOs to Entities.
-
Repository Implementation:
Implements the repository interfaces and handles data transformations.
data
│── manifests
│── java
│ └── com.example.data
│ ├── datasource
│ ├── model
│ ├── repository
│── com.example.data (androidTest)
│── com.example.data (test)
domain
│── main
│ │── java
│ │ └── com.example.domain
│ │ ├── entity
│ │ ├── repository
│ │ ├── usecase
│── test
│── manifests
java
│── com.example.json_placeholder_api
│ ├── presentation
│ │ ├── ui
│ │ │ ├── activity
│ │ │ ├── fragment
│ │ │ ├── view
│ │ │ │ ├── adapter
│ │ │ │ ├── click_listener
│ │ ├── utils
│ │ ├── viewmodel
│ │ │ ├── action
│ │ │ ├── state
│ ├── Application
│ ├── KoinApplication.kt
│── com.example.json_placeholder_api (generated)
- FindUsersFragment: Lists all users and navigates to a specific user’s profile.
- HomeFragment: Displays the main feed (e.g., posts, albums).
- AlbumsOfUserFragment: Displays a list of albums for a user.
- CreateAlbumFragment: Allows users to create albums with titles and up to two photos.
- CreatePostFragment: Enables users to create posts with a title and description.
- CreatePublicationFragment: Manages switching between creating posts and albums.
- Programming Language: Kotlin
- Architecture: MVVM with Clean Architecture
- Networking: Retrofit + Gson
- Dependency Injection: Koin
- State Management: LiveData
- UI Components: RecyclerView, Fragments, ViewBinding
- API: JSONPlaceholder