56 lines
2.1 KiB
Java
56 lines
2.1 KiB
Java
package com.ubt.jimu.diy.presenter;
|
|
|
|
import android.content.Context;
|
|
import com.ubt.jimu.base.entities.ApiRecord;
|
|
import com.ubt.jimu.base.http.ApiObserver;
|
|
import com.ubt.jimu.base.http.manager.DiyManager;
|
|
import com.ubt.jimu.diy.contract.OfficialDiyContract;
|
|
import com.ubt.jimu.diy.model.DiyModel;
|
|
import com.ubt.jimu.widgets.LoadingView;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class OfficialDiyPresenter implements OfficialDiyContract.Presenter {
|
|
private Context context;
|
|
private LoadingView loadingView;
|
|
private OfficialDiyContract.View view;
|
|
|
|
public OfficialDiyPresenter(Context context, OfficialDiyContract.View view, LoadingView loadingView) {
|
|
this.context = context;
|
|
this.view = view;
|
|
this.loadingView = loadingView;
|
|
}
|
|
|
|
@Override // com.ubt.jimu.diy.contract.OfficialDiyContract.Presenter
|
|
public void queryOfficialDiy(boolean z, final int i, int i2) {
|
|
ApiObserver<ApiRecord<DiyModel>> apiObserver = new ApiObserver<ApiRecord<DiyModel>>(this.loadingView) { // from class: com.ubt.jimu.diy.presenter.OfficialDiyPresenter.1
|
|
@Override // com.ubt.jimu.base.http.ApiObserver, io.reactivex.Observer
|
|
public void onComplete() {
|
|
super.onComplete();
|
|
OfficialDiyPresenter.this.view.loadCompleted();
|
|
}
|
|
|
|
@Override // com.ubt.jimu.base.http.ApiObserver, io.reactivex.Observer
|
|
public void onError(Throwable th) {
|
|
super.onError(th);
|
|
OfficialDiyPresenter.this.view.loadError();
|
|
}
|
|
|
|
@Override // com.ubt.jimu.base.http.ApiObserver, io.reactivex.Observer
|
|
public void onNext(ApiRecord<DiyModel> apiRecord) {
|
|
super.onNext((AnonymousClass1) apiRecord);
|
|
OfficialDiyPresenter.this.view.showOfficialDiy(apiRecord.getRecords(), i);
|
|
}
|
|
};
|
|
apiObserver.refreshOrLoad(z);
|
|
DiyManager.getInstance().diyList(i, i2, 1, apiObserver);
|
|
}
|
|
|
|
@Override // com.ubtech.presenter.BasePresenter
|
|
public void subscribe() {
|
|
}
|
|
|
|
@Override // com.ubtech.presenter.BasePresenter
|
|
public void unSubscribe() {
|
|
}
|
|
}
|