Skip to content

A basic single screen android application which shows most trending repositories from Github using its public api.

Notifications You must be signed in to change notification settings

amanbindlish/trending-hub

Repository files navigation

Trending Hub - A Github Trending Repositories App (Kotlin)

A basic single screen android application which shows most trending repositories from github using its public api.

Github Trending Repositories - Kotlin

App Screens

     

App Features

  • App fetches github trending repositories and displays in RecyclerView.
  • App shows shimmer effect while data is being fetched from server.
  • App has expanded recycler view where the items expand on single tap and collapse if expanded.
  • 100% offline support. If data has been fetched once, then it will be served from db (Room).
  • The cached data is only valid for 2 hours, after which data will be fetched again from server.
  • Repository class where database serves as a single source of truth for data.
  • Pull to refresh functionality to fetch updated data forcefully.
  • Error cases handled and an error screen with retry button is shown in case of error.
  • Sort by Stars and Sort by Names functionality for data sorting.
  • App includes UI and unit testing using Junit4 and Espresso.

App Architecture

Based on MVVM architecture and repository pattern, where database serves as a single source of truth for data.

App Specs

  • Minimum SDK 19
  • Java8
  • Kotlin
  • MVVM Architecture
  • Android Architecture Components (LiveData, Lifecycle, ViewModel, Room Persistence Library, ConstraintLayout)
  • Lifecycle-aware components
  • Dagger 2 for dependency injection.
  • Retrofit 2 for API integration.
  • LiveData for data observation.
  • ViewModels for data container.
  • Room for data persistence.
  • Gson for serialisation.
  • Okhhtp3 for implementing interceptor, logging and mocking web server.
  • Mockito for implementing unit test cases.
  • Glide for image loading.

App includes following main components:

  • A local database with Room that servers as a single source of truth for data to display on UI.
  • A public github api for fetching data from server (https://github-trending-api.now.sh/repositories).
  • A repository that works with the database and the api service, providing a unified data interface.
  • A ViewModel that provides data specific for the UI.
  • The UI, which shows a visual representation of the data in the ViewModel.
  • UI testing using Espresso and mock server for activity and fragment.
  • Unit Test cases for API service, Api Response, Database, Repository and ViewModel.

App Packages

  • data package containing classes related to api, response and repository.
  • db package containing classes for local room database and dao.
  • di package containing classes for dependency injection (modules, components).
  • ui package containing classes for activity, fragments and adapter.
  • viewmodel package for viewmodel classes.

You can reach out to me for any updates and explanation and can also create pull requests for your updates here.

Follow me on

About

A basic single screen android application which shows most trending repositories from Github using its public api.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages