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({ |
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 |
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() { |
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(); |
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); |
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); | |
} |
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() { | |
} |
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) { |
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); | |
} |
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); | |
} |
OlderNewer