Code Monkey home page Code Monkey logo

news's Introduction

News App ๐Ÿ—ž

GitHub license

News App is a simple news app ๐Ÿ—ž๏ธ which uses NewsAPI to fetch top news headlines from the API. The main aim of this app is to be a leading example of how to build Modern Android applications for all Android Developers

The codebase focuses ๐Ÿ‘“ on following key things:

  • Code structuring, style and comments
  • Dependency injection ๐Ÿ—ก
  • Offline first โœˆ๏ธ
  • Kotlin + Coroutines
  • And tests ๐Ÿ› 
  • Emojis (ofcourse) ๐Ÿ˜›

The idea is to keep the app super simple while demonstrating new libraries and tools which makes it easier to build high quality Android applications.

NewsApp Main Page

Development Setup ๐Ÿ–ฅ

You will require latest version of Android Studio 3.0 (or newer) to be able to build the app

API key ๐Ÿ”‘

You'll need to provide API key to fetch the news from the News Service (API). Currently the news is fetched from NewsAPI

  • Generate an API key (It's only 2 steps!) from NewsAPI
  • Create new file named -> credentials.properties in our project root folder
  • Add the API key as shown below [Make sure to keep the double quotes]:
    NEWS_API_KEY = "<INSERT_YOUR_API_KEY>"
  • Build the app
  • Enjoyyyyy ๐ŸŽ‰

Libraries and tools ๐Ÿ› 

News App uses libraries and tools used to build Modern Android application, mainly part of Android Jetpack ๐Ÿš€

Architecture

The app uses MVVM [Model-View-ViewModel] architecture to have a unidirectional flow of data, separation of concern, testability, and a lot more.

Read more:

Architecture

Dependency Graph ๐Ÿ”ช

The following diagram shows the dependency graph of the app.

News App Dependency Graph

Generated by Daggraph


Learn Architecture Components

Trying to learn the new Architecture Components. I have wrote a series of articles to understand Android Architecture Components. Feel free to check it out to learn more.

Extra - Caster.io Course and Podcast

Testing

The architecture components are highly testable. Following table shows how to test various parts of the app (cheatsheet for testing architecture component)

Component Test Mock
UI Espresso ViewModel
ViewModel JUnit Repository
Repository JUnit DAO and WebService
DAO Instrumented -
WebService Instrumented MockWebServer

Contributing

Please read CONTRIBUTING.md for contributions.

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.

news's People

Contributors

akshaychordiya avatar veerhan avatar pranaypatel512 avatar swapnilmadavi avatar ezike avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.