Giter Site home page Giter Site logo

mohsenoid / marvel Goto Github PK

View Code? Open in Web Editor NEW
227.0 18.0 45.0 2.08 MB

Marvel Characters Android Application Assigned by smava GmbH

Home Page: http://smava.de

License: MIT License

Java 99.36% Shell 0.64%
marvel android-application dagger rxandroid rxjava ormlite timber mvp retrofit2 rxjava-android

marvel's Introduction

Marvel Application CircleCI Build Status codecov

This repository holds the source code of the Marvel Application, a simple Android client for the Marvel.com. This application was created by Mohsen Mirhoseini, as part of the technical assessment by the smava GmbH team. It also has been used as a sample project for a series of technical articles and tutorials.


What is this repository for?

  • Marvel Application
  • Version: 1.0.1
  • Last Update: Wed June 27, 2018

Screenshot Screenshot


Development Tools

  • Android Studio v3.1.3
  • gradle-plugin v4.4
  • Android SDK Build Tools v27.1.1
  • MinSdkVersion 14
  • CompileSDKVersion 27

Dependencies

  • Android Support Tools (recyclerView, cardView, vector, palette,... ) v27.1.1
  • Retrofit v2.1.0
  • OkHttp v3.4.1
  • Dagger v2.8
  • RxJava2 v2.1.13
  • RxAndroid v2.0.2
  • RxBinding v2.1.1
  • ButterKnife v8.8.1
  • Timber v4.7.0
  • Picasso v2.5.2
  • OrmLite v5.0
  • Firebase v16.0.1
  • AndroidUtils v1.0.11
  • jUnit v4.12
  • Android Support Test v1.0.2
  • Mockito v1.10.19
  • Robolectric v3.8
  • Espresso v2.2.2

Important Notes

The application includes two Activities, Main and Character Activities. The Main Activity is consist of two Fragments, Search and Cache Fragments, which are responsible for searching new Marvel characters and presenting recently searched characters.

All activity lifecycle and network behaviors are implemented, and according to device size and network situation user get a good UI and UX. If no internet connection or network error, a Snackbar pops up and ask the user to turn on the network connection or retry.

Some simple Test Cases was designed to test application UI functionality and core classes using jUnit and AndroidUnitTest.

Application Structure

The Application implemented and structured based on the MVP pattern best practice, contributed by Antonio Leiva.

Whole application functionality is implemented in "Core-Lib" module using pure Java, and the "App" module contains all codes required for Android Application to load on Android OS, which can be replaced by any other interface (e.g. console app or web app)

The view (MainActivity), contain two fragments. Search and Cache fragments both contain their own presenter and implement View interfaces and the only thing that the view will do is calling a method from the presenter every time there is an interface action.

The presenter (Search or Cache Presenters), are responsible to act as the middleman between views and models. They retrieve data from Backend or Database and returns it formatted to the view. It also decides what should happens when user interacts with the view.

The models (Search Interactor), would only be the gateway to the service domain layer or business logic. In this case, it provides the data needed to be displayed in the view from Network.

The networking and API calls are managed by Retrofit and OkHttp as its httpclient, contributed by Square. It also shows decent logs while the application is running in Debug mode.

Caching characters data is done using OrmLite, a Lightweight Object Relational Mapping (ORM) Java Package. Database layer can also be done using other ORM libraries like realm or DBFlow.

Layers communications are managed by RxJava & RxAndroid contributed by ReactiveX.

Dependency Injections are being managed by Dagger created by Square and now maintained by Google.

Diagram

Some minor Android common functions are managed using AndroidUtils library, developed and published on jCenter by myself.

Whole projects Dependencies are placed in "libraries.gradle" to avoid version conflicts and redundant in different modules.

Used new DataBinding library contributed by Google in Adapters for faster development, and added CustomBindingAdapter to handle downloading and caching images using Picasso library, which also use Google Palette support library as a helper class to extract prominent colors from image and making a related background for a better UI/UX.

The Android Log system is replaced with Timber contributed by Jake Wharton, which avoids logging in the release version.

A general HashGenerator class generates the hash key required for calling API using params.

Used new SupportVector library in some icons cases for a better UI.

Used new Google Firebase as application Analytics and CrashReport services.

Sample test cases are implemented by mockito, espresso, robolectric and mocking dagger.

Finally, used circleci and travis ci as Continues Integration services which are bind with Github repo.


Read more...

You can read more about this sample project in this 5-part article:

and to get the exact code at that point check out this tag: https://github.com/mohsenoid/marvel/releases/tag/Yet-another-MVP-article

marvel's People

Contributors

deep2origins avatar mohsenoid 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  avatar  avatar  avatar  avatar

marvel's Issues

RxJava+Ormlite?

Hi, really nice App architecture. I've a question, why didn't you wrap the database related operations within a rx.Observable?

I mean, for example in the SearchFragment you called the Presenter's loadCharactersCachedData() method, which later calls the DatabaseHelper's selectAllCharacters() method, which runs on the UI thread, should that kind of operations run on a background thread wrapped inside a rx.Observable?

Same thing with the Presenter's doSearch() method, in that case you wrapped the operation in a rx.Observable but you made it run over AndroidScheduler.mainThread(), shouldn't run over some other background thread such as Scheduler.io()?

Sync Project error - Execution failed for task ‘:marvel-app:processMockDebugGoogleServices’.

When I tried to sync my project after configure all my grades files I have this error:

Error:Execution failed for task ‘:marvel-app:processMockDebugGoogleServices’.

No matching client found for package name ‘test.marvel.debug’

I don’t know if I need to configure something on developers.google.com

I’m seeing that your google-service.json has this part that I don’t have

"client_info": {
  "mobilesdk_app_id": "1:917870933295:android:f40c157f10d0958b",
  "android_client_info": {
    "package_name": "com.mirhoseini.marvel.debug"
  }
}

Edit

To hide the error I added your id's. This part of the code I added to my project :(

{
      "client_info": {
        "mobilesdk_app_id": "1:917870933295:android:f40c157f10d0958b",
        "android_client_info": {
          "package_name": "com.mirhoseini.marvel.debug"
        }
      },
      "oauth_client": [
        {
          "client_id": "917870933295-657emgd5pnl2j8lpkfk87unefkub69ol.apps.googleusercontent.com",
          "client_type": 3
        }
      ],
      "api_key": [
        {
          "current_key": "AIzaSyBdbZt2_S2y2-jYVn7xfeyAwMAN7ePfTD0"
        }
      ],
      "services": {
        "analytics_service": {
          "status": 1
        },
        "appinvite_service": {
          "status": 1,
          "other_platform_oauth_client": []
        },
        "ads_service": {
          "status": 2
        }
      }
    }

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.