/Marvelist

Marvel comic book tracker for physical comics.

Primary LanguageKotlin

Marvelist

A Marvel comic book tracker that tracks reading progress on physical or digital comics. Video demo here.

Marvelist Demo

Features Include:

  • Browsing for comics (sorted by the latest modified)
  • Saving comics to the reading list (via long press)
  • Updating the reading progress for each comics.
  • A detailed page for the comic (e.g. author name, credits, sale date).

Table of Contents

Usage

  • How do you load more comics?

    • In the Browse section, the app will automatically load for more comics from the network as it scrolls down. (Paging/Pagination)
  • How to save a comic?

    • Simply long press a comic in the Browse section of the app. A message will pop up saying that "Comic Title has been added to the list".
  • How to update reading progress of a comic?

    • Press any of the Reading, Unread, and Read chips in the reading list section. Note: The reading list will be empty if you've havent added a comic yet.
    • No save button needed, once the chips have been pressed the reading progress is saved.

Architecture and Navigation Structure Summary

This app was created with the MVVM architecture and a "1 Activity hosting many fragments" navigation structure (Navigation Component).

Model-View-Viewmodel Overview

  • The Model layer contains a repository of data that can be from the network or the local database. Only the ViewModel knows about the Model layer.
  • The View observes data that's been exposed/emitted from the View Model and updates the UI accordingly. This layer only knows about the View Model.
  • The View Model exposes and formats data from the Model layer and only knows about the Model.

Navigation Overview

The NavigationHostActivity is in charge of navigating/swapping out the different fragments (via Navigation Component). By default the Browse fragment is shown first, the user can navigate to the Browse and Reading List section of the app through the navigation drawer. The Comic Detail section can only be accessed through the Browse or Reading List fragments as shown below:

View

There are three different Views in this app's architecture and they are the BrowseFragment, ComicDetailsFragment, and the ReadingListFragment. All these Fragments observe their respective ViewModels and display the data that's been observed. The reference graph can be seen below:

BrowseFragment

  • Lazily loads a list of comics (picture, title, description) in the UI.
  • Handles long press interaction (Long press to save a comic to the reading list)

ComicDetailsFragment

  • Shows a more detailed represenation of the comic thats been tapped on from the Browse or Reading List section.
  • This Fragment request more info about the comic from its ViewModel to display into the UI.
  • Displays author's name, list of creators involved in the comic, on sale date, foc date, etc.

ReadingListFragment

  • Shows a list of comics that's been saved to the local database.
  • Each comic item displays a group of interactable Chips that is used to track reading progress.
  • Allows deletion of comics in the reading list.

View Model

There are three different View Models the BrowseViewModel, ComicDetailsViewModel, and the ReadingListViewModel. The purpose of these models is to expose data that's relevant to the UI. For example the BrowseViewModel will retrieve/expose a data source for the purpose of loading comic book data in chunks.

BrowseViewModel

  • Retrieves the comic data source that emits comic data in chunks via Pagination Library
  • Tells the Model layer to save a specific comic book to the database.

ComicDetailsViewModel

  • Requests comic book info from the Model layer.

ReadingListViewModel

  • Requests a list of saved comic books from the Model layer.
  • Can request to remove certain comic books by id from the database.
  • Can request update changes to the reading progress property for a comic in the database.

Model

In the model layer the ComicRepository class is responsible for requesting data from the Marvel API and also updating/retrieving saved comic book data from the local Room database.

The ComicRepository depends on three classes to perform its tasks:

  1. MarvelHashUtil
    • Each API request requires a hash value, this class helps calculate that hash.
  2. MarvelComicService
    • Leverages the Retrofit library to make type safe and functionalized API requests to the Marvel comic book service.
  3. ComicInfoDao
    • A data base access object that contains methods for updating, retrieving, and removal of local comic book data.