Guest User

Untitled

a guest
Aug 22nd, 2020
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 1.58 KB | None | 0 0
  1. apply plugin: 'kotlin-kapt'
  2.  
  3.     //Dagger2
  4.     api "com.google.dagger:dagger:$dagger_version"
  5.     kapt "com.google.dagger:dagger-compiler:$dagger_version"
  6.     api "com.google.dagger:dagger-android:$dagger_version"
  7.     api "com.google.dagger:dagger-android-support:$dagger_version" // if you use the support libraries
  8.     kapt "com.google.dagger:dagger-android-processor:$dagger_version"
  9.  
  10. //////////////////////
  11. // Top-level build file where you can add configuration options common to all sub-projects/modules.
  12. buildscript {
  13.     ext.kotlin_version = "1.4.0"
  14.  
  15.     repositories {
  16.         google()
  17.         jcenter()
  18.         mavenCentral()
  19.     }
  20.     dependencies {
  21.         classpath "com.android.tools.build:gradle:4.0.1"
  22.         classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
  23.  
  24.         // NOTE: Do not place your application dependencies here; they belong
  25.         // in the individual module build.gradle files
  26.     }
  27.  
  28.  
  29. }
  30.  
  31. allprojects {
  32.     repositories {
  33.         google()
  34.         jcenter()
  35.         mavenCentral()
  36.     }
  37. }
  38.  
  39. task clean(type: Delete) {
  40.     delete rootProject.buildDir
  41. }
  42.  
  43. ///////////////////////////////////
  44. @Component(modules = [ViewModelModule::class])
  45. @Singleton
  46. interface DiAppComponent {
  47.     fun getMainViewModel2(): MainViewModel
  48. }
  49.  
  50. //////////////////////////////////
  51.  
  52. class MainViewModel @Inject constructor() : BaseViewModel() {
  53.  
  54. /////////////////////////////////
  55.  
  56. @Module
  57. class ViewModelModule {
  58.  
  59.     @Provides
  60.     @Singleton
  61.     fun getMainViewModel(): MainViewModel {
  62.         return MainViewModel()
  63.     }
  64. }
  65.  
  66.  
Advertisement
Add Comment
Please, Sign In to add comment