|
19 | 19 | import com.fernandocejas.android10.sample.domain.User;
|
20 | 20 | import com.fernandocejas.android10.sample.domain.exception.DefaultErrorBundle;
|
21 | 21 | import com.fernandocejas.android10.sample.domain.exception.ErrorBundle;
|
22 |
| -import com.fernandocejas.android10.sample.domain.interactor.UseCase; |
23 | 22 | import com.fernandocejas.android10.sample.domain.interactor.DefaultSubscriber;
|
| 23 | +import com.fernandocejas.android10.sample.domain.interactor.UseCase; |
24 | 24 | import com.fernandocejas.android10.sample.presentation.exception.ErrorMessageFactory;
|
25 | 25 | import com.fernandocejas.android10.sample.presentation.internal.di.PerActivity;
|
26 | 26 | import com.fernandocejas.android10.sample.presentation.mapper.UserModelDataMapper;
|
|
34 | 34 | * layer.
|
35 | 35 | */
|
36 | 36 | @PerActivity
|
37 |
| -public class UserDetailsPresenter extends DefaultSubscriber<User> implements Presenter { |
| 37 | +public class UserDetailsPresenter implements Presenter { |
38 | 38 |
|
39 | 39 | /** id used to retrieve user details */
|
40 | 40 | private int userId;
|
@@ -108,20 +108,23 @@ private void showUserDetailsInView(User user) {
|
108 | 108 | }
|
109 | 109 |
|
110 | 110 | private void getUserDetails() {
|
111 |
| - this.getUserDetailsUseCase.execute(this); |
| 111 | + this.getUserDetailsUseCase.execute(new UserDetailsSubscriber()); |
112 | 112 | }
|
113 | 113 |
|
114 |
| - @Override public void onCompleted() { |
115 |
| - this.hideViewLoading(); |
116 |
| - } |
| 114 | + private final class UserDetailsSubscriber extends DefaultSubscriber<User> { |
117 | 115 |
|
118 |
| - @Override public void onError(Throwable e) { |
119 |
| - this.hideViewLoading(); |
120 |
| - this.showErrorMessage(new DefaultErrorBundle((Exception) e)); |
121 |
| - this.showViewRetry(); |
122 |
| - } |
| 116 | + @Override public void onCompleted() { |
| 117 | + UserDetailsPresenter.this.hideViewLoading(); |
| 118 | + } |
| 119 | + |
| 120 | + @Override public void onError(Throwable e) { |
| 121 | + UserDetailsPresenter.this.hideViewLoading(); |
| 122 | + UserDetailsPresenter.this.showErrorMessage(new DefaultErrorBundle((Exception) e)); |
| 123 | + UserDetailsPresenter.this.showViewRetry(); |
| 124 | + } |
123 | 125 |
|
124 |
| - @Override public void onNext(User user) { |
125 |
| - this.showUserDetailsInView(user); |
| 126 | + @Override public void onNext(User user) { |
| 127 | + UserDetailsPresenter.this.showUserDetailsInView(user); |
| 128 | + } |
126 | 129 | }
|
127 | 130 | }
|
0 commit comments