View collection.js
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
/*global define*/ | |
define([ | |
'underscore', | |
'backbone', | |
'models/client' | |
], function (_, Backbone, ClientModel) { | |
'use strict'; | |
var ClientCollection = Backbone.Collection.extend({ |
View gist:51c0b0e9286879c02e4e
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
public class SimpleActivity extends Activity { | |
@Inject | |
Api api; | |
@Inject | |
ApiManager apiManager; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { |
View gist:11bacf7ceb98da1e3f42
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
@Singleton | |
public class ApiManager { | |
@Inject | |
Api api; | |
@Inject | |
public ApiManager() { | |
} |
View gist:5c90f405ce7ad5ab024f
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
@Component(modules = {ApiModule.class, DatabaseModule.class}) | |
@Singleton | |
public interface DataAccessComponent { | |
Api api(); | |
Database database(); | |
void inject(SimpleActivity simpleActivity); | |
} |
View gist:482399eb977c9c9a3a85
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
public class SimpleActivity extends Activity { | |
@Inject | |
Api api; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
DemortarApp.getDemortarApp(this).getComponent().inject(this); |
View gist:b48f2c5614577d04f52b
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
public class SimpleActivity extends Activity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
DataAccessComponent component = DemortarApp.getDemortarApp(this) | |
.getComponent(); | |
Api api = component.api(); |
View gist:348fd86a47a3df7cc55e
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
public class DemortarApp extends Application { | |
private DataAccessComponent component; | |
public static DemortarApp getDemortarApp(Context context) { | |
return (DemortarApp) context.getApplicationContext(); | |
} | |
@Override | |
public void onCreate() { |
View gist:09a3a20a75f5a01936d0
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
@Module | |
public class ApiModule { | |
private User user; | |
public ApiModule(User user) { | |
this.user = user; | |
} | |
@Provides |
View 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
public class App extends Application { | |
private MortarScope mortarScope; | |
private Component component; | |
@Override | |
public Object getSystemService(String name) { | |
return mortarScope.hasService(name) ? mortarScope.getService(name) : super.getSystemService(name); | |
} |
View LoginScreen.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
@Layout(R.layout.view_login) | |
@WithComponent(LoginScreen.Component.class) | |
public class LoginScreen extends Path { | |
@dagger.Component(dependencies = RootActivity.Component.class) | |
@PerScreenScope(Component.class) | |
public static interface Component extends RootActivity.Component { | |
void inject(LoginView view); | |
} |
OlderNewer