How rousgidraph/foodycourseapp works
Project type and purpose
• This is a single-module Android application (“Foody Course App”) built in Kotlin, following MVVM + Repository + DI patterns.
• It fetches recipes from a remote API (Retrofit), caches them in a Room database, manages user preferences via DataStore, and displays data in Activities/Fragments with RecyclerView adapters and data binding.
File structure
• Top-level “app” module with typical Android Gradle setup.
• ui/ (Activities & Fragments)
• adapters/ & bindingAdapters/ (RecyclerView & data-binding glue)
• viewModels/ (MainViewModel, RecipesViewModel)
• data/
– network/ (Retrofit interface)
– database/ (Room Database, DAO, Entities, TypeConverters)
– Repository, LocalDataSource, RemoteDataSource, DataStoreRepository
• di/ (DatabaseModule, NetworkModule)
• util/ (NetworkListener, extension functions, constants, NetworkResult)
• Build scripts declare dependencies on Retrofit, Room, DataStore, Lifecycle, Navigation, Hilt or Dagger (if included), MotionLayout, Shimmer, etc.
README
• Confirms emphasis on Retrofit, local & remote data sources, Room DB, caching, Safe Args (Navigation Component), MotionLayout, dark mode theming.
Components
a. Main components
• UI Layer: MainActivity, DetailsActivity, Fragments (Overview, Recipes, Ingredients, Instructions, FoodJoke, Favourites, BottomSheet)
• ViewModel Layer: MainViewModel, RecipesViewModel
• Data Layer:
• Repository (Repository.kt)
• LocalDataSource (Room via RecipesDatabase, RecipesDao, Entities)
• RemoteDataSource (Retrofit FoodRecipesApi)
• DataStoreRepository (for user preferences or paging states)
• DI Layer: DatabaseModule, NetworkModule (provide singletons for DB, Retrofit, DataStore, Repository)
• External Services:
• Remote Recipe API (e.g., Spoonacular)
• Android DataStore (preferences)
• Utilities: NetworkListener (monitors connectivity), NetworkResult wrapper
b. Relationships & interactions
1. UI (Activity/Fragment) ──> observes ViewModel LiveData/Flow
2. ViewModel ──> invokes Repository methods
3. Repository
• If online, calls RemoteDataSource → Retrofit → Remote API → returns JSON → mapped to models → writes to DB via LocalDataSource → returns data
• If offline or for caching, reads from LocalDataSource → Room DB
• Uses DataStoreRepository to read/write user settings
4. DI Modules provide injected instances to ViewModels and DataSources
5. NetworkListener feeds connectivity status to ViewModels or Repository
c. Architectural patterns & design principles
• MVVM (separate UI and business logic)
• Repository pattern (abstracts data sources)
• Single Activity + multiple Fragments + Navigation Component (my_nav.xml + Safe Args)
• Dependency Injection (modules for DB & network)
• Clean separation of concerns (UI, domain, data)
• Caching strategy (remote → local DB)
• Reactive streams (LiveData or Kotlin Flow)
d. Key technologies & libraries
• Kotlin, AndroidX (AppCompat, Lifecycle, Navigation)
• Retrofit + Gson/Moshi
• Room + Room TypeConverters
• DataStore (Preferences)
• Dagger Hilt or Dagger 2 (if present)
• Coroutines / Flow
• MotionLayout, Shimmer
• RecyclerView, ViewBinding / DataBinding