-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9ca5f68
commit 444ed10
Showing
20 changed files
with
280 additions
and
209 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 0 additions & 18 deletions
18
app/src/main/java/com/dev/movieapp/components/ContextComponent.java
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
app/src/main/java/com/dev/movieapp/components/NetworkComponent.java
This file was deleted.
Oops, something went wrong.
21 changes: 21 additions & 0 deletions
21
app/src/main/java/com/dev/movieapp/dipinject/components/ApplicationComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.dev.movieapp.dipinject.components; | ||
|
||
|
||
import com.dev.movieapp.dipinject.customscopes.ApplicationScope; | ||
import com.dev.movieapp.dipinject.modules.ApplicationModule; | ||
import com.dev.movieapp.dipinject.modules.NetworkModule; | ||
|
||
import dagger.Component; | ||
|
||
@ApplicationScope | ||
@Component | ||
( | ||
modules = {ApplicationModule.class, NetworkModule.class} | ||
) | ||
public interface ApplicationComponent { | ||
|
||
|
||
InjectionSubComponent newInjectionComponent(); | ||
|
||
|
||
} |
21 changes: 21 additions & 0 deletions
21
app/src/main/java/com/dev/movieapp/dipinject/components/InjectionSubComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.dev.movieapp.dipinject.components; | ||
|
||
import com.dev.movieapp.ui.activities.landing.ResultListActivity; | ||
import com.dev.movieapp.ui.activities.splash.SplashActivity; | ||
import com.dev.movieapp.ui.fragments.detailfrag.ResultDetailFragment; | ||
import com.dev.movieapp.ui.fragments.detailtabfrag.ResultDetailTabFragment; | ||
|
||
import dagger.Subcomponent; | ||
|
||
@Subcomponent | ||
public interface InjectionSubComponent { | ||
|
||
void inject(ResultListActivity activity); | ||
|
||
void inject(ResultDetailFragment fragment); | ||
|
||
void inject(SplashActivity activity); | ||
|
||
void inject(ResultDetailTabFragment fragment); | ||
|
||
} |
15 changes: 15 additions & 0 deletions
15
app/src/main/java/com/dev/movieapp/dipinject/customscopes/ApplicationScope.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.dev.movieapp.dipinject.customscopes; | ||
|
||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
|
||
import javax.inject.Scope; | ||
|
||
/** | ||
* Custom scope for global application singleton dependencies | ||
*/ | ||
|
||
@Scope | ||
@Retention(RetentionPolicy.RUNTIME) | ||
public @interface ApplicationScope { | ||
} |
38 changes: 38 additions & 0 deletions
38
app/src/main/java/com/dev/movieapp/dipinject/modules/ApplicationModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.dev.movieapp.dipinject.modules; | ||
|
||
import android.app.Application; | ||
|
||
import com.dev.movieapp.dipinject.customscopes.ApplicationScope; | ||
import com.dev.movieapp.utils.AppLogger; | ||
import com.dev.movieapp.utils.AppUtils; | ||
|
||
import dagger.Module; | ||
import dagger.Provides; | ||
|
||
@Module | ||
public class ApplicationModule { | ||
|
||
private final Application mApplication; | ||
|
||
public ApplicationModule(Application application) { | ||
mApplication = application; | ||
} | ||
|
||
@Provides | ||
@ApplicationScope | ||
Application application() { | ||
return mApplication; | ||
} | ||
|
||
@Provides | ||
@ApplicationScope | ||
AppLogger logger() { | ||
return new AppLogger(); | ||
} | ||
|
||
@Provides | ||
@ApplicationScope | ||
AppUtils getUtils() { | ||
return new AppUtils(mApplication); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 0 additions & 27 deletions
27
app/src/main/java/com/dev/movieapp/modules/ContextModule.java
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.