Skip to content

MVVM architecture using Kotlin, Dagger, Retrofit, Coroutines, Flow, StateFlow, and etc

Notifications You must be signed in to change notification settings

amit016verma/NewsApp-MVVM-Architecture

Repository files navigation

NewsApp-MVVM-Architecture

This is a News application with MVVM Architecture and Jetpack Components with unit and instrumentation testing.

Major Highlights

  • MVVM Architecture
  • Offline First architecture with a single source of truth
  • Kotlin
  • Dagger
  • Room Database
  • Retrofit
  • Coroutines
  • Flow
  • StateFlow
  • ViewBinding
  • Pagination
  • Unit Test
  • UI Test

mvvm-architecture

Feature implemented:

  • NewsApp
  • Instant search using Flow operators
    • Debounce
    • Filter
    • DistinctUntilChanged
    • FlatMapLatest
  • Offline news
  • Pagination
  • Unit Test
  • TopHeadlines of the news
  • Country-wise news
  • Multiple Languages selection-wise news
  • Multiple sources wise news

Dependency Used:

  • Recycler View for listing
implementation "androidx.recyclerview:recyclerview:1.2.1"
implementation 'androidx.recyclerview:recyclerview-selection:1.1.0' //multi item selection
  • Glide for image loading
implementation 'com.github.bumptech.glide:glide:4.11.0'
  • Retrofit for networking
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.8.0'
  • Android Lifecycle aware component
implementation 'android.arch.lifecycle:extensions:1.1.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.1'
  • Dagger for dependency Injection
implementation "com.google.dagger:dagger:2.42"
kapt "com.google.dagger:dagger-compiler:2.42"
  • For WebView browser
implementation 'androidx.browser:browser:1.4.0'
  • Room Database
implementation "androidx.room:room-runtime:2.4.2"
kapt "androidx.room:room-compiler:2.4.2"
// optional - Kotlin Extensions and Coroutines support for Room
implementation "androidx.room:room-ktx:2.4.2"
  • Paging library
implementation "androidx.paging:paging-runtime:3.1.1"
  • Local Unit test
testImplementation 'junit:junit:4.13.2'
testImplementation "org.mockito:mockito-core:4.9.0"
kaptTest "com.google.dagger:dagger-compiler:2.42"
testImplementation "android.arch.core:core-testing:1.1.1"
testImplementation "org.hamcrest:hamcrest-library:2.1"
testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.1'
testImplementation 'app.cash.turbine:turbine:0.12.1'
testImplementation 'androidx.test.espresso:espresso-core:3.5.0'
  • UI Test
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
androidTestImplementation "androidx.test.espresso:espresso-contrib:3.4.0"
androidTestImplementation "androidx.test.espresso:espresso-intents:3.4.0"
androidTestImplementation "org.mockito:mockito-core:4.9.0"
androidTestImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.1'
androidTestImplementation "org.mockito:mockito-core:4.9.0"
kaptAndroidTest "com.google.dagger:dagger-compiler:2.42"

The Complete Project Folder Structure

├── NewsApplication.kt
├── data
│   ├── api
│   ├── local
│   ├── model
│   └── repository
├── di
│   ├── component
│   ├── module
│   ├── qualifiers.kt
│   └── scopes.kt
├── ui
│   ├── MainActivity.kt
│   ├── base
│   ├── country
│   ├── language
│   ├── newsListScreen
│   ├── pagination
│   ├── search
│   ├── sources
│   └── topheadline
└── utils
    ├── AppConstant.kt
    ├── DispatcherProvider.kt
    ├── Extentions.kt
    ├── NetworkHelper.kt
    ├── Resource.kt
    ├── Status.kt
    ├── TypeAliases.kt
    └── network

main_screen      search_screen

top_headline      news_source

About

MVVM architecture using Kotlin, Dagger, Retrofit, Coroutines, Flow, StateFlow, and etc

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages