Cool app for Marvel's characters fans with some cool features like searching heroes, save favorite heroes and display hero details.
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.
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.
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
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!
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.
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
@Module
s,@Component
s,@ContributesAndroidInjector
s, 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 forAdapter
,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.
The file buildsystem/dependencies.gradle
contains all the library dependencies used
in the project. It is organized by region
s according to context like support library,
architecture, UI, network, testing (unit and instrumentation).
- Kotlin Standard Library 1.2.51
- Kotlin Coroutines
- appcompat-v7 27.1.1
- Design 27.1.1
- cardview-v7 27.1.1
- support-fragment 27.1.1
- constraint-layout 1.1.0
- SuperRecyclerView 1.1.4
- Glide 4.7.1
- Glide Compiler 4.7.1 (for kapt)
- ReadMoreTextView 2.1.0
- Gson
- OkHttp 3
- Retrofit 2
- RxJava 2
- Okio 1.14.0
- Architecture Components (Lifecycle, Room & LiveData)
- Dagger 2
- Room
- JUnit 4.1.2
- Mockito-Android 2.19.0
- Hamcrest 1.3
- espresso-core 3.0.2
- espresso-intents 3.0.2
- espresso-contrib 3.0.2
- espresso-idling-resource 3.0.2
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.