A News app is a sample app consist of three screens: Splash, news list and details news. App is illustrating current Android Architecture.
The application uses combined MVVM and Clean Architecture and Repository patterns. MVVM is a template of a client application architectureImplemented and it is separate data presentation logic from business logic by moving it into particular class for a clear distinction. Implemented Architecture principles follow Google recommended [Impilimentation guidance to app architecture] (https://developer.android.com/jetpack/docs/guide).
The application is written entirely in Kotlin.
Android Jetpack is used as an Architecture glue including but not limited to ViewModel, LiveData, Lifecycles, Navigation, and Room.
The application does network HTTP requests via Retrofit, OkHttp and GSON. Loaded data is saved to SQL based database Room, which serves as single source of truth and support offline mode.
Kotlin Coroutine is a way of doing things asynchronously in a sequential manner. Creating a coroutine is a lot cheaper vs creating a thread. Kotlin Coroutines manage background threads with simplified code and reducing needs for callbacks. Combination of Coroutines and Kotlin build in functions (transformation, collections)
Dagger 2 is used for architecture level dependency injection.
Glide is used for image loading.
- Code is even more easily testable than with plain MVVM.
- Code is further decoupled.
- The project is even easier to maintain.
- Team member can add new features even more quickly.
- It has a slightly steep learning curve. How all the layers work together may take some time to understand, especially if you are coming from patterns like simple MVVM or MVP.
- It adds a lot of extra classes, so it’s not ideal for low-complexity projects.
- For testing framework used Espresso (UI test)
- JUnit4 used to test classes
Copyright [2020] [Jawad Usman]
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.