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 Repository(int id, String name, String fullName, Owner owner, | |
boolean private, String htmlUrl, String description, boolean fork, | |
String url, String forksUrl, String keysUrl, String collaboratorsUrl, | |
String teamsUrl, String hooksUrl, String issueEventsUrl, String eventsUrl, | |
String assigneesUrl, String branchesUrl, String tagsUrl, String blobsUrl, | |
String gitTagsUrl, String gitRefsUrl, String treesUrl, String statusesUrl, | |
String languagesUrl, String stargazersUrl, String contributorsUrl, | |
String subscribersUrl, String subscriptionUrl, String commitsUrl, String gitCommitsUrl, | |
String commentsUrl, String issueCommentUrl, String contentsUrl, String compareUrl, | |
String mergesUrl, String archiveUrl, String downloadsUrl, String issuesUrl, |
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
@Test | |
public void testPlayground() throws Exception { | |
RESTMockServer.whenGET(RequestMatchers.pathEndsWith("users/andrzejchm")).thenReturnFile( | |
"users/andrzejchm.json"); | |
//launches activity with default intent | |
rule.launchActivity(null); | |
Thread.sleep(10000); | |
} |
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
@Test | |
public void testGoodAnswer() throws Exception { | |
RESTMockServer.whenGET(RequestMatchers.pathEndsWith("users/andrzejchm")).thenReturnFile( | |
"users/andrzejchm.json"); | |
//launches activity with default intent | |
rule.launchActivity(null); | |
pageObject.typeUsername("andrzejchm"); | |
pageObject.pressOk(); | |
pageObject.verifyWelcomeMessageForUser("Welcome Andrzej Chmielewski!"); | |
} |
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 BadActivity extends DroidMVPActivity<GoodPresentationModel, GoodView, GoodPresenter> { | |
... | |
@OnClick(R.id.button) public void onButtonClicked() { | |
showProgress(); | |
presenter.onButtonClicked(); | |
} | |
... | |
} |
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 GoodActivity extends DroidMVPActivity<GoodPresentationModel, GoodView, GoodPresenter> { | |
... | |
@OnClick(R.id.button) public void onButtonClicked() { | |
presenter.onButtonClicked(); | |
} | |
... | |
} |
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
showProductsList(List<Product> products); | |
showProgress(); | |
showUpdateCompleted(); |
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 GoodPresenter extends SimpleDroidMVPPresenter<GoodView,GoodPresentationModel> { | |
public void onShowUsersButtonClicked() { | |
getMvpView().showProgress(); | |
repository.getUsers(new Callback() { | |
public void onSuccess(List<Users> users) { | |
usersListFetched(users); | |
} | |
public void onFailure(Exception e) { |
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 GoodPresentationModel implements Serializable { | |
public static final Birthday TODAY = new Birthday(); | |
private List<User> users = Collections.emptyList(); | |
public void setUsers(List<User> users) { | |
this.users = users; | |
} |
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 abstract class BaseActivity<M extends Serializable, V extends DroidMVPView, P extends DroidMVPPresenter<V, M>> | |
extends DroidMVPActivity<M, V, P> { | |
@Inject protected P presenter; | |
@NonNull @Override protected P createPresenter() { | |
//this field will be populated by field injeciton from dagger | |
// your presenter should not accept the presentationModel as its constructor's paramteter. | |
// Instead, it will be provided to your presenter in #attachView method. | |
return presenter; | |
} |
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 GetUserDetailsUsecase { | |
private final DB db; | |
@Inject public GetUserDetailsUsecase(DB db) { | |
this.db = db; | |
} | |
public Observable<UserDetails> getUserDetails() { | |
return Observable.create(new Observable.OnSubscribe<UserDetails>() { |
OlderNewer