Skip to content
This repository was archived by the owner on Oct 27, 2024. It is now read-only.

Commit 3ca75a8

Browse files
author
Pulkit Kumar
committed
Merge branch 'dagger2' of https://github.com/esoxjem/MovieGuide into pk_dagger2
2 parents b0fffbd + 578d04b commit 3ca75a8

File tree

7 files changed

+66
-10
lines changed

7 files changed

+66
-10
lines changed

app/build.gradle

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ apply plugin: 'com.android.application'
22
apply plugin: 'com.neenbedankt.android-apt'
33

44
android {
5-
compileSdkVersion 23
6-
buildToolsVersion "23.0.2"
5+
compileSdkVersion 24
6+
buildToolsVersion "23.0.3"
77

88
defaultConfig {
99
applicationId "com.esoxjem.movieguide"
1010
minSdkVersion 15
11-
targetSdkVersion 23
11+
targetSdkVersion 24
1212
versionCode 1
1313
versionName "1.0"
1414
}
@@ -32,10 +32,10 @@ dependencies {
3232
compile fileTree(dir: 'libs', include: ['*.jar'])
3333

3434
//Support
35-
compile 'com.android.support:design:23.1.1'
36-
compile 'com.android.support:support-v4:23.1.1'
37-
compile 'com.android.support:support-annotations:23.1.1'
38-
compile 'com.android.support:palette-v7:23.1.1'
35+
compile 'com.android.support:design:24.1.1'
36+
compile 'com.android.support:support-v4:24.1.1'
37+
compile 'com.android.support:support-annotations:24.1.1'
38+
compile 'com.android.support:palette-v7:24.1.1'
3939

4040
// Rx
4141
compile 'io.reactivex:rxandroid:1.0.1'
@@ -56,4 +56,9 @@ dependencies {
5656
compile 'net.jcip:jcip-annotations:1.0'
5757
compile 'com.squareup.picasso:picasso:2.5.2'
5858
compile 'com.squareup.moshi:moshi:1.1.0'
59+
60+
// dependency injection
61+
apt 'com.google.dagger:dagger-compiler:2.5'
62+
compile 'com.google.dagger:dagger:2.5'
63+
provided 'javax.annotation:jsr250-api:1.0'
5964
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.esoxjem.movieguide;
2+
3+
import com.esoxjem.movieguide.favorites.FavoritesStore;
4+
5+
import javax.inject.Singleton;
6+
7+
import dagger.Component;
8+
9+
/**
10+
* @author arun
11+
*/
12+
13+
@Singleton
14+
@Component(modules = {AppModule.class})
15+
public interface AppComponent
16+
{
17+
void inject(FavoritesStore target);
18+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package com.esoxjem.movieguide;
2+
3+
import android.app.Application;
4+
import android.content.Context;
5+
6+
import javax.inject.Singleton;
7+
8+
import dagger.Module;
9+
import dagger.Provides;
10+
11+
/**
12+
* @author arun
13+
*/
14+
@Module
15+
public class AppModule
16+
{
17+
private final Application application;
18+
19+
public AppModule(Application application)
20+
{
21+
this.application = application;
22+
}
23+
24+
@Provides
25+
@Singleton
26+
Context providesContext()
27+
{
28+
return application;
29+
}
30+
}

app/src/main/java/com/esoxjem/movieguide/BaseApplication.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,5 @@ private NetworkModule getNetworkModule()
7171
{
7272
return new NetworkModule();
7373
}
74+
7475
}

app/src/main/java/com/esoxjem/movieguide/favorites/FavoritesStore.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import java.util.Map;
1515

1616
import javax.inject.Inject;
17+
1718
import javax.inject.Singleton;
1819

1920
/**
@@ -22,6 +23,7 @@
2223
@Singleton
2324
public class FavoritesStore
2425
{
26+
2527
private static final String PREF_NAME = "FavoritesStore";
2628
private SharedPreferences pref;
2729

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildscript {
55
jcenter()
66
}
77
dependencies {
8-
classpath 'com.android.tools.build:gradle:1.3.1'
8+
classpath 'com.android.tools.build:gradle:2.1.2'
99
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
1010
// NOTE: Do not place your application dependencies here; they belong
1111
// in the individual module build.gradle files
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Wed Apr 10 15:27:10 PDT 2013
1+
#Mon Apr 18 12:49:42 IST 2016
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip

0 commit comments

Comments
 (0)