Skip to content

kaushiknsanji/TopStoriesTicker

Repository files navigation

Top Stories Ticker

GitHub GitHub code size in bytes GitHub repo size GitHub release (latest by date) GitHub All Releases GitHub search hit counter Minimum API level

This App has been developed as part of the 30 Days of Kotlin with Google Developers. App simulates a News Ticker. Its source is the Guardian News API which loads only the Editor-Picked News Items one-by-one (ticker).


App Compatibility

Android device running with Android OS 5.0 (API Level 21) or above. Best experienced on Android Nougat 7.1 and above. Designed for Phones and NOT for Tablets.


Getting Started

  • Register for the Developer API Key from the Guardian Open Platform. Registration is free of cost.
  • Create a Properties File named credentials.properties in the Project's root folder.
  • Define a property named GUARDIAN_API_KEY_VAL and assign it the value of the API Key obtained from the Registration process.
  • If the above API Key is not defined, then the App will use the default "test" API Key which is heavily rate-limited. Whenever the rate-limit is hit, the app may crash or not display proper results.
  • The Developer API Key is also rate-limited, but not as limited as the default "test" API Key.

Video Preview

Video of Complete App Flow


Built With

  • Kotlin
    • Android KTX
    • Sealed Classes, Data Classes
    • Coroutines and Coroutines Flow
    • Scope functions
    • Extensions
    • Singleton Objects, Companion Objects
    • Higher Order functions
    • Safe access, Type cast, Safe cast
    • Inline functions
    • Annotations
    • Generics
    • Late Initialization
    • String templates
  • Constraint Layout library to make layouts for News Article Items.
  • Material Design library for Card layouts of News Articles Items.
  • ViewModel and LiveData to maintain the Activity's state, handle user actions and communicate updates done to the Repository.
  • Dagger for dependency injection of required services to the clients.
  • Glide to load Images.
  • Retrofit and OkHttp to communicate with the Guardian News API via REST calls.
  • GSON to deserialize JSON to Java Objects.

Architecture

  • App follows MVVM with Repository pattern as proposed by MindOrks in their course.
  • Coroutines Flow has been used to emit the Articles one at a time to simulate a News ticker. Exceptions are handled using its CoroutineExceptionHandler, onCompletion block and onCatch block. Flow is switched to work in IO Dispatcher to avoid blocking the UI.
  • Top Stories news feed that shows a list of Editor-Picked News Items is retrieved from the International endpoint. Content is only affected by the start date (from-date query parameter) of the News feed mentioned in the Request URL.

Branches in this Repository

  • master
    • This is the main branch.
    • Contains the code submitted for the event. This is till and including this commit.
    • Following fixes were added after submission -
      • Expanding/Collapsing the News Article Item - (commit and commit)
      • Download progress indication - (commit)
      • Checking Network Connectivity - (commit)
      • Restore RecyclerView Scroll position - (commit)
    • Updates from other branches merged into this.
  • release_v1.0
    • Bumped versions of dependencies to their latest version and tested - (commit)
    • Added Proguard Rules to keep the Model classes "AS IS" - (commit)
    • Other minor changes to prepare the app for release - (commit)

Icon credits

App Icon is from Icons8.


Participation Certificate

Participation Certificate

License

Copyright 2020 Kaushik N. Sanji

Licensed under the Apache License, Version 2.0 (the "License"); 
you may not use this file except in compliance with the License. 
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0
   
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.