Skip to content

My Global Mailer is an app that queries the news api https://newsapi.org/ to get data and display to the user using MVVM

License

Notifications You must be signed in to change notification settings

Fbada006/GlobalMailer

Repository files navigation

Global Mailer

This is an Android Application that i built with the Android Architecture components using the recommended MVVM pattern. It displays a list of news articles by parsing the news api. I have also published it on the Google PlayStore here

Prerequisite

minSdkVersion -> 21

Gradle build system

Be sure to create a firebase project so that you can get your own google-services.json file to take full advantage of features like crashlytics. It can run without the file but it is better if you do. Head over to the api above and get your own API-KEY as well although there is a test key provided already for convenience.

TOC

Architecture

The App is not organized into multiple modules but follows the same principles of the Presentation, Domain, and Data Layers. The presentation layer handles the UI work with the logic contained in the ViewModel. The UI uses a LiveData object from the ViewModel and observes it using the Observer Pattern. A ListAdapter handles the actual displaying of the news. Data over the network is retrieved using retrofit and coroutines to handle background work asynchronously. Additionally, note that the ViewModel uses the viewModelScope to launch the couroutines while Fragments use the viewLifeCycleOwner to observe data. The data layer uses the recommended Repository Pattern to make the network calls and store the data using Room DB. This layer is also responsible for mapping the entities that eventually get displayed in the UI.

Flow

Main News Screen

This screen is visible to the user once the app is launched and immediately shows the default general data. The user then has the option of changing the preferences for use across the entire app to make other calls. The pattern used ensures that the user will always get data once there is an initial successful network call. Clicking on an item will launch a Chrome-based browser that lives within the app.

Search Screen

This screen is accessible from all the fragments except the settings one. It uses a SearchView to search data and display it. It also has its own ViewModel and RecyclerView. The network call is triggered once the user presses the search button because of the api limitations.

Libraries

This app takes use of the following libraries:

  • Jetpack🚀

    • Viewmodel - Manage UI data to survive configuration changes and is lifecycle-aware

    • Data Binding - Declaratively bind observable data to UI elements

    • Navigation - Handle everything needed for in-app navigation

    • WorkManager - Manage your Android background jobs

    • Room DB - Fluent SQLite database access

    • LiveData - Notify views when underlying database changes

  • Retrofit - type safe http client with coroutines support

  • Moshi - JSON Parser that plays nicely with Kotlin

  • okhttp-logging-interceptor - logging HTTP request related data.

  • kotlinx.coroutines - Library Support for coroutines

  • Material Design - build awesome beautiful UIs.🔥🔥

  • Firebase - Backend As A Service for faster mobile development.

    • Crashylitics - Provide Realtime crash reports from users end.
  • Like Button - Twitter's heart animation for Android

  • Lottie - Render awesome After Effects animations natively on Android and iOS, Web, and React Native

  • Chrome Custom Tabs - Allows an app to customize how Chrome looks and feels

  • Picasso - Hassle-free image loading

Extras

CI-Pipeline

Travis CI is used for Continuous Integration every time an update is made to the repo. The configuration is in the .travis.yml file

Code Analysis and test coverage

This code uses Codacy for analyszing the quality of the code while CodeCov shows the test coverage. Tests are on the way.

Screenshots

Imgur Imgur

License

  Copyright 2020 Ferdinand Bada

  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.