Skip to content

Simple movie app. Demonstrates Android Architecture Components (Navigation, WorkManager, LiveData, Room, DataBinding etc.), ServiceLocator, Retrofit, MVVM and testing.

License

Notifications You must be signed in to change notification settings

ersiver/MovieToWatch

Repository files navigation

MovieToWatch

MovieToWatch is a demo movie app developed in Kotlin, that demonstrates use of the latest Android development techniques. The app integrates Kotlin Coroutines with Retrofit to fetch movie information and binds all UI components in the XML layout to data sources using a DataBinding rather than programmatically. The UI calls are done in Binding Adapters reducing boilerplate code in the fragments. All is done following MVVM pattern for the presentation layer. Using repository the web services and Room operations are abstracted from the rest of the app.

Tech stack & Open-source libraries

Android Architecture Components & Third Party:

  • Retrofit library to connect to a REST web service on the internet and get a response.
  • Moshi library to parse the JSON response into a data object.
  • Android Architecture Components: Room, ViewModels, LiveData, DataBinding to hold the data and update the UI.
  • WorkManager to schedule background work.
  • ServiceLocator to construct and store a repository.
  • Kotlin Coroutines to manage long running network and database tasks.
  • Navigation Components and SafeArgs for navigating and passing data between fragments.
  • Glide to load posters.
  • Timber for better log readability.

Testing

Instrumented Tests

  • Database Testing: Database is tested with small instrumented unit tests. The project creates an in memory database for database test but still runs them on the device. runBlockingTest is used whenever Coroutines are run from the tests.
  • Fragments Tests: Fragments' are tested using Espresso UI framework, FragmentScenario for Fragments' lifecycle state, test doubles FakeRepository and NavController mock created with Mockito.
  • WorkManager Testing - The app tests CoroutineWorker with TestListenableWorkerBuilder.

Local Unit Tests

  • ViewModel Test: ViewModels are tested using local unit tests with fake Repository implementation.
  • Repository Test: Repository is tested using local unit tests with fake versions of DataSource and network Service.

Features

  • Get the list instantly when typing.
  • Save the selected movies to the list.
  • Delete by clicking on the button revealed when swiping the selected movie

Open API

  • MovieToWatch uses the TMDBApi for constructing RESTful API. Obtain your free API_KEY: and paste it to the Constants file to try the app.

License

License

Copyright 2020 Ersiver

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.




About

Simple movie app. Demonstrates Android Architecture Components (Navigation, WorkManager, LiveData, Room, DataBinding etc.), ServiceLocator, Retrofit, MVVM and testing.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages