EzekielWachira / Pixabay

This app majorly uses the paging library to load and display pages of data from a larger dataset from local storage or over network with the help of a remotemediator. A RemoteMediator object handles paging from a layered data source, such as a network data source with a local database cache

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AdaLabs-PixabayAPI Android Take Home Assignment

Problem definition You will be using the Pixabay API to create this android application Sign up for the API key on the following Link https://pixabay.com/api/docs/#api_search_images You can use Kotlin for this

Requirements

  • The user SHOULD see a list of images and the username of the owner.
  • The user SHOULD select an image and be able to view image details.
  • The user SHOULD search for images and see results in a list.
  • When the app opens let the app search for pictures of dogs as default
  • The android application SHOULD be able to work offline.

APK

Find an apk that caters for the above functional requirements on the assets folder.

Min Api Level: 21

Build System : Gradle

Tech-stack

  • Tech-stack

    • Kotlin - a cross-platform, statically typed, general-purpose programming language with type inference.

    • Coroutines - perform background operations.

    • Flow - handle the stream of data asynchronously that executes sequentially.

    • Dagger hilt - a pragmatic lightweight dependency injection framework.

    • Jetpack

      • Room - a persistence library provides an abstraction layer over SQLite.
      • LiveData - is an observable data holder.
      • Lifecycle - perform action when lifecycle state changes.
      • ViewModel - store and manage UI-related data in a lifecycle conscious way.
      • Paging 3 - The Paging library helps you load and display pages of data from a larger dataset from local storage or over network. This approach allows your app to use both network bandwidth and system resources more efficiently. .
      • Navigation components - Navigation refers to the interactions that allow users to navigate across, into, and back out from the different pieces of content within your app.
    • Glide - Glide is a fast and efficient image loading library for Android focused on smooth scrolling. Glide offers an easy to use API, a performant and extensible resource decoding pipeline and automatic resource pooling.

    • Retrofit - A type-safe HTTP client for Android and Java

  • CI/CD

    • Github Actions
  • Architecture

    • MVVM - Model View View Model

App Architecture

This app integrates directly into the recommended Android app architecture. It majorly uses the paging library to load and display pages of data from a larger dataset from local storage or over network. This approach allows your app to use both network bandwidth and system resources more efficiently.The paging lib operates in three layers :

  • The repository layer

  • The ViewModel layer

  • The UI layer

    Repository layer

    The primary Paging library component in the repository layer is RemoteMediator. A RemoteMediator object handles paging from a layered data source, such as a network data source with a local database cache.It Defines a set of callbacks used to incrementally load data from a remote source into a local source wrapped by a PagingSource, e.g., loading data from network into a local db cache.

    ViewModel layer

    The Pager component provides a public API for constructing instances of PagingData that are exposed in reactive streams, based on a PagingSource object and a PagingConfig configuration object. The component that connects the ViewModel layer to the UI is PagingData. A PagingData object is a container for a snapshot of paginated data. It queries a PagingSource object and stores the result.

    UI layer

    The primary Paging library component in the UI layer is PagingDataAdapter, a RecyclerView adapter that handles paginated data.This class is a convenience wrapper around AsyncPagingDataDiffer that implements common default behavior for item counting, and listening to update events.To present a Pager, use collectLatest to observe Pager.flow and call submitData whenever a new PagingData is emitted.PagingDataAdapter listens to internal PagingData loading events as pages are loaded, and uses DiffUtil on a background thread to compute fine grained updates as updated content in the form of new PagingData objects are received.

Testing

The App has tests on Fragments as well as unit tests under the Android Test packages in respective modules.

Screenshots

  • Screenshots

Demo recording

  • When the device is online.

  • When the device is offline.

I hope you loved this

About

This app majorly uses the paging library to load and display pages of data from a larger dataset from local storage or over network with the help of a remotemediator. A RemoteMediator object handles paging from a layered data source, such as a network data source with a local database cache


Languages

Language:Kotlin 100.0%