How g-aggarwal/pollinator works
Project Type & Purpose
• Pollinator is a native Android application (Jetpack Compose + Kotlin) that transforms text prompts into AI-generated images by calling the Pollinations AI REST API.
• It follows a standard MVVM/mobile client architecture: UI (Compose) → ViewModels → Repository/Data layer → External service.
File Structure
• Top-level “app” module: contains everything needed to build the APK.
• src/main/java/com/gauravaggarwal/pollinator — subdivided into:
– data/…: repository interfaces and implementations (GenerationRepository, PollinationsAiRepository)
– model/…: data classes (GenerationParameters, GenerationResult, Models, Sizes)
– ui/…:
• PollinatorApp.kt (entry point + theme host)
• screens/…: Compose screens + ViewModel + UI-state classes
• src/androidTest & src/test: instrumentation & unit tests.
• build.gradle.kts, Gradle wrapper, ProGuard rules, and config files.
Extract Additional Insights from README
• Uses Jetpack Compose, Material3, OkHttp.
• Two build variants (debug vs. release).
• Flexible architecture designed for future AI-service integrations.
Components & Interactions
a. Main Components
1. Android Platform & OS
2. UI Layer (Jetpack Compose Screens)
3. ViewModel Layer (PollinatorViewModel)
4. Repository Layer (GenerationRepository interface + PollinationsAiRepository implementation)
5. Network Layer (OkHttp HTTP client, JSON serialization)
6. External Service: Pollinations AI REST API
7. (Optional) Local Android Backup Manager (backup_rules.xml)
8. Testing modules (unit + instrumentation)
b. Relationships & Data Flow
• User interacts with Compose UI → sends UI events to ViewModel
• ViewModel transforms events → calls Repository methods
• Repository uses OkHttp to issue HTTP requests to Pollinations AI endpoints → returns GenerationResult
• ViewModel updates UI-state → Compose UI renders images
• Tests invoke ViewModel/Repository directly to validate logic
c. Architectural Patterns & Principles
• MVVM: clear separation between UI (Compose), state/business logic (ViewModel), and data access (Repository)
• Dependency inversion: ViewModel depends on repository interface (GenerationRepository)
• Single-source of truth for UI state via PollinatorUiState
• Theming via centralized theme package
d. Technologies & Frameworks
• Kotlin + Coroutines (assumed in Repository calls)
• Jetpack Compose + Material3
• OkHttp (network)
• Gradle (build system)
Putting It All Together
[Android OS/Platform] → [Compose UI Screens] → [ViewModels] → [Repository + OkHttp Client] → [Pollinations AI REST API]
Underneath, add test modules branching off ViewModel & Repository.
Surround everything with a “Pollinator App” boundary.