/jetpack-compose-modular-news-api

Android News App built with Jetpack Compose that cosume https://newsapi.org

Primary LanguageKotlin

With Light Themes

Compose News

Modular Android architecture which showcase Kotlin, MVVM, Navigation, Hilt, Coroutines, Jetpack Compose, Retrofit and Kotlin Gradle DSL.

Features

  • Modular Android App Architecture.
  • MVVM Architecture + Repository design Pattern.
  • Jetpack Libraries and Architecture Components.
  • Kotlin Gradle DSL.
  • Ready for Production

Modules

Modules are collection of source files and build settings that allow you to divide a project into discrete units of functionality. In this case apart from dividing by functionality/responsibility, existing the following dependence between them. The project is divided into 4 Modules :

App module

The :app module is an com.android.application, which is needed to create the app bundle.

Core module

The :core module is an com.android.library for serving network requests. Providing the data source for the many features that require it.

Common module

The :common module is an com.android.library only contains code and resources which are shared between feature modules. Reusing this way resources, layouts, views, and components in the different features modules, without the need to duplicate code.

Feature module

The :feature module is an com.android.library which is a module containing a specific feature, isolated from the rest in accordance with business logic.

Getting started

There are a few ways to open this project.

Android Studio

  1. Android Studio -> File -> New -> From Version control -> Git
  2. Enter https://github.com/yodeput/NewsApp-Compose.git into URL field an press Clone button

Command-line + Android Studio

  1. Run git clone https://github.com/yodeput/NewsApp-Compose.git command to clone project
  2. Open Android Studio and select File | Open... from the menu. Select cloned directory and press Open button

Project configuration

Add parameters in the locale.properties file as shown in the example below.

api_key="Your API Key"

You can get an Api Key from NEWS API ORG

  1. Open NEWS API -> Get API Key?
  2. Paste copied key into local.properties with parameter (api_key)

Tech Stack & Libraries

  • 100% Kotlin based + Coroutines + Flow
  • Android Jetpack
    • Compose Android’s modern toolkit for building native UI.
    • ViewModel UI related data holder, lifecycle aware.
    • Room construct database.
    • Navigation Android Jetpack's Navigation component helps you implement effective navigation.
    • Hilt for dependency injection.
    • App Startup Provides a straightforward, performant way to initialize components at application startup.
  • Timber A logger.
  • Accompanist - A collection of extension libraries for Jetpack Compose.
  • Landscapist Jetpack Compose image loading library that fetches and displays network images with Glide, Coil, and Fresco.
  • Sandwich construct lightweight http API response and handling error responses.
  • Kotlin coroutines Executing code asynchronously.
  • StateFlow is a state-holder observable flow that emits the current and new state updates to its collectors.
  • Retrofit is a Type-safe HTTP client for Android, Java and Kotlin by Square.
  • Moshi is a modern JSON library for Android and Java. It makes it easy to parse JSON format data.
  • OkHttp interceptor Logs HTTP requests and responses.
  • Mockito which is the most popular Mocking framework for unit tests written in Java as well as Kotlin.

Licence

Designed and developed by 2022 yodeput (Yogi Dewansyah Putra)

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.