File tree Expand file tree Collapse file tree 6 files changed +12
-21
lines changed
src/main/java/ru/otus/daggerhomework Expand file tree Collapse file tree 6 files changed +12
-21
lines changed Original file line number Diff line number Diff line change @@ -5,13 +5,12 @@ plugins {
55}
66
77android {
8- compileSdkVersion 30
9- buildToolsVersion " 30.0.3"
8+ compileSdkVersion 31
109
1110 defaultConfig {
1211 applicationId " ru.otus.daggerhomework"
1312 minSdkVersion 23
14- targetSdkVersion 30
13+ targetSdkVersion 31
1514 versionCode 1
1615 versionName " 1.0"
1716
@@ -39,6 +38,6 @@ dependencies {
3938 implementation ' androidx.appcompat:appcompat:1.3.1'
4039 implementation ' com.google.android.material:material:1.4.0'
4140 implementation ' androidx.constraintlayout:constraintlayout:2.1.0'
42- implementation ' com.google.dagger:dagger:2.38.1 '
43- kapt ' com.google.dagger:dagger-compiler:2.38.1 '
41+ implementation ' com.google.dagger:dagger:2.42 '
42+ kapt ' com.google.dagger:dagger-compiler:2.42 '
4443}
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import androidx.appcompat.app.AppCompatActivity
44import android.os.Bundle
55
66class MainActivity : AppCompatActivity () {
7+
78 override fun onCreate (savedInstanceState : Bundle ? ) {
89 super .onCreate(savedInstanceState)
910 setContentView(R .layout.activity_main)
Original file line number Diff line number Diff line change 11package ru.otus.daggerhomework
22
3- import android.app.Activity
43import android.content.Context
54import android.widget.Toast
65import androidx.fragment.app.FragmentActivity
7- import androidx.lifecycle.ViewModel
8- import java.lang.RuntimeException
96
107class ViewModelProducer (
118 private val colorGenerator : ColorGenerator ,
129 private val context : Context
13- ) : ViewModel() {
10+ ) {
1411
1512 fun generateColor () {
1613 if (context !is FragmentActivity ) throw RuntimeException (" Здесь нужен контекст активити" )
Original file line number Diff line number Diff line change @@ -3,13 +3,10 @@ package ru.otus.daggerhomework
33import android.app.Application
44import android.content.Context
55import android.widget.Toast
6- import androidx.fragment.app.FragmentActivity
7- import androidx.lifecycle.ViewModel
8- import java.lang.RuntimeException
96
107class ViewModelReceiver (
118 private val context : Context
12- ) : ViewModel() {
9+ ) {
1310
1411 fun observeColors () {
1512 if (context !is Application ) throw RuntimeException (" Здесь нужен контекст апликейшена" )
Original file line number Diff line number Diff line change 11// Top-level build file where you can add configuration options common to all sub-projects/modules.
22buildscript {
3- ext. kotlin_version = " 1.4.32 "
3+ ext. kotlin_version = " 1.6.21 "
44 repositories {
5+ mavenCentral()
56 google()
6- jcenter()
77 }
88 dependencies {
9- classpath " com.android.tools.build:gradle:4.1.2 "
9+ classpath " com.android.tools.build:gradle:7.0.4 "
1010 classpath " org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version "
11-
12- // NOTE: Do not place your application dependencies here; they belong
13- // in the individual module build.gradle files
1411 }
1512}
1613
1714allprojects {
1815 repositories {
16+ mavenCentral()
1917 google()
20- jcenter()
2118 }
2219}
2320
Original file line number Diff line number Diff line change @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33distributionPath =wrapper/dists
44zipStoreBase =GRADLE_USER_HOME
55zipStorePath =wrapper/dists
6- distributionUrl =https\://services.gradle.org/distributions/gradle-6.5 -all.zip
6+ distributionUrl =https\://services.gradle.org/distributions/gradle-7.4.2 -all.zip
You can’t perform that action at this time.
0 commit comments