Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Добавлен module для создания активити как injector #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions GithubDagger/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ apply plugin: 'realm-android'

android {
compileSdkVersion 24
buildToolsVersion "24.0.2"

defaultConfig {
applicationId "ru.gdgkazan.githubmvp"
Expand Down Expand Up @@ -63,7 +62,13 @@ dependencies {
compile "com.jakewharton:butterknife:$butterKnifeVersion"
apt "com.jakewharton:butterknife-compiler:$butterKnifeVersion"

compile "com.google.dagger:dagger:$daggerVersion"
apt "com.google.dagger:dagger-compiler:$daggerVersion"
provided "javax.annotation:jsr250-api:$javaxAnnotationsVersion"
def dagger_version = "2.22"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Подозреваю, что версия dagger`а была ниже чем 2, так как было все это 3 года назад

// Dagger2 core
implementation "com.google.dagger:dagger:$dagger_version"
annotationProcessor "com.google.dagger:dagger-compiler:$dagger_version"

// Dagger Android
implementation "com.google.dagger:dagger-android:$dagger_version"
implementation "com.google.dagger:dagger-android-support:$dagger_version"
annotationProcessor "com.google.dagger:dagger-android-processor:$dagger_version"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package ru.gdgkazan.githubmvp.di;

import javax.inject.Singleton;

import dagger.Module;
import dagger.android.ContributesAndroidInjector;
import ru.gdgkazan.githubmvp.screen.auth.AuthActivity;
import ru.gdgkazan.githubmvp.screen.repositories.RepositoriesActivity;
import ru.gdgkazan.githubmvp.screen.walkthrough.WalkthroughActivity;

@Module
public abstract class ActivityBuildersModule {

@Singleton
@ContributesAndroidInjector
abstract AuthActivity contributeAuthActivity();

@Singleton
@ContributesAndroidInjector
abstract RepositoriesActivity contributeRepositoriesActivity();

@Singleton
@ContributesAndroidInjector
abstract WalkthroughActivity contributeWalkthroughActivity();

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,11 @@
import ru.gdgkazan.githubmvp.screen.walkthrough.WalkthroughActivity;

/**
* @author Artur Vasilov
* @author Artur Vasilov, added {@link ActivityBuildersModule} by ANIKINKIRILL
*/
@Singleton
@Component(modules = {DataModule.class})
@Component(modules = {DataModule.class, ActivityBuildersModule.class})
public interface AppComponent {

void injectAuthActivity(AuthActivity authActivity);

void injectRepositoriesActivity(RepositoriesActivity repositoriesActivity);

void injectWalkthroughActivity(WalkthroughActivity walkthroughActivity);

KeyValueStorage keyValueStorage();
}
3 changes: 2 additions & 1 deletion GithubDagger/build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'me.tatarka:gradle-retrolambda:3.3.0-beta4'
classpath 'me.tatarka.retrolambda.projectlombok:lombok.ast:0.2.3.a2'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
Expand Down
4 changes: 2 additions & 2 deletions GithubDagger/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Dec 28 10:00:20 PST 2015
#Wed Jun 12 23:10:39 MSK 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip