Code Monkey home page Code Monkey logo

movieapp's Introduction

MovieApp

Kotlin Dagger2 Material design The Movie DB

Application which retrieves data from Webserver (via Retrofit), saves it into cache and get from it if user is offline. There are applying MVVM architecture pattern and Dagger 2 example.

Overview:

  • Model

    Model is implemented as Repository pattern. Firstly it begins from internet connection checking. Consequently if it's alive we're retrieving data from the server (by using Retrofit 2). Otherwise we're trying to fetch data from the cache itself.

  • View

    View is realised as 2 fragments. First one contains RecyclerView, second one depends on clicks on recycler-items and finally displays detailed data fetched from the Model. It implements state saving reflected on configuration changes.

  • ViewModel

    ViewModel is responsible for transferring data between view and model.

  • Dagger 2

    – Implementation of dependency injection for communication between app modules
    – AndroidInjector applying for injecting into View components
    – Unit-testing simplifying

Applied technologies and libraries:

  • Model

    • Network

      Retrofit 2
      – getting data from server into pojo-classes

      okHTTP
      – caching data from the server to display the movie offline

      Moshi
      – converting json to object

    • Coroutines
      – managing asynchronous network queries
      – using instead of callbacks
      – providing light asynchronous operations

  • ViewModel

    • LiveData
      – observer-pattern implementation for View interaction
  • View

    • Fragments
      – interactive displaying and click reflecting

    • Data Binding
      – replace basic operations with UI (e.g. findViewById() ) to the XML

All libraries:

  • Android X
  • Material Librarie
  • Android Jetpack
  • Dagger 2
  • Kotlin Coroutines
  • Retrofit 2
  • OkHTTP 3
  • Moshi
  • Glide

movieapp's People

Contributors

kostialeo 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

movieapp's Issues

The issue to fix:

The issue to fix:
Remove enum-class MainScreen. Since it can cause memory overload due to storing fragment-objects. Enum classes stay alive all app life, though fragments shouldn't be always in memory.

Originally posted by @KostiaLeo in #21 (comment)

Fast scrolling error

When the user quickly scrolls through the list of films and clicks on the film to display detailed information about it. The application crashes with an error:

2020-03-06 11:51:35.444 8213-8213/com.example.movieapp E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.movieapp, PID: 8213
    com.squareup.moshi.JsonDataException: Expected a string but was BEGIN_OBJECT at path $.belongs_to_collection
        at com.squareup.moshi.JsonUtf8Reader.nextString(JsonUtf8Reader.java:644)
        at com.squareup.moshi.StandardJsonAdapters$10.fromJson(StandardJsonAdapters.java:215)
        at com.squareup.moshi.StandardJsonAdapters$10.fromJson(StandardJsonAdapters.java:213)
        at com.squareup.moshi.JsonAdapter$2.fromJson(JsonAdapter.java:137)
        at com.squareup.moshi.ClassJsonAdapter$FieldBinding.read(ClassJsonAdapter.java:194)
        at com.squareup.moshi.ClassJsonAdapter.fromJson(ClassJsonAdapter.java:156)
        at com.squareup.moshi.JsonAdapter$2.fromJson(JsonAdapter.java:137)
        at retrofit2.converter.moshi.MoshiResponseBodyConverter.convert(MoshiResponseBodyConverter.java:45)
        at retrofit2.converter.moshi.MoshiResponseBodyConverter.convert(MoshiResponseBodyConverter.java:27)
        at retrofit2.OkHttpCall.parseResponse(OkHttpCall.java:225)
        at retrofit2.OkHttpCall$1.onResponse(OkHttpCall.java:121)
        at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:504)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:919)

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.