1.7.100
This commit is contained in:
parent
74ae7f517e
commit
e5774b422c
22 changed files with 756 additions and 637 deletions
|
@ -16,6 +16,6 @@ public interface ArtistDetailContract {
|
|||
}
|
||||
|
||||
interface Presenter extends BasePresenter<ArtistsDetailsView> {
|
||||
void loadArtistById(int artistId);
|
||||
void loadArtistById();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
package code.name.monkey.retromusic.mvp.presenter;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import code.name.monkey.retromusic.model.Artist;
|
||||
import code.name.monkey.retromusic.mvp.Presenter;
|
||||
import code.name.monkey.retromusic.mvp.contract.ArtistDetailContract;
|
||||
|
||||
import static code.name.monkey.retromusic.ui.activities.ArtistDetailActivity.EXTRA_ARTIST_ID;
|
||||
|
||||
|
||||
/**
|
||||
* Created by hemanths on 20/08/17.
|
||||
|
@ -13,19 +16,19 @@ import code.name.monkey.retromusic.mvp.contract.ArtistDetailContract;
|
|||
|
||||
public class ArtistDetailsPresenter extends Presenter implements ArtistDetailContract.Presenter {
|
||||
|
||||
private final int artistId;
|
||||
@NonNull
|
||||
private final ArtistDetailContract.ArtistsDetailsView view;
|
||||
private Bundle bundle;
|
||||
|
||||
public ArtistDetailsPresenter(@NonNull ArtistDetailContract.ArtistsDetailsView view,
|
||||
int artistId) {
|
||||
Bundle artistId) {
|
||||
this.view = view;
|
||||
this.artistId = artistId;
|
||||
this.bundle = artistId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void subscribe() {
|
||||
loadArtistById(artistId);
|
||||
loadArtistById();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -34,14 +37,14 @@ public class ArtistDetailsPresenter extends Presenter implements ArtistDetailCon
|
|||
}
|
||||
|
||||
@Override
|
||||
public void loadArtistById(int artistId) {
|
||||
disposable.add(repository.getArtistById(artistId)
|
||||
public void loadArtistById() {
|
||||
disposable.add(repository.getArtistById(bundle.getInt(EXTRA_ARTIST_ID))
|
||||
.subscribeOn(schedulerProvider.computation())
|
||||
.observeOn(schedulerProvider.ui())
|
||||
.doOnSubscribe(disposable1 -> view.loading())
|
||||
.subscribe(this::showArtist,
|
||||
throwable -> view.showEmptyView(),
|
||||
() -> view.completed()));
|
||||
view::completed));
|
||||
}
|
||||
|
||||
private void showArtist(Artist album) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue