- The Android app to display 7 days weather forecast in a ListView.
- Written in Kotlin.
- Follow the Clean Architecture (Data - Domain - Presentation layers) with MVVM.
- Weather data source: OpenWeatherMaps API.
- Allow user to input the searching term (from 3 characters).
- Caching mechanism: offline first (with cache expiry is 10 seconds in Debug mode, and 60 seconds in Release mode), then online later.
- Support orientation change: keep the current search term & forecast result after rotating screen.
- Error handling: Network issue (no network, timeout), Invalid city keyword, Invalid API key or exceed quota, When searching term is less than 3 characters.
- Support the disability to scale large text.
- Support the disability to read out the text using TalkBack controls.
- Kotlin
- Groovy: Gradle (
build.gradle
) - YAML: Gradle Version Catalogs (
libs.version.toml
), Detekt (detekt.yml
)
- Jetpack: LiveData, ViewModel, Lifecycle, Room, ViewBinding
- Material Design, ConstraintLayout
- Coroutines & Flow
- Dagger Hilt
- Retrofit, OkHttp, Gson.
- hidden-secrets-gradle-plugin to hide the API key in the
.so
native lib.
- Detekt (static code analysis for Kotlin).
- Spotless (code formatting with Ktlint built-in support).
- Android Lint.
- Unit test: MockK, Robolectric, JUnit, Turbine, MockWebServer, AndroidX test.
- UI (Instrumented test): AndroidX test, Espresso.
- Gradle Version Catalogs as a single source of truth of dependency version. Also use version-catalog-update-plugin to check for out-of-date dependencies.
- Requires tools/SDK: Android Studio Dolphin | 2021.3.1, Android SDK API level 33 & NDK, Java 11.
- To run the Detekt (static code analysis):
./gradlew detekt
. - To view all the Spotless (code formatting) errors/warning:
./gradlew spotlessCheck
. - To apply the Spotless fix automatically:
./gradlew spotlessApply
. - To run Android Lint:
./gradlew app:lintDebug
. - To run unit test:
./gradlew testDebugUnitTest
. - To run instrumented test:
./gradlew connectedAndroidTest
. - To check the out-of-date dependencies:
./gradlew dependencyUpdates -Drevision=release
.
| com.bmtriet.simpleweather
|---- data
|---- ---- local
|---- ---- ----- dao
|---- ---- ----- datasource
|---- ---- ----- entity
|---- ---- mapper
|---- ---- network
|---- ---- ----- datasource
|---- ---- ----- error
|---- ---- ----- interceptor
|---- ---- ----- response
|---- ---- ----- service
|---- ---- repository
|---- di
|---- domain
|---- ---- model
|---- ---- reposity-interface
|---- ---- usecase
|---- presentation
|---- ---- UI model
|---- ---- adapter + viewholder
|---- ---- home (Activity + Fragment + ViewModel)
|---- utils
- Clean Architecture with MVVM.
- Show the Weather Forecast in the ListView. Error handling as well as caching handling.
- Secure the OpenWeatherMap API key (inside
.so
). There is no perfect solution to hide API key on the app side. - Testing: Unit + Instrumented.
- Static code analysis.
- Support accessibility (screen reader) with TalkBack
- Support accessibility with TalkBack
Due to time constraint, I cannot finish these thing. It would be the improvement later.
- Setup CI/CI workflow.
- Modularization (at least 4 modules:
data
,domain
,presentation
,utils
). - Try the Jetpack Compose as the replacement of XML layout.