Giter Club home page Giter Club logo

ersiver / movietowatch Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 1.0 25.85 MB

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

License: Apache License 2.0

Kotlin 100.00%
movieapp android-architecture-components room kotlin-coroutines servicelocator testing retrofit2 mvvm databinding testlistenableworkerbuilder fragment-scenario

movietowatch's Introduction

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.




movietowatch's People

Contributors

ersiver avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

kcmkcm1234

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.