forked from jakubkinst/Android-ViewModelBinding
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
c1304a9
commit e9417c5
Showing
7 changed files
with
62 additions
and
2 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
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
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
14 changes: 14 additions & 0 deletions
14
sample/src/main/java/cz/kinst/jakub/sample/viewmodelbinding/di/App.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,14 @@ | ||
package cz.kinst.jakub.sample.viewmodelbinding.di; | ||
|
||
import android.app.Application; | ||
|
||
public class App extends Application { | ||
public static MainComponent mainComponent; | ||
|
||
@Override | ||
public void onCreate() { | ||
super.onCreate(); | ||
|
||
mainComponent = DaggerMainComponent.builder().appModule(new AppModule(this)).build(); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
sample/src/main/java/cz/kinst/jakub/sample/viewmodelbinding/di/AppModule.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,23 @@ | ||
package cz.kinst.jakub.sample.viewmodelbinding.di; | ||
|
||
import javax.inject.Singleton; | ||
|
||
import dagger.Module; | ||
import dagger.Provides; | ||
|
||
@Module | ||
public class AppModule { | ||
|
||
private App app; | ||
|
||
|
||
public AppModule(App app) { | ||
this.app = app; | ||
} | ||
|
||
@Provides | ||
@Singleton | ||
public App provideApp() { | ||
return app; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
sample/src/main/java/cz/kinst/jakub/sample/viewmodelbinding/di/MainComponent.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,16 @@ | ||
package cz.kinst.jakub.sample.viewmodelbinding.di; | ||
|
||
import javax.inject.Singleton; | ||
|
||
import cz.kinst.jakub.sample.viewmodelbinding.MainViewModel; | ||
import dagger.Component; | ||
|
||
@Singleton | ||
@Component( | ||
modules = { | ||
AppModule.class | ||
} | ||
) | ||
public interface MainComponent { | ||
void inject(MainViewModel obj); | ||
} |
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 |
---|---|---|
@@ -1 +1 @@ | ||
include ':sample', ':library', ':library-extensions' | ||
include ':sample', ':library'/*, ':library-extensions'*/ |