Skip to content

ramonrabello/Marvel-Favorite-Hero-App

Repository files navigation

Favorite Hero

Cool app for Marvel's characters fans with some cool features like searching heroes, save favorite heroes and display hero details.

Setup

Introducing the Marvel API

This app was developed using Marvel API. The API is very extensive and very well documented and provides for us developers some endpoints to retrieve a lot of info like characters, creators, comics, events, stories, series and much more. I'll encourage you to read the documentation to see more details about the endpoints, authorization and other stuffs.

Getting Marvel API Keys

But first, you will need to create an developer account to get both a Public and Private Key that must be sent on every request to API's endpoints.

  • Go to Marvel Developer Portal and create a Marvel Insider account clicking in Getting Started button.

  • Fill all your information and then will be redirected to your account page. Please copy both Public Key and Private Key because you will need them on your requests.

Cloning

Now you can clone the repo. You can use any Git clients or just type this in command line:

git clone https://github.com/ramonrabello/Marvel-Favorite-Hero-App.git

Setting up API keys

Go to the build.gradle file and search for these two build config fields:

buildConfigField "String", "PUBLIC_KEY", '"GET_YOUR_API_KEY_AT_MARVEL_DEVELOPER_PORTAL"'
buildConfigField "String", "PRIVATE_KEY", '"GET_YOUR_API_KEY_AT_MARVEL_DEVELOPER_PORTAL"'

Just copy/paste your API keys and sync your project. Congratulations, now you can run the app!

Project Architecture

The project was built using the Model-View-ViewModel (MVVM) presentation pattern that eases the development by decoupling the app layers by providing more testability and promoting more reuse. The main difference between the other presentation patterns like the Model-View-Presenter (MVP) is that the MVVM has a reactive approach and implements the Observer pattern, where the UI observes model changes that are notified by ViewModel to update the UI. The overview of the MVVM presentation pattern is shown in the following image. MVVM Presentation Pattern

Project Structure

The project is entirely written using Kotlin language and it was created based on feature package convention:

  • core: All classes related the the listing of super heroes.
  • di: All classes related to Dependency Injection (DI) using Dagger 2 like @Modules, @Components, @ContributesAndroidInjectors, etc.
  • heroes: All classes related the the listing of super heroes.
  • favorites: All classes related the favorites feature.
  • detail: All classes related the the details feature.
  • core: All classes common to other projects like Views, Models, base classes for Adapter, ViewHolder, etc.
  • view: Contains all classes related to the view layer like Activities, Fragments, Adapters, ...

The following image shows how the project is structured in terms of components level. Project Architecture

Libraries

The file buildsystem/dependencies.gradle contains all the library dependencies used in the project. It is organized by regions according to context like support library, architecture, UI, network, testing (unit and instrumentation).

Kotlin

  • Kotlin Standard Library 1.2.51
  • Kotlin Coroutines

Support Library

  • appcompat-v7 27.1.1
  • Design 27.1.1
  • cardview-v7 27.1.1
  • support-fragment 27.1.1
  • constraint-layout 1.1.0

UI

  • SuperRecyclerView 1.1.4
  • Glide 4.7.1
  • Glide Compiler 4.7.1 (for kapt)
  • ReadMoreTextView 2.1.0

Network

  • Gson
  • OkHttp 3
  • Retrofit 2
  • RxJava 2
  • Okio 1.14.0

Architecture

  • Architecture Components (Lifecycle, Room & LiveData)
  • Dagger 2
  • Room

Testing

Unit Testing

  • JUnit 4.1.2
  • Mockito-Android 2.19.0
  • Hamcrest 1.3

Instrumentation Tests

  • espresso-core 3.0.2
  • espresso-intents 3.0.2
  • espresso-contrib 3.0.2
  • espresso-idling-resource 3.0.2

Screenshots

Heroes Listing and Search

Hero List

Favorite Heroes

Favorite Heroes

Hero Details

Hero Details

License

Copyright 2018 Ramon Rabello

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

Great app for Marvel's characters fans with some cool features like searching, favorite, heroes details.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages