-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Introduced new application architecture to support wiring of DI and better code structures
- Loading branch information
Showing
15 changed files
with
198 additions
and
10 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
13 changes: 13 additions & 0 deletions
13
app/src/main/java/jonburney/version7/kingsgatemediaplayer/Attributes/PerActivity.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,13 @@ | ||
package jonburney.version7.kingsgatemediaplayer.Attributes; | ||
|
||
import java.lang.annotation.Retention; | ||
|
||
import javax.inject.Scope; | ||
import static java.lang.annotation.RetentionPolicy.RUNTIME; | ||
/** | ||
* Created by jburney on 16/02/2016. | ||
*/ | ||
@Scope | ||
@Retention(RUNTIME) | ||
public @interface PerActivity { | ||
} |
16 changes: 16 additions & 0 deletions
16
app/src/main/java/jonburney/version7/kingsgatemediaplayer/Components/IActivityComponent.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 jonburney.version7.kingsgatemediaplayer.Components; | ||
|
||
import android.app.Activity; | ||
|
||
import dagger.Component; | ||
import jonburney.version7.kingsgatemediaplayer.Attributes.PerActivity; | ||
import jonburney.version7.kingsgatemediaplayer.Modules.ActivityModule; | ||
|
||
/** | ||
* Created by jburney on 16/02/2016. | ||
*/ | ||
@PerActivity | ||
@Component (dependencies = IApplicationComponent.class, modules = ActivityModule.class) | ||
public interface IActivityComponent { | ||
Activity activity(); | ||
} |
20 changes: 20 additions & 0 deletions
20
...c/main/java/jonburney/version7/kingsgatemediaplayer/Components/IApplicationComponent.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,20 @@ | ||
package jonburney.version7.kingsgatemediaplayer.Components; | ||
|
||
import android.content.Context; | ||
|
||
import javax.inject.Singleton; | ||
|
||
import dagger.Component; | ||
import dagger.Provides; | ||
import jonburney.version7.kingsgatemediaplayer.Activities.MainActivity; | ||
import jonburney.version7.kingsgatemediaplayer.Modules.ApplicationModule; | ||
|
||
/** | ||
* Created by jburney on 16/02/2016. | ||
*/ | ||
@Singleton | ||
@Component(modules = ApplicationModule.class) | ||
public interface IApplicationComponent { | ||
void inject(MainActivity mainActivity); | ||
Context context(); | ||
} |
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
13 changes: 13 additions & 0 deletions
13
...in/java/jonburney/version7/kingsgatemediaplayer/DataProviders/IVideoListDataProvider.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,13 @@ | ||
package jonburney.version7.kingsgatemediaplayer.DataProviders; | ||
|
||
import java.util.ArrayList; | ||
|
||
import dagger.Module; | ||
import dagger.Provides; | ||
|
||
/** | ||
* Created by jburney on 16/02/2016. | ||
*/ | ||
public interface IVideoListDataProvider { | ||
public ArrayList<String> FetchVideoList(String rssFeedUrl); | ||
} |
30 changes: 30 additions & 0 deletions
30
app/src/main/java/jonburney/version7/kingsgatemediaplayer/MainApp.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,30 @@ | ||
package jonburney.version7.kingsgatemediaplayer; | ||
|
||
import android.app.Application; | ||
|
||
import jonburney.version7.kingsgatemediaplayer.Components.DaggerIApplicationComponent; | ||
import jonburney.version7.kingsgatemediaplayer.Components.IApplicationComponent; | ||
import jonburney.version7.kingsgatemediaplayer.Modules.ApplicationModule; | ||
|
||
/** | ||
* Created by jburney on 16/02/2016. | ||
*/ | ||
public class MainApp extends Application { | ||
|
||
private IApplicationComponent applicationComponent; | ||
|
||
@Override | ||
public void onCreate() { | ||
super.onCreate(); | ||
this.applicationComponent = DaggerIApplicationComponent.builder() | ||
.applicationModule(new ApplicationModule(this)) | ||
.build(); | ||
|
||
} | ||
|
||
|
||
|
||
public IApplicationComponent getApplicationComponent() { | ||
return this.applicationComponent; | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
app/src/main/java/jonburney/version7/kingsgatemediaplayer/Modules/ActivityModule.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 jonburney.version7.kingsgatemediaplayer.Modules; | ||
|
||
import android.app.Activity; | ||
|
||
import dagger.Module; | ||
import dagger.Provides; | ||
import jonburney.version7.kingsgatemediaplayer.Attributes.PerActivity; | ||
|
||
/** | ||
* Created by jburney on 16/02/2016. | ||
*/ | ||
@Module | ||
public class ActivityModule { | ||
private final Activity activity; | ||
|
||
public ActivityModule(Activity activity) { | ||
this.activity = activity; | ||
} | ||
|
||
@Provides @PerActivity Activity activity() { | ||
return this.activity; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
app/src/main/java/jonburney/version7/kingsgatemediaplayer/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,28 @@ | ||
package jonburney.version7.kingsgatemediaplayer.Modules; | ||
|
||
import android.content.Context; | ||
|
||
import javax.inject.Singleton; | ||
|
||
import dagger.Module; | ||
import dagger.Provides; | ||
import jonburney.version7.kingsgatemediaplayer.MainApp; | ||
|
||
/** | ||
* Created by jburney on 16/02/2016. | ||
*/ | ||
@Module | ||
public class ApplicationModule { | ||
|
||
private final MainApp application; | ||
|
||
public ApplicationModule(MainApp application) { | ||
this.application = application; | ||
} | ||
|
||
@Provides @Singleton Context provideApplicationContext() { | ||
return this.application; | ||
} | ||
|
||
|
||
} |
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
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