/android-arch-news-sample

Simple News app built using some parts of Android Architecture

Primary LanguageJavaMIT LicenseMIT

Android Architecture NewsApp Sample

GitHub license

During Google I/O 2017, Android Team announced guidelines for architecture of Android app. This is just sample app explaining the new Architecture Guidelines written in Kotlin, YAY!

Components Demonstrated

What's the app about?

It's an extremely simple app which uses NewsAPI to show the latest news from Google News. It uses Retrofit 2 to fetch the news from the API and save them into database using Room. The main aim of this sample app is show how to use the new Architecture Guidelines with Kotlin.

Steps to run:

  • Go to NewsAPI and generate an API key (It's only 2 steps!)
  • Put the API key at the bottom of the gradle.properties NEWS_API_KEY = "YOUR_API_KEY"
  • Run the app
  • Enjoyyyyy 🎉

Architecture

The app uses ViewModel to abstract the data from UI and Repository as single source of truth for data. Repository fetch the data from database if it doesn't exist then it fetches from the webservice.

Architecture


Screenshots

NewsApp Main Page


Todo

  • Write article explaining the complete flow of application
  • Create fork of repo showing integration with Dagger 2
  • Write test cases

Prerequisites

  • Android Studio 3.0 Canary 4
  • Android Device with USB Debugging Enabled

Built With

Contributing

Please read CONTRIBUTING.md for contributions.

Proudly 💪 made in Kotlin

License


The MIT License (MIT)

Copyright (c) 2017 Akshay Chordiya

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.