GithubHelp home page GithubHelp logo

anitaa1990 / trailersapp Goto Github PK

View Code? Open in Web Editor NEW
196.0 14.0 83.0 15.15 MB

A simple demo project for The Movie DB based on MVVM clean architecture.

Java 100.00%
android java-8 livedata databinding android-studio android-app rxjava2 retrofit2-rxjava2 dagger2-android mvvm-architecture

trailersapp's Introduction

TrailersApp

A simple demo project for The Movie DB based on MVVM clean architecture.



App Features

  • Users can view list of the latest movies of their choice.
  • Users can view list of the latest Tv series of their choice.
  • Users can filter the movies or tv series based on popularity, upcoming and top rated.
  • Users can search for any movie or tv series of their choice.
  • Users can click on any movie or tv series to watch the trailers of their choice.

App Architecture

Based on mvvm architecture and repository pattern.

The app includes the following main components:

  • A local database that servers as a single source of truth for data presented to the user.
  • A web api service.
  • A repository that works with the database and the api service, providing a unified data interface.
  • A ViewModel that provides data specific for the UI.
  • The UI, which shows a visual representation of the data in the ViewModel.
  • Unit Test cases for API service, Database, Repository and ViewModel.

App Packages

  • data - contains
    • api - contains the api classes to make api calls to MovieDB server, using Retrofit.
    • db - contains the db classes to cache network data.
    • repository - contains the repository classes, responsible for triggering api requests and saving the response in the database.
  • di - contains dependency injection classes, using Dagger2.
  • ui - contains classes needed to display Activity and Fragment.
  • util - contains classes needed for activity/fragment redirection, ui/ux animations.

App Specs

  • Minimum SDK 16
  • Java8 (in master branch) & Kotlin (in kotlin_support branch)
  • MVVM Architecture
  • Android Architecture Components (LiveData, Lifecycle, ViewModel, Room Persistence Library, Navigation Component, ConstraintLayout)
  • RxJava2 for implementing Observable pattern.
  • Dagger 2 for dependency injection.
  • Retrofit 2 for API integration.
  • Gson for serialisation.
  • Okhhtp3 for implementing interceptor, logging and mocking web server.
  • Mockito for implementing unit test cases
  • Picasso for image loading.
  • Custom Views: Loading, Side Menu

Sample App

Get it on Google Play

trailersapp's People

Contributors

anitaa1990 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

trailersapp's Issues

Android Test coverage

Hi Anita,
I tried to run a code coverage report with your code. I am getting an error as follows

com.an.trailers.api.ApiAbstract > initializationError FAILED
java.lang.Exception

Any Ideas

Data fetched from local DB doesn't show while remote request are running.

Hi! Thanks for the code sharing!
I have found you are not showing data fetched from local DB while the remote request is running:

    moviesListViewModel.getMoviesLiveData().observe(this, resource -> {
        if(resource.isLoading()) {
            //updateMoviesList(resource.data); - SHOULD BE HERE!
        } else if(!resource.data.isEmpty()) {
            updateMoviesList(resource.data);

        } else handleErrorResponse();
    });

What is the reason for such approach?

P.S.: Another point is you should not check resource.data.isEmpty() before updateMoviesList because of all movies can be removed from a remote server, but you will still have them on a local device screen

Detail Explanation

Can you please make detail post on medium(or anywhere ) on this project. Because it is too difficult to understand the code and follow the things that you have used. This is a masterpiece of code and I definitely want to learn it.

Prompting user with Network Failure

HI @anitaa1990 Great work! may I know how would you handle the the Network Error in UI ?
.doOnError(t -> onFetchFailed()) in NetworkBoundResource.java
I'm basing my code on same approach but limited understanding i have of it. I cant see how to inform UI of the network error? can you help me out with this ? i couldn't find a solution in your repository.
thanks .

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.