Skip to content

Florian-Martin/times-news

Repository files navigation

Times News 📰

Times News is a sample press articles Android application built to demonstrate use of Modern Android development tools.

About ⁉️

The application works with New York Times API to fetch and display different kinds of articles : Newswire, categorized articles and also trending articles.
User can navigate through all kinds of articles via a BottomNavigationView.
To ensure a better user experience, articles are cached in device's database after having been fetched from New York Times API. This means that user never faces a blank screen if he's experiencing network connection problems, as data is synchronized and loaded only from device's database.

Download ⬇️

  • Download latest release here

Built with 🛠

  • Kotlin - First class and official programming language for Android development.
  • Coroutines - For asynchronous and more..
  • Flow - A cold asynchronous data stream that sequentially emits values and completes normally or with an exception.
  • Android Architecture Components - Collection of libraries that help you design robust, testable, and maintainable apps.
    • LiveData - Data objects that notify views when the underlying database changes.
    • ViewModel - Stores UI-related data that isn't destroyed on UI changes.
    • ViewBinding - Generates a binding class for each XML layout file present in that module and allows you to more easily write code that interacts with views.
    • Room - SQLite object mapping library.
    • RecyclerView + ListAdapter - Presenting List data in a RecyclerView, including computing diffs between Lists on a background thread
  • Retrofit - A type-safe HTTP client for Android and Java.
  • Moshi - A modern JSON library for Kotlin and Java.
  • Moshi Converter - A Converter which uses Moshi for serialization to and from JSON.
  • Coil-kt - An image loading library for Android backed by Kotlin Coroutines.
  • Safe Args - To pass data through destinations
  • Unit tests
  • Instrumented tests

Architecture 👷

The application is built following MVVM pattern, additionally a repository serves as a single source of truth for the app's data, and abstracts the source of the data (network, cache, etc.) out of the view model.

Structure 📂

├───data
│   │   AppDatabase.kt
│   │   Resource.kt
│   │   State.kt
│   │
│   ├───local
│   │       ArticlesDao.kt
│   │
│   ├───remote
│   │       BaseArticle.kt
│   │       CategorizedArticles.kt
│   │       NewsWireArticles.kt
│   │       Service.kt
│   │       TopStoriesArticles.kt
│   │
│   └───repository
│           ArticlesRepository.kt
│
├───model
│       Article.kt
│       ArticleCategory.kt
│
├───ui
│   │   ArticlesAdapter.kt
│   │   MainActivity.kt
│   │
│   ├───bookmarks
│   │       BookmarksFragment.kt
│   │       BookmarksViewModel.kt
│   │
│   ├───categories
│   │       CategoriesAdapter.kt
│   │       CategorizedArticlesFragment.kt
│   │       CategorizedArticlesViewModel.kt
│   │
│   ├───detail
│   │       ArticleDetailFragment.kt
│   │       ArticleDetailViewModel.kt
│   │
│   ├───newswire
│   │       NewswireFragment.kt
│   │       NewswireViewModel.kt
│   │
│   ├───splash
│   │       SplashActivity.kt
│   │       SplashViewModel.kt
│   │
│   └───trending
│           TrendingFragment.kt
│           TrendingViewModel.kt
│
└───utils
        BaseUtils.kt
        Constants.kt
        SwipeToDeleteCallback.kt