This is a simple yet modern Android app that displays a list of planets fetched from the Star Wars API (SWAPI). The project demonstrates the use of Jetpack Compose, MVVM with Clean Architecture, and modern Android development practices.
- Fetches and displays a scrollable list of planets from SWAPI.
- Each planet card shows:
- Name
- Climate
- Placeholder image from Picsum Photos
- Tap on a planet to view detailed information:
- Name
- Orbital Period
- Gravity
- Larger image
- Jetpack Compose for UI
- MVVM with Clean Architecture
- Kotlinx Serialization for JSON parsing
- Retrofit for network calls (with optional unsafe client fallback for SSL)
- Koin for Dependency Injection
- StateFlow for reactive UI state management
- Navigation Compose for screen transitions
- Kotlin Coroutines
- Room DB
- Material 3
- Used
@SerializableandJson.encodeToStringto passPlanetobjects between screens, avoidingParcelable. ⚠️ UnsafeOkHttpClientwas temporarily used to bypass SSL issues for development againsthttp://swapi.dev. Not recommended for production.- Images are fetched deterministically using
planet.name.hashCode()as a seed to Picsum.
- Clone the repo:
git clone https://github.com/your-username/star-wars-planets.git
- Open the project in Android Studio.
- Build and run on an Android device or emulator.
-
Offline Data Caching
Planets are cached locally using Room database on the first successful network call. -
Offline Mode UI
When the app is offline:- A semi-transparent red banner is displayed at the bottom.
- Data is served from the local database.
- The banner updates to green with “Online” once connection is restored, then auto-dismisses after 2 seconds.
-
Auto Reload on Reconnection
If the app was offline and network becomes available, it automatically re-fetches the latest planet list to keep the data fresh. -
No Internet & No Data
A graceful error is shown if there’s no internet and no previously cached data.
This project uses GitHub Actions to automate the build process for the Android application. The pipeline is triggered on every push to the development branch and performs the following tasks:
- Checkout the Code: Retrieves the latest code from the repository.
- Build Debug APK: Uses Gradle to build the debug APK with
assembleDebug. - Rename APK Based on Branch: Renames the generated APK to include the branch name (
main,dev, orfeature) for clarity. - Upload APK as an Artifact: The renamed APK is uploaded and made available as a downloadable artifact from the GitHub Actions run.
- v1 - Core feature (Splash Screen, List Screen and Details Screen) - DONE
- v2 - Offline Support (DONE)
- v3 - Pagination (PENDING)