Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coding Challenge Completed #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

naushahi
Copy link

My Approach

This PR implements the Android Books List Application using a structured and modular architecture, specifically the Model-View-Presenter (MVP) pattern, alongside dependency injection with Dagger and Data Binding for UI updates. This approach ensures scalability, and separation of concerns across the application.

Architecture Overview

MVP (Model-View-Presenter): This project utilizes the MVP architecture to separate the presentation layer from the business logic.

View: Defines the contract for UI updates, like displaying data or errors.

Presenter: Acts as an intermediary that handles UI logic, interacts with the Use Case, and updates the View based on the model's response.

Model: Contains business logic and provides data to the Presenter via repository and use case layers.

Classes Overview

BooksMvpView: The interface that declares UI update methods (showLoading, displayBooks, and showError) for the Books List screen.

BooksListActivity: Implements BooksView, sets up RecyclerView with an adapter and item decorations, and binds UI actions. It utilizes Data Binding to display data and handle view visibility.

BooksPresenter: Interacts with the View and the Use Case (BooksUsecase) to fetch the data. Manages UI state by showing loading indicators and presenting books or errors as appropriate.

BooksRepository: Serves as the data provider, fetching data from ApiService. It handles success and failure states for API responses, ensuring that network errors are managed smoothly.

BooksUsecase: A use case class encapsulating the logic to fetch the books list from the repository. It standardizes data flow into the Presenter.

Models:

BookResponse, BookResults, Book, Isbn and BuyLink represent the data structure returned by the API.

ApiService: Retrofit-based API service that manages HTTP requests, particularly for fetching the list of books.

Constants: Holds configuration constants, including the API key.

SpacingInRecyclerView: A custom RecyclerView ItemDecoration for setting item spacing and drawing separators between items in the book list.

Glide: Used Glide for showing images (Missed the shimmer view due to time constraints)

MyApplication: The custom Application class that initializes Dagger’s AppComponent to manage dependencies.

Additional Information

Dagger for Dependency Injection: This ensures all dependencies are efficiently managed, promoting modularity and testability.

Retrofit for Networking: A REST client used for API calls.

Data Binding: Simplifies the process of binding UI components to data sources, enabling dynamic updates without manual intervention.

I was not able to add Unit Tests because of shortage of time.

TODO

Due to shortage of time I was not able to add following:

  • Test Cases.
  • navGraph and add detail screen of Book
  • Splash Screen
  • Base classes like, BaseActivity, BasePresenter etc etc.
  • Fragments
  • ROOM Database
  • Fancy UI
  • Support for Tablets

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant