Skip to content
This repository has been archived by the owner on Jul 26, 2021. It is now read-only.

[DEPRECATED] Android App done as part of the Google Codelab "Android Paging v1.x". This repository is no longer maintained.

Notifications You must be signed in to change notification settings

kaushiknsanji/PagingSampleCodelab_v1.x

Repository files navigation

Android Paging v1.x Sample

This App has been developed, following the instructions given in the Google Codelab Android Paging. The original code by Google for this codelab can be referred here, which contains codes written in Kotlin.

This Sample here has been rewritten in Java for Java Developers!

Deprecation Note: With the new and updated "Paging library v3.x" and the updated source documentation which has Java based codes, this repository is enough outdated and hence archiving it. Thank you all for the support till date.

What you will build

The App displays a list of Github Repositories using the Github API for the search query entered. The query will be searched in the Name and Description fields of the Github repositories. The data is saved in the local database cache that is backed by the network data. As the user scrolls to the end of the displayed list, a new network request is triggered and the results are displayed and saved in the database.

This App sample here uses -

  • Room - for local database cache.
  • LiveData and ViewModel - for maintaining the data of the App.
  • DataBinding - for binding View elements to their data. (Not present in the Google's Kotlin sample which employs Kotlin's features and Android KTX to accomplish the same)
  • Retrofit and Okhttp - for communicating with the Github API.
  • Repository pattern as per the Guide to App Architecture.
  • Java 8 lambdas.

In this Codelab, one will learn how to integrate the Paging Library components to accomplish the pagination task.

Getting Started

  • Android Studio 3.0 or higher
  • Familiarity with Android Architecture Components and DataBinding(only for understanding purpose).

Branches in this Repository

  • todo-starter-code
    • This is the repository to start working with.
    • Contains codes written in Java.
    • Contains TODOs where one needs to write code. This is suitably marked such that a Java developer can follow with the existing Kotlin Codelab.
    • Each Codelab step where one needs to write code, has been marked with the TODO comment following the syntax //TODO(Step-X): where X is the Codelab Step number. This number may change if the original codelab changes.
  • solution-code
    • This is the repository for the Solution code written in Java.

Differences with respect to the Original Kotlin sample

  • Firstly, the entire code has been rewritten in Java. Hence it uses Java 8 lambdas in places suitable for its usage.
  • Binding View elements to their Data is carried out by DataBinding. In the Kotlin version, it uses the Kotlin features and Android KTX.
  • Original version uses EditText for capturing User's Search query. In this sample, it is replaced with the TextInputEditText as per the recommendation for the TextInputLayout used.
  • The String resources contains a Unicode character that is not interpretable in Android versions 5.0 or below. This is replaced with %s and the corresponding value is set in the Activity code that displays it.

Sample Screenshot

References

References used for rewritting code in Java -

About

[DEPRECATED] Android App done as part of the Google Codelab "Android Paging v1.x". This repository is no longer maintained.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages